|
-
Jul 24th, 2010, 09:12 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] How can i make a serial code for my program
Ok i am having my app available for 30days free trial, but after that you have to purchase a serial, how can i make my app only recognise a specific type e.g NumberLetterLetterNumberLetterLetterNumberNumber-NumberLetter-Letter:NumberNumberNumberNumber?
OR what would be the easiest way to have serials recognised?
-
Jul 24th, 2010, 09:23 AM
#2
Re: How can i make a serial code for my program
Hi,
You can find some information about how to create a License for your Application, here.
-
Jul 24th, 2010, 09:56 AM
#3
Thread Starter
Fanatic Member
Re: How can i make a serial code for my program
that is like really advanced all i want is my program to be able to recognise the serial
So how do i like check to see if the string(the serial) put in is in the format
NumberLetterLetterNumberLetterLetterNumberNumber-NumberLetter-Letter:NumberNumberNumberNumber?
-
Jul 24th, 2010, 01:36 PM
#4
Junior Member
Re: How can i make a serial code for my program
I dont know enough about regular expressions, but couldn't you check the string against stored pattern?
If it matches the pattern then its a legitimate serial number?
-
Jul 24th, 2010, 01:42 PM
#5
Frenzied Member
Re: How can i make a serial code for my program
It all dependence on how advance you want to make it.
For example
Were do you want to keep the keys
local database or a online server.
The list goes on and on.
-
Jul 24th, 2010, 02:55 PM
#6
Thread Starter
Fanatic Member
Re: How can i make a serial code for my program
@PC NOT MAC
I wasn't going to keep keys anywhere all i wanted to do was make like a string with different combination of things in it and the program recognises whether it is a valid serial (If it has the correct combination of things) then it accepts the serial, i know it wont be very secure but im going to make the serial very long.
The program needs to recognise if the string has for example a NumberLetterLetterNumberLetterLetterNumberNumber-NumberLetter-Letter:NumberNumberNumberNumber
So how would i do this?
@SATORY
How do i check it againsted a stored pattern???? ( This sounds like what i want to do )
-
Jul 24th, 2010, 04:51 PM
#7
Lively Member
Re: How can i make a serial code for my program
using regex, here is a sample project I put together. (this is comparing to the example you gave (for your serial number)
vb.net Code:
Imports System.Text.RegularExpressions Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim myreg As New Regex("^\d\w{2}\d\w{2}\d{2}-\d\w-\w:\d{4}\b") Dim str As String = "3su3wi28-2d-s:43782" If myreg.ismatch(str) Then Console.WriteLine(True) Else Console.WriteLine(False) End If End Sub End Class
Code:
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myreg As New Regex("^\d\w{2}\d\w{2}\d{2}-\d\w-\w:\d{4}\b")
Dim str As String = "3su3wi28-2d-s:43782"
If myreg.ismatch(str) Then
Console.WriteLine(True)
Else
Console.WriteLine(False)
End If
End Sub
End Class
here are the two sites i used (first one on how to impliement into vb, 2nd one is how to make the regex (there is a nice table about 1/4th down the page)
http://visualbasic.about.com/od/usin...RegExNET_2.htm
http://www.codeproject.com/KB/dotnet/regextutorial.aspx
-
Jul 24th, 2010, 06:08 PM
#8
Thread Starter
Fanatic Member
Re: How can i make a serial code for my program
Ok thankyou for this, that link is really helpful
Last edited by Emcrank; Jul 24th, 2010 at 06:18 PM.
-
Jul 24th, 2010, 06:16 PM
#9
Lively Member
Re: How can i make a serial code for my program
good news, YOU can do REGEX!, the only problem is that the parentheses are "special" in regex, they are used for groups or something (no idea, this is my first day i've tried regex with any success, so im just as a beginner as you here.
following works perfectly (just took out the parentheses and replaced the \w\w{5} with \w{6}
Code:
Dim myreg As New Regex("^\d\w{3}\d{2}\w\d{2}\w{2}\d{7}\w\d:-=\w{3}\d{3}:=:\w{2}\d\w\d\w{6}~\d{2}\w\d\w\d{2}$")
Dim str As String = "1hgj75j34jh7685678k6:-=jhk657:=:ho5g6hhgjfk~56j5k67"
If myreg.IsMatch(str) Then
MsgBox("I can do regex!")
Else
MsgBox("I cant do regex :(")
End If
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|