'________________________________________________________
'##################Progress Show#############################
Sub updatePro
If argue = "" Then
Shapes.SetText(progress,Math.Round((i*100)/stringLenght)+" %")
EndIf
EndSub
Sub updateProcess
If argue = "" Then
Shapes.SetText(process,j)
EndIf
EndSub
'-------------------------------------------------------------------------------------------------
'________________________________________________________
'######################Key Dots############################
' under development
'-------------------------------------------------------------------------------------------------
'________________________________________________________
'###################Button Click Handler#######################
'-------------------------------------------------------------------------------------------------
Sub onCLick
lastCliked = Controls.LastClickedButton
If lastCliked = "Button1" Then
getKeyString()
If keyLenght <> 0 And stringLenght <> 0 Then
repeatKey()
ciPher()
outPut()
saveKey()
Else
sHowError()
EndIf
ElseIf lastCliked = "Button2" Then
getKeyString()
If keyLenght <> 0 And stringLenght <> 0 Then
repeatKey()
deCipher()
outPut()
saveKey()
Else
sHowError()
EndIf
ElseIF lastCliked = "Button3" Then
openFile()
ElseIF lastCliked = "Button4" Then
getKeyString()
If keyLenght <> 0 And stringLenght <> 0 Then
saveFile()
Else
sHowError()
EndIf
EndIf
EndSub
'---------------------------------------------------------------------------------------------------
'__________________________________________________________
'#################File Open Event Handler########################
'----------------------------------------------------------------------------------------------------
Sub openFile
filepath = LDDialogs.OpenFile("*","")
' The following line could be harmful and has been automatically commented.
' fileData = File.ReadContents(filepath)
Controls.SetTextBoxText(textBoxMain,fileData)
EndSub
'-----------------------------------------------------------------------------------------------------
'___________________________________________________________
'#####################File save ivent handler######################
'-----------------------------------------------------------------------------------------------------
Sub saveFile
fileData = Controls.GetTextBoxText(textBoxMain)
filepath = LDDialogs.SaveFile("txt","")
' The following line could be harmful and has been automatically commented.
' File.WriteContents(filepath,fileData)
EndSub
'------------------------------------------------------------------------------------------------------
'___________________________________________________________
'#######################Encryption############################
'-----------------------------------------------------------------------------------------------------
Sub ciPher
j = 2
updateProcess()
For i = 1 To stringLenght
updatePro()
getKeyChar()
getStringChar()
If stringChar >= 0 And stringChar <= 47 Then
enCryptChar()
appendChar()
Else
appendChar()
EndIf
EndFor
EndSub
'------------------------------------------------------------------------------------------------------
'___________________________________________________________
'#################Decryption##################################
'------------------------------------------------------------------------------------------------------
Sub deCipher
j = 2
updateProcess()
For i = 1 To stringLenght
updatePro()
getKeyChar()
getStringChar()
If stringChar >= 0 And stringChar <= 47 Then
deCryptChar()
cHeck()
appendChar()
Else
appendChar()
EndIf
EndFor
EndSub
'-------------------------------------------------------------------------------------------------------
'____________________________________________________________
'######################Get Character from key#####################
'-------------------------------------------------------------------------------------------------------
Sub getKeyChar
keyChar = Text.GetCharacterCode(Text.GetSubText(keyword,i,1))
If keyChar >= 65 And keyChar <= 90 Then
valk = 2
ElseIf keyChar >= 97 And keyChar <= 122 Then
valk = 3
ElseIf keyChar >= 48 And keyChar <= 57 Then
valk = 4
EndIf
keyChar = keyChar - offset[valk]
EndSub
'---------------------------------------------------------------------------------------------------------
'_____________________________________________________________
'#####################Get Character from String######################
'---------------------------------------------------------------------------------------------------------
Sub getStringChar
stringChar = Text.GetCharacterCode(Text.GetSubText(string,i,1))
If stringChar >= 65 And stringChar <= 90 Then
vals = 2
ElseIf stringChar >= 97 And stringChar <= 122 Then
vals = 3
ElseIf stringChar >= 48 And stringChar <= 57 Then
vals = 4
ElseIf stringChar >= 0 And stringChar <= 47 Then
vals = 5
ElseIf stringChar >= 91 And stringChar <= 96 Then
vals = 6
ElseIf stringChar >= 58 And stringChar <= 64 Then
vals = 7
ElseIf stringChar >= 123 And stringChar <= 127 Then
vals = 8
EndIf
stringChar = stringChar - offset[vals]
EndSub
'------------------------------------------------------------------------------------------------------------
'___________________________________________________________________
'###########Print The final output into the textbox##############################
'-------------------------------------------------------------------------------------------------------------------
Sub outPut
Controls.SetTextBoxText(textBoxMain,enstring)
enstring = ""
EndSub
'--------------------------------------------------------------------------------------------------------------------
'____________________________________________________________________
'################Show error if fields are empty################################
'---------------------------------------------------------------------------------------------------------------------
Sub sHowError
GraphicsWindow.ShowMessage("Either Text box or Key box is empty or may be both","Error")
EndSub
'---------------------------------------------------------------------------------------------------------------------
'____________________________________________________________________
'##########Drag-n-Drop encrypter console(Experimental) currently not working#########
'---------------------------------------------------------------------------------------------------------------------
Sub onLoad
argue = Program.GetArgument(1)
If argue <> "" Then
' The following line could be harmful and has been automatically commented.
' argustring = File.ReadContents(argue)
TextWindow.WriteLine("Enter key")
arguekey = TextWindow.Read()
TextWindow.Hide()
init_Vars()
getKeyString()
repeatKey()
ciPher()
TextWindow.WriteLine("Give your encrypted file a name")
name = TextWindow.Read()
' The following line could be harmful and has been automatically commented.
' File.WriteContents(Program.Directory+"\"+name+".txt",string)
Program.End()
Else
init()
EndIf
EndSub
'-----------------------------------------------------------------------------------------------------------------------
'_____________________________________________________________________'
'#####################Random key Generater################################
'-----------------------------------------------------------------------------------------------------------------------
Sub keyDown
If GraphicsWindow.LastKey = "F1" Then
randKey()
EndIf
EndSub
Sub randKey
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
lenght = 20
keyw = ""
While Text.GetLength(keyw) < lenght
randigit = Math.GetRandomNumber(Text.GetLength(chars))
kchar = Text.GetSubText(chars,randigit,1)
keyw = keyw + kchar
EndWhile
Controls.SetTextBoxText(textBoxKey,keyw)
EndSub
'-------------------------------------------------------------------------------------------------------------------------
'______________________________________________________________________
'########################Prompt to save key######Currently not working###########
'------------------------------------------------------------------------------------------------------------------------
Sub saveKey
return = 0'GraphicsWindow.ShowMessage("Save key on local drive?","Save Key","YesNo","Question","Button2")
If return = "Yes" Then
path = LDDialogs.SaveFile("txt","")
' The following line could be harmful and has been automatically commented.
' File.WriteContents(path,key)
Controls.SetTextBoxText(textBoxKey,"")
EndIf
EndSub