Sign in to follow this  
Followers 0
themax90

AutoDat

5 posts in this topic

#1 ·  Posted (edited)

Basically AutoDat a.k.a AutoIt Database is a variable storing system intended to make sure the memory cannot be read. In the future it will be developed to be used remotely and through the console. This will enable it to be the grounds for a sever-sided game if anyone takes on the task.

AutoDat is a simple form of AdminDB and is great for saving private information.

Goal :

To provide AutoIt users with a MySQL like database system with complete flexibility and the ability to be used as an Include or as a stand-alone.

AutoDat.au3 [an include]

#include-once
Global $VariablePool[1]
#Include <String.au3>
Func AddValue($Name, $Value = 0, $Protect = 2, $Pass = "default")
    ; Does not return anything.
    Local $PoolResize = UBound($VariablePool) + 1
    ReDim $VariablePool[$PoolResize][5]
    $VariablePool[($PoolResize - 2)][0] = $Name
    $VariablePool[($PoolResize - 2)][1] = _Encrypt($Value, $Pass)
    $VariablePool[($PoolResize - 2)][2] = $Protect
    $VariablePool[($PoolResize - 2)][3] = _Encrypt($Pass, $Pass)
    CleanPool()
EndFunc
Func DeleteValue($Name, $Pass = "default")
    ; Success = Returns 1 and @Error = 0
    ; Failure = Returns -1 and @Error = -1 Invalid Pass, -2 Could not find.
    Local $NameResult, $ProtectResult, $Track = 0, $ValueResult
    For $Track = 0 To (UBound($VariablePool) - 1) Step 1
        Select
        Case $VariablePool[$Track][0] = $Name And _Encrypt($VariablePool[$Track][3], $Pass, 0, $VariablePool[$Track][2]) = $Pass
            $VariablePool[$Track][0] = ""
            $VariablePool[$Track][1] = ""
            $VariablePool[$Track][2] = ""
            $VariablePool[$Track][3] = ""
            Return 1
        Case $VariablePool[$Track][0] = $Name And _Encrypt($VariablePool[$Track][3], $Pass, 0, $VariablePool[$Track][2]) <> $Pass
            SetError(-1)
            Return -1
        EndSelect
    Next
    SetError(-2)
    Return -1
EndFunc
Func EditValue($Name, $Value, $Pass = "default")
    ; Success = Returns 1 and @Error = 0
    ; Failure = Returns -1 and @Error = -1 Invalid Pass, -2 Could not find.
    Local $NameResult, $ProtectResult, $Track = 0, $ValueResult
    For $Track = 0 To (UBound($VariablePool) - 1) Step 1
        Select
        Case $VariablePool[$Track][0] = $Name And _Encrypt($VariablePool[$Track][3], $Pass, 0, $VariablePool[$Track][2]) = $Pass
            $VariablePool[$Track][1] = _Encrypt($Value, $Pass, 1, $VariablePool[$Track][2])
            Return 1
        Case $VariablePool[$Track][0] = $Name And _Encrypt($VariablePool[$Track][3], $Pass, 0, $VariablePool[$Track][2]) <> $Pass
            SetError(-1)
            Return -1
        EndSelect
    Next
    SetError(-2)
    Return -1
EndFunc
Func CallValue($Name, $Pass = "default")
    ; Returns the value of the variable name.  Also checks password and protection laws.
    ; Success = Returns Value
    ; Failure = Returns -1
    Local $Track = 0
        For $Track = 0 To (UBound($VariablePool) - 1) Step 1
            If $VariablePool[$Track][0] = $Name And $Pass = _Encrypt($VariablePool[$Track][3], $Pass, 0, $VariablePool[$Track][2]) Then Return _Encrypt($VariablePool[$Track][1], $Pass, 0, $VariablePool[$Track][2])
        Next
    Return -1
EndFunc
Func CleanPool()
    ; Removes impurities - Blank Spots.
    Local $Track = 0
    For $Track = 0 To (UBound($VariablePool) - 1) Step 1
; To be written.
    Next
EndFunc
;========================
; Additional Functions  =
;========================
Func _Encrypt($String, $Password, $EncryptType = 1, $Level = 2)
    Select
        Case $Level = 0
            Return _StringEncrypt($EncryptType, $String, $Password)
        Case $Level = 1
            If $EncryptType = 0 Then Return _HexToString (_StringEncrypt($EncryptType, $String, $Password))
            Return _StringEncrypt($EncryptType, _StringToHex ($String), $Password)
        Case $Level = 2
            If $EncryptType = 0 Then Return _Chr2Str(_HexToString (_StringEncrypt($EncryptType, $String, $Password)))
            Return _StringEncrypt($EncryptType, _StringToHex (_Str2Chr($String)), $Password)
    EndSelect
EndFunc   ;==>_Encrypt
Func _Str2Chr(Const $String)
    Local $Array = StringSplit($String, "")
    Local $BuffStr = ""
    Local $Str = ""
    Local $Track = 1
    For $Track = 1 to $Array[0] Step 1
        $BuffStr = Asc($Array[$Track])
        $Str = $Str & StringLen($BuffStr) & $BuffStr
    Next
    Return $Str
EndFunc
Func _Chr2Str(Const $String)
    Local $Start = 1
    Local $Str = ""
    Local $StrLenGo
    While $Start <= StringLen($String)
        $StrLenGo = StringRight(StringLeft($String, $Start), 1)
        $Str = $Str & Chr(StringRight(StringLeft($String, $Start + $StrLenGo ) , $StrLenGo))
        $Start = $Start + StringRight(StringLeft($String, $Start), 1) + 1
    WEnd
    Return $Str
EndFunc

Example

#Include 'AutoDat.au3'
; == Example ==
; Creating a value...
AddValue("Name", "Value")
; Calling a value...
MsgBox(0, @error, CallValue("Name"))
; Editing a value...
EditValue("Name", "NewValue")
MsgBox(0, @error, CallValue("Name"))
; Deleting a value...
DeleteValue("Name")
MsgBox(0, @error, CallValue("Name"))

AutoDat is in its infancy - v0.1

Ideas

Updates since AdminDB
v0.1 - ALPHA a - Project Started.
        - Main Functionality
        - Small Security Stuffs
        - Updated Variable Operations

Updates as AutoDat (to be written)
    v0.2 - ALPHA b - A More Robust Thought.
        - Remote Functionality
        - Enhanced Security
        - Compatibility
                - Saving Variable Pool to File
    v0.3 - ALPHA 2 - The Infant Is Cognitive
        - Helpfile and Theory Documentation
        - Increased Functionality Speeds
    v0.4 - BETA - A Toddler Walks abd Talks.
        - Added Languages w/ Translation

Enjoy - hopefully it will help communications projects and such.

~Smith

Edited by AutoIt Smith

Share this post


Link to post
Share on other sites



Although potentially useful. Server side game in autoit? HAHAHA right. Anyways would this not cause everything to execute EXTREMELY slow.

Share this post


Link to post
Share on other sites

Although potentially useful. Server side game in autoit? HAHAHA right. Anyways would this not cause everything to execute EXTREMELY slow.

Actually no. It doesn't take long to fetch the variables and what not.

Server-sided games are a possibility. The language just isn't there yet. This could be useful to store local data like that guy who made PassSecure or whatever it is called.

Share this post


Link to post
Share on other sites

So I decided to plug at the language stuffs.

This is what I used to generate the ini.

#Region Language Call Numbers
#comments-start
0436 Afrikaans
041c Albanian
0401 Arabic_Saudi_Arabia
0801 Arabic_Iraq
0c01 Arabic_Egypt
1001 Arabic_Libya
1401 Arabic_Algeria
1801 Arabic_Morocco
1c01 Arabic_Tunisia
2001 Arabic_Oman
2401 Arabic_Yemen
2801 Arabic_Syria
2c01 Arabic_Jordan
3001 Arabic_Lebanon
3401 Arabic_Kuwait
3801 Arabic_UAE
3c01 Arabic_Bahrain
4001 Arabic_Qatar
042b Armenian
042c Azeri_Latin
082c Azeri_Cyrillic
042d Basque
0423 Belarusian
0402 Bulgarian
0403 Catalan
0404 Chinese_Taiwan
0804 Chinese_PRC
0c04 Chinese_Hong_Kong
1004 Chinese_Singapore
1404 Chinese_Macau
041a Croatian
0405 Czech
0406 Danish
0413 Dutch_Standard
0813 Dutch_Belgian
0409 English_United_States
0809 English_United_Kingdom
0c09 English_Australian
1009 English_Canadian
1409 English_New_Zealand
1809 English_Irish
1c09 English_South_Africa
2009 English_Jamaica
2409 English_Caribbean
2809 English_Belize
2c09 English_Trinidad
3009 English_Zimbabwe
3409 English_Philippines
0425 Estonian
0438 Faeroese
0429 Farsi
040b Finnish
040c French_Standard
080c French_Belgian
0c0c French_Canadian
100c French_Swiss
140c French_Luxembourg
180c French_Monaco
0437 Georgian
0407 German_Standard
0807 German_Swiss
0c07 German_Austrian
1007 German_Luxembourg
1407 German_Liechtenstei
408 Greek
040d Hebrew
0439 Hindi
040e Hungarian
040f Icelandic
0421 Indonesian
0410 Italian_Standard
0810 Italian_Swiss
0411 Japanese
043f Kazakh
0457 Konkani
0412 Korean
0426 Latvian
0427 Lithuanian
042f Macedonian
043e Malay_Malaysia
083e Malay_Brunei_Darussalam
044e Marathi
0414 Norwegian_Bokmal
0814 Norwegian_Nynorsk
0415 Polish
0416 Portuguese_Brazilian
0816 Portuguese_Standard
0418 Romanian
0419 Russian
044f Sanskrit
081a Serbian_Latin
0c1a Serbian_Cyrillic
041b Slovak
0424 Slovenian
040a Spanish_Traditional_Sort
080a Spanish_Mexican
0c0a Spanish_Modern_Sort
100a Spanish_Guatemala
140a Spanish_Costa_Rica
180a Spanish_Panama
1c0a Spanish_Dominican_Republic
200a Spanish_Venezuela
240a Spanish_Colombia
280a Spanish_Peru
2c0a Spanish_Argentina
300a Spanish_Ecuador
340a Spanish_Chile
380a Spanish_Uruguay
3c0a Spanish_Paraguay
400a Spanish_Bolivia
440a Spanish_El_Salvador
480a Spanish_Honduras
4c0a Spanish_Nicaragua
500a Spanish_Puerto_Rico
0441 Swahili
041d Swedish
081d Swedish_Finland
0449 Tamil
0444 Tatar
041e Thai
041f Turkish
0422 Ukrainian
0420 Urdu
0443 Uzbek_Latin
0843 Uzbek_Cyrillic
042a Vietnamese
#comments-end
#EndRegion
$Track = 3
For $Track = 3 To 128 Step 1
    $String = FileReadLine(@ScriptFullPath, $Track)
    $String = StringSplit($String, " ")
    IniWrite("AutoDat.ini", StringReplace($String[2], "_", " "), "LangCode", $String[1])
    IniWrite("AutoDat.ini", "Universal", "LangList", IniRead("AutoDat.ini", "Universal", "LangList", "") & StringReplace($String[2], "_", " ") & "|")
;If $Len >= 0 Then
;   IniWrite($LanguageIni, $String[1], "-1", $Len)
;   For $LineTrack = 0 To $Len Step 1
;       IniWrite($LanguageIni, $String[1], $LineTrack, Trans($String[1], IniRead($LanguageIni, $MainLang, $LineTrack, -1)))
;   Next
;EndIf
Next

Included is a possible but incomplete translation Proof.

This is what it generates

[Universal]
LangList=Afrikaans|Albanian|Arabic Saudi Arabia|Arabic Iraq|Arabic Egypt|Arabic Libya|Arabic Algeria|Arabic Morocco|Arabic Tunisia|Arabic Oman|Arabic Yemen|Arabic Syria|Arabic Jordan|Arabic Lebanon|Arabic Kuwait|Arabic UAE|Arabic Bahrain|Arabic Qatar|Armenian|Azeri Latin|Azeri Cyrillic|Basque|Belarusian|Bulgarian|Catalan|Chinese Taiwan|Chinese PRC|Chinese Hong Kong|Chinese Singapore|Chinese Macau|Croatian|Czech|Danish|Dutch Standard|Dutch Belgian|English United States|English United Kingdom|English Australian|English Canadian|English New Zealand|English Irish|English South Africa|English Jamaica|English Caribbean|English Belize|English Trinidad|English Zimbabwe|English Philippines|Estonian|Faeroese|Farsi|Finnish|French Standard|French Belgian|French Canadian|French Swiss|French Luxembourg|French Monaco|Georgian|German Standard|German Swiss|German Austrian|German Luxembourg|German Liechtenstei|Greek|Hebrew|Hindi|Hungarian|Icelandic|Indonesian|Italian Standard|Italian Swiss|Japanese|Kazakh|Konkani|Korean|Latvian|Lithuanian|Macedonian|Malay Malaysia|Malay Brunei Darussalam|Marathi|Norwegian Bokmal|Norwegian Nynorsk|Polish|Portuguese Brazilian|Portuguese Standard|Romanian|Russian|Sanskrit|Serbian Latin|Serbian Cyrillic|Slovak|Slovenian|Spanish Traditional Sort|Spanish Mexican|Spanish Modern Sort|Spanish Guatemala|Spanish Costa Rica|Spanish Panama|Spanish Dominican Republic|Spanish Venezuela|Spanish Colombia|Spanish Peru|Spanish Argentina|Spanish Ecuador|Spanish Chile|Spanish Uruguay|Spanish Paraguay|Spanish Bolivia|Spanish El Salvador|Spanish Honduras|Spanish Nicaragua|Spanish Puerto Rico|Swahili|Swedish|Swedish Finland|Tamil|Tatar|Thai|Turkish|Ukrainian|Urdu|Uzbek Latin|Uzbek Cyrillic|Vietnamese
[Afrikaans]
LangCode=0436
[Albanian]
LangCode=041c
[Arabic Saudi Arabia]
LangCode=0401
[Arabic Iraq]
LangCode=0801
[Arabic Egypt]
LangCode=0c01
[Arabic Libya]
LangCode=1001
[Arabic Algeria]
LangCode=1401
[Arabic Morocco]
LangCode=1801
[Arabic Tunisia]
LangCode=1c01
[Arabic Oman]
LangCode=2001
[Arabic Yemen]
LangCode=2401
[Arabic Syria]
LangCode=2801
[Arabic Jordan]
LangCode=2c01
[Arabic Lebanon]
LangCode=3001
[Arabic Kuwait]
LangCode=3401
[Arabic UAE]
LangCode=3801
[Arabic Bahrain]
LangCode=3c01
[Arabic Qatar]
LangCode=4001
[Armenian]
LangCode=042b
[Azeri Latin]
LangCode=042c
[Azeri Cyrillic]
LangCode=082c
[Basque]
LangCode=042d
[Belarusian]
LangCode=0423
[Bulgarian]
LangCode=0402
[Catalan]
LangCode=0403
[Chinese Taiwan]
LangCode=0404
[Chinese PRC]
LangCode=0804
[Chinese Hong Kong]
LangCode=0c04
[Chinese Singapore]
LangCode=1004
[Chinese Macau]
LangCode=1404
[Croatian]
LangCode=041a
[Czech]
LangCode=0405
[Danish]
LangCode=0406
[Dutch Standard]
LangCode=0413
[Dutch Belgian]
LangCode=0813
[English United States]
LangCode=0409
[English United Kingdom]
LangCode=0809
[English Australian]
LangCode=0c09
[English Canadian]
LangCode=1009
[English New Zealand]
LangCode=1409
[English Irish]
LangCode=1809
[English South Africa]
LangCode=1c09
[English Jamaica]
LangCode=2009
[English Caribbean]
LangCode=2409
[English Belize]
LangCode=2809
[English Trinidad]
LangCode=2c09
[English Zimbabwe]
LangCode=3009
[English Philippines]
LangCode=3409
[Estonian]
LangCode=0425
[Faeroese]
LangCode=0438
[Farsi]
LangCode=0429
[Finnish]
LangCode=040b
[French Standard]
LangCode=040c
[French Belgian]
LangCode=080c
[French Canadian]
LangCode=0c0c
[French Swiss]
LangCode=100c
[French Luxembourg]
LangCode=140c
[French Monaco]
LangCode=180c
[Georgian]
LangCode=0437
[German Standard]
LangCode=0407
[German Swiss]
LangCode=0807
[German Austrian]
LangCode=0c07
[German Luxembourg]
LangCode=1007
[German Liechtenstei]
LangCode=1407
[Greek]
LangCode=408
[Hebrew]
LangCode=040d
[Hindi]
LangCode=0439
[Hungarian]
LangCode=040e
[Icelandic]
LangCode=040f
[Indonesian]
LangCode=0421
[Italian Standard]
LangCode=0410
[Italian Swiss]
LangCode=0810
[Japanese]
LangCode=0411
[Kazakh]
LangCode=043f
[Konkani]
LangCode=0457
[Korean]
LangCode=0412
[Latvian]
LangCode=0426
[Lithuanian]
LangCode=0427
[Macedonian]
LangCode=042f
[Malay Malaysia]
LangCode=043e
[Malay Brunei Darussalam]
LangCode=083e
[Marathi]
LangCode=044e
[Norwegian Bokmal]
LangCode=0414
[Norwegian Nynorsk]
LangCode=0814
[Polish]
LangCode=0415
[Portuguese Brazilian]
LangCode=0416
[Portuguese Standard]
LangCode=0816
[Romanian]
LangCode=0418
[Russian]
LangCode=0419
[Sanskrit]
LangCode=044f
[Serbian Latin]
LangCode=081a
[Serbian Cyrillic]
LangCode=0c1a
[Slovak]
LangCode=041b
[Slovenian]
LangCode=0424
[Spanish Traditional Sort]
LangCode=040a
[Spanish Mexican]
LangCode=080a
[Spanish Modern Sort]
LangCode=0c0a
[Spanish Guatemala]
LangCode=100a
[Spanish Costa Rica]
LangCode=140a
[Spanish Panama]
LangCode=180a
[Spanish Dominican Republic]
LangCode=1c0a
[Spanish Venezuela]
LangCode=200a
[Spanish Colombia]
LangCode=240a
[Spanish Peru]
LangCode=280a
[Spanish Argentina]
LangCode=2c0a
[Spanish Ecuador]
LangCode=300a
[Spanish Chile]
LangCode=340a
[Spanish Uruguay]
LangCode=380a
[Spanish Paraguay]
LangCode=3c0a
[Spanish Bolivia]
LangCode=400a
[Spanish El Salvador]
LangCode=440a
[Spanish Honduras]
LangCode=480a
[Spanish Nicaragua]
LangCode=4c0a
[Spanish Puerto Rico]
LangCode=500a
[Swahili]
LangCode=0441
[Swedish]
LangCode=041d
[Swedish Finland]
LangCode=081d
[Tamil]
LangCode=0449
[Tatar]
LangCode=0444
[Thai]
LangCode=041e
[Turkish]
LangCode=041f
[Ukrainian]
LangCode=0422
[Urdu]
LangCode=0420
[Uzbek Latin]
LangCode=0443
[Uzbek Cyrillic]
LangCode=0843
[Vietnamese]
LangCode=042a

Here is what I will be using with AutoDat

Func AskLang()
    Local $DefaultLang = IniRead($Ini, "Universal", "DefaultLang", "External Error Code : 1")
    If $DefaultLang = "" Then
        Local $LangGUI = GUICreate("AutoDatabase", 300, 400, Default, Default)
        Local $LangLabel = GUICtrlCreateLabel("Please select the language you wish to operate in:", 10, 10, 280, 20, BitOr($SS_SUNKEN, $SS_CENTER))
        Local $LangListView = GUICtrlCreateList("", 10, 40, 280, 320)
        Local $LangApply = GUICtrlCreateButton("Select", 10, 370, 130, 20)
        Local $LangSave = GUICtrlCreateCheckbox("Make Default Language", 150, 370, 132.5, 20)
        GUICtrlSetData($LangListView,$LangList)
        GUISetState()
        Local $Msg
        While 1
            $Msg = GUIGetMsg()
            If $Msg = $GUI_EVENT_CLOSE Then Exit
            If $Msg = $LangApply Then
                $LangListView = GUICtrlRead($LangListView)
                If GUICtrlRead($LangSave) = $GUI_CHECKED Then IniWrite($Ini, "Universal", "DefaultLang", $LangListView)
                Return $LangListView
            EndIf
            Sleep(0x000000)
        WEnd
    Else
        Return $DefaultLang
    EndIf
EndFunc
Func GrabLine($Multi = "", $LineNumber = @ScriptLineNumber,)
    Return IniRead($Ini, $ServerLang, $LineNumber & $Multi, "External Error Code : 1")
EndFunc

Basically I'm going to add GrabLine() to all my normal texts. It will read the proper language line from Ini and $Multi allows you to have several strings in one line.

PoC

Script
Line 1 : MsgBox(0, GrabLine(), GrabLine("b"))

Ini
[Language]
1=Title
1b=Text

I might expand this system further but at the time being it serves its purpose for any multi-language program.

If you are native to any of these languages and can translate into English well OR know anyone OR know of a program that will translate it properly please let me know because it will help quite a bit in the future when in v0.4 I add the language stuff. -----I'd rather get an authentic translation instead of babelfish or something like that.

~Smith

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0