evo to isto u VB-U
Code:
Public Shared Function IsTrialNumber(ByVal key As String) As Boolean
Dim flag2 As Boolean
If (StringType.StrCmp(key, "", False) = 0) Then
Return True
End If
Dim text1 As String = ""
Dim text2 As String = ""
Dim num2 As Integer = 0
Dim flag1 As Boolean = False
Try
Do While Not flag1
text2 = key.Substring(num2, 1)
num2 = (num2 + (IntegerType.FromString(text2) + 1))
text1 = (text1 & key.Substring(num2, 1))
num2 += 1
If (num2 = key.Length) Then
flag1 = True
End If
Loop
Dim num1 As Long = LongType.FromString(text1)
If ((num1 Mod 379) <> 0) Then
Return True
End If
num1 = CType(Math.Round(CType((CType(num1,Double) / 379),Double)),Long)
Dim num5 As Integer = CType(Math.Round(CType((Conversion.Int(CType((CType(num1,Double) / 416),Double)) + 2005),Double)),Integer)
num1 = (num1 - ((num5 - 2005) * 416))
Dim num4 As Integer = CType(Math.Round(Conversion.Int(CType((CType(num1,Double) / 32),Double))),Integer)
num1 = (num1 - (num4 * 32))
Dim num3 As Integer = CType(num1,Integer)
If (num3 > 31) Then
Return True
End If
If (num4 > 12) Then
Return True
End If
If ((num5 < 2000) Or (num5 > 2050)) Then
Return True
End If
flag2 = False
Catch exception1 As Exception
ProjectData.SetProjectError(exception1)
flag2 = True
ProjectData.ClearProjectError
End Try
Return flag2
End Function
ili u delphiu
Code:
function Main.IsTrialNumber(key: string): boolean;
var
flag2: boolean;
text1: string;
text2: string;
num2: Integer;
flag1: boolean;
begin
if (StringType.StrCmp(key, '', false) = 0) then
begin
result := true;
exit
end;
text1 := '';
text2 := '';
num2 := 0;
flag1 := false;
try
while (not flag1) do
begin
text2 := key.Substring(num2, 1);
num2 := (num2 + (IntegerType.FromString(text2) + 1));
text1 := string.Concat(text1, key.Substring(num2, 1));
num2++;
if (num2 = key.Length) then
flag1 := true
end;
num1 := LongType.FromString(text1);
if ((num1 mod 379) <> 0) then
begin
result := true;
exit
end;
num1 := (Math.Round((((num1 as Double) div 379) as Double)) as Int64);
num5 := (Math.Round(((Conversion.Int((((num1 as Double) div 416) as Double)) + 2005) as Double)) as Integer);
num1 := (num1 - ((num5 - 2005) * 416));
num4 := (Math.Round(Conversion.Int((((num1 as Double) div 32) as Double))) as Integer);
num1 := (num1 - (num4 * 32));
num3 := (num1 as Integer);
if (num3 > 31) then
begin
result := true;
exit
end;
if (num4 > 12) then
begin
result := true;
exit
end;
if ((num5 < 2000) or (num5 > 2050)) then
begin
result := true;
exit
end;
flag2 := false
except
on exception1: Exception do
begin
ProjectData.SetProjectError(exception1);
flag2 := true;
ProjectData.ClearProjectError
end
end;
begin
result := flag2;
exit
end
end;
ili u C# ako nisam pogreshio
Code:
public static bool IsTrialNumber(string key)
{
bool flag2;
if (StringType.StrCmp(key, "", false) == 0)
{
return true;
}
string text1 = "";
string text2 = "";
int num2 = 0;
bool flag1 = false;
try
{
while (!flag1)
{
text2 = key.Substring(num2, 1);
num2 += (IntegerType.FromString(text2) + 1);
text1 = text1 + key.Substring(num2, 1);
num2++;
if (num2 == key.Length)
{
flag1 = true;
}
}
long num1 = LongType.FromString(text1);
if ((num1 % 0x17b) != 0)
{
return true;
}
num1 = (long) Math.Round((double) (((double) num1) / 379));
int num5 = (int) Math.Round((double) (Conversion.Int((double) (((double) num1) / 416)) + 2005));
num1 -= ((num5 - 0x7d5) * 0x1a0);
int num4 = (int) Math.Round(Conversion.Int((double) (((double) num1) / 32)));
num1 -= (num4 * 0x20);
int num3 = (int) num1;
if (num3 > 0x1f)
{
return true;
}
if (num4 > 12)
{
return true;
}
if ((num5 < 2000) | (num5 > 2050))
{
return true;
}
flag2 = false;
}
catch (Exception exception1)
{
ProjectData.SetProjectError(exception1);
flag2 = true;
ProjectData.ClearProjectError();
}
return flag2;
}