Platforms to show: All Mac Windows Linux Cross-Platform

/Main/Hide Serial Number


Required plugins for this example:

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Main/Hide Serial Number

This example is the version from Fri, 25th Aug 2016.

Project "Hide Serial Number.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control iName Inherits TextField
ControlInstance iName Inherits TextField
EventHandler Sub TextChange() update End EventHandler
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control iProduct Inherits TextField
ControlInstance iProduct Inherits TextField
EventHandler Sub TextChange() update End EventHandler
End Control
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control iEndDate Inherits TextField
ControlInstance iEndDate Inherits TextField
EventHandler Sub TextChange() update End EventHandler
End Control
Control iSerial Inherits TextField
ControlInstance iSerial Inherits TextField
EventHandler Sub TextChange() update End EventHandler
End Control
Control StaticText4 Inherits Label
ControlInstance StaticText4 Inherits Label
End Control
Control PushButton1 Inherits PushButton
ControlInstance PushButton1 Inherits PushButton
EventHandler Sub Action() run End EventHandler
End Control
Control EditField5 Inherits TextArea
ControlInstance EditField5 Inherits TextArea
End Control
Control CheckBox1 Inherits CheckBox
ControlInstance CheckBox1 Inherits CheckBox
EventHandler Sub Action() run End EventHandler
End Control
Control CheckBox2 Inherits CheckBox
ControlInstance CheckBox2 Inherits CheckBox
EventHandler Sub Action() run End EventHandler
End Control
Control PushButton2 Inherits PushButton
ControlInstance PushButton2 Inherits PushButton
EventHandler Sub Action() EditField5.SelectAll EditField5.Copy End EventHandler
End Control
Control CheckBox3 Inherits CheckBox
ControlInstance CheckBox3 Inherits CheckBox
EventHandler Sub Action() run End EventHandler
End Control
Control CheckBox4 Inherits CheckBox
ControlInstance CheckBox4 Inherits CheckBox
EventHandler Sub Action() run End EventHandler
End Control
EventHandler Sub Open() #if DebugBuild iName.text="TestUser" iProduct.text="MBS Complete" iEndDate.text="200907" iSerial.text="1234" PushButton1.Push #endif End EventHandler
Sub AddLinesRandom(dest() as string, source() as string) source.Shuffle for each s as string in source dest.Append s next redim source(-1) End Sub
Sub Process(enable as Boolean, name as string, varname as string, prefix as string) if enable then dim ids(-1) as string for i as integer=1 to len(name) ids.Append str(i) next ids.Shuffle ids.Insert 0,"0" dim s(-1) as string for i as integer=1 to len(name) dim p as string = prefix + ids(i) if rnd>0.5 then // with chr() and string concat dimlines.Append "dim " + p + " as integer="+str(asc(mid(name,i,1))) s.Append "encodings.utf8.chr(" + p + ")" else // with string concat dimlines.Append "dim " + p + " as string="""+mid(name,i,1)+"""" s.Append p end if next calclines.Append varname + " = " + Join(s,"+") else calclines.Append varname + " = """ + name + """" end if End Sub
Sub RunNew() dim enddate as integer dim name,product,serial as string dim lines(-1) as string name=iName.text product=iProduct.text enddate=val(iEndDate.text) Serial=iSerial.text lines.Append "// """+name+""", """+product+""", "+str(enddate)+", """+serial+"""" lines.Append "" dimlines.Append "dim name as string" dimlines.Append "dim product as string" dimlines.Append "dim enddate as integer" dimlines.Append "dim serial as string" if CheckBox2.Value then dim f1,f2 as integer dim r1,r2 as integer dim z1,z2 as integer f1=rnd*100 f2=rnd*100 r2=enddate mod f2 z2=enddate\f2 r1=z2 mod f1 z1=z2\f1 dimlines.Append "dim e1 as integer="+str(z1) dimlines.Append "dim e2 as integer="+str(r1) dimlines.Append "dim e3 as integer="+str(f1) dimlines.Append "dim e4 as integer="+str(f2) dimlines.Append "dim e5 as integer="+str(r2) calclines.Append "enddate=e5+(e2+e1*E3)*e4" else calclines.Append "enddate="+str(Serial) end if Process CheckBox3.Value, name, "name", "n" Process CheckBox4.Value, product, "product", "p" Process CheckBox1.Value, serial, "serial", "s" AddLinesRandom lines,dimlines lines.Append "" AddLinesRandom lines,calclines lines.Append "" lines.Append "if not RegisterMBS"+"Plugin(name,product,enddate,serial) then" lines.Append "MsgBox ""MBS Plugin registration failed.""" lines.Append "" lines.Append "// MsgBox """"""""+name+"""""", """"""+product+"""""", ""+str(enddate)+"", ""+serial" lines.Append "" lines.Append "end if" lines.Append "" dim nlines(-1) as string nlines.Append "product = """"" nlines.Append "name = """"" nlines.Append "serial = """"" nlines.Append "enddate = 0" AddLinesRandom lines,nlines EditField5.text=Join(lines,EndOfLine) End Sub
Sub RunOld() dim enddate,serial as integer dim name,product as string dim lines(-1) as string name=iName.text product=iProduct.text enddate=val(iEndDate.text) Serial=val(iSerial.text) lines.Append "// """+name+""", """+product+""", "+str(enddate)+", "+str(serial) lines.Append "" dimlines.Append "dim name as string" dimlines.Append "dim product as string" dimlines.Append "dim enddate as integer" dimlines.Append "dim serial as integer" if CheckBox1.Value then dim f1,f2 as integer dim r1,r2 as integer dim z1,z2 as integer f1=rnd*100 f2=rnd*100 r2=serial mod f2 z2=serial\f2 r1=z2 mod f1 z1=z2\f1 dimlines.Append "dim s1 as integer="+str(z1) dimlines.Append "dim s2 as integer="+str(r1) dimlines.Append "dim s3 as integer="+str(f1) dimlines.Append "dim s4 as integer="+str(f2) dimlines.Append "dim s5 as integer="+str(r2) calclines.Append "serial=(s1*s3+s2)*s4+s5" else calclines.Append "serial="+str(Serial) end if if CheckBox2.Value then dim f1,f2 as integer dim r1,r2 as integer dim z1,z2 as integer f1=rnd*100 f2=rnd*100 r2=enddate mod f2 z2=enddate\f2 r1=z2 mod f1 z1=z2\f1 dimlines.Append "dim e1 as integer="+str(z1) dimlines.Append "dim e2 as integer="+str(r1) dimlines.Append "dim e3 as integer="+str(f1) dimlines.Append "dim e4 as integer="+str(f2) dimlines.Append "dim e5 as integer="+str(r2) calclines.Append "enddate=e5+(e2+e1*E3)*e4" else calclines.Append "enddate="+str(Serial) end if Process CheckBox3.Value, name, "name", "n" Process CheckBox4.Value, product, "product", "p" AddLinesRandom lines,dimlines lines.Append "" AddLinesRandom lines,calclines lines.Append "" lines.Append "if not RegisterMBS"+"Plugin(name,product,enddate,serial) then" lines.Append "MsgBox ""MBS Plugin registration failed.""" lines.Append "" lines.Append "// MsgBox """"""""+name+"""""", """"""+product+"""""", ""+str(enddate)+"", ""+str(serial)+EndOfLine+"""""""+name+""""", """""+product+""""", "+str(enddate)+", "+str(serial)+"""" lines.Append "" lines.Append "end if" lines.Append "" dim nlines(-1) as string nlines.Append "product=""""" nlines.Append "name=""""" nlines.Append "serial=0" nlines.Append "enddate=0" AddLinesRandom lines,nlines EditField5.text=Join(lines,EndOfLine) End Sub
Sub run() redim calclines(-1) redim dimlines(-1) if iSerial.Text.len > 12 then RunNew else runold end if End Sub
Sub update() PushButton1.Enabled=len(iName.text)>0 and len(iProduct.text)>0 and len(iSerial.text)>0 and len(iEndDate.text)>0 End Sub
Property calclines() As string
Property dimlines() As string
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

The items on this page are in the following plugins: MBS Main Plugin.


The biggest plugin in space...