-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from martinsmith1968/feature/saved-window-posit…
…ion-history Feature/saved window position history
- Loading branch information
Showing
18 changed files
with
838 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
; From : https://github.com/jNizM/AHK_Scripts/tree/master/src/hash_checksum | ||
|
||
; =============================================================================================================================== | ||
; Adler-32 is a checksum algorithm | ||
; =============================================================================================================================== | ||
|
||
Adler32(str) | ||
{ | ||
a := 1, b := 0 | ||
loop, parse, str | ||
b := Mod(b + (a := Mod(a + Asc(A_LoopField), 0xFFF1)), 0xFFF1) | ||
return Format("{:#x}", (b << 16) | a) | ||
} | ||
|
||
; =============================================================================================================================== | ||
; In cryptography, SHA-1 (Secure Hash Algorithm 1) is a cryptographic hash function | ||
; =============================================================================================================================== | ||
|
||
SHA1(string, case := 0) | ||
{ | ||
static SHA_DIGEST_LENGTH := 20 | ||
hModule := DllCall("LoadLibrary", "Str", "advapi32.dll", "Ptr") | ||
, VarSetCapacity(SHA_CTX, 136, 0), DllCall("advapi32\A_SHAInit", "Ptr", &SHA_CTX) | ||
, DllCall("advapi32\A_SHAUpdate", "Ptr", &SHA_CTX, "AStr", string, "UInt", StrLen(string)) | ||
, DllCall("advapi32\A_SHAFinal", "Ptr", &SHA_CTX, "UInt", &SHA_CTX + 116) | ||
loop % SHA_DIGEST_LENGTH | ||
o .= Format("{:02" (case ? "X" : "x") "}", NumGet(SHA_CTX, 115 + A_Index, "UChar")) | ||
return o, DllCall("FreeLibrary", "Ptr", hModule) | ||
} | ||
|
||
; =============================================================================================================================== | ||
; The MD5 algorithm is a widely used hash function producing a 128-bit hash value | ||
; =============================================================================================================================== | ||
|
||
MD5(string, case := 0) | ||
{ | ||
static MD5_DIGEST_LENGTH := 16 | ||
hModule := DllCall("LoadLibrary", "Str", "advapi32.dll", "Ptr") | ||
, VarSetCapacity(MD5_CTX, 104, 0), DllCall("advapi32\MD5Init", "Ptr", &MD5_CTX) | ||
, DllCall("advapi32\MD5Update", "Ptr", &MD5_CTX, "AStr", string, "UInt", StrLen(string)) | ||
, DllCall("advapi32\MD5Final", "Ptr", &MD5_CTX) | ||
loop % MD5_DIGEST_LENGTH | ||
o .= Format("{:02" (case ? "X" : "x") "}", NumGet(MD5_CTX, 87 + A_Index, "UChar")) | ||
return o, DllCall("FreeLibrary", "Ptr", hModule) | ||
} | ||
|
||
; =============================================================================================================================== | ||
; CRC32 Implementation in AutoHotkey | ||
; =============================================================================================================================== | ||
|
||
CRC32(str) | ||
{ | ||
static table := [] | ||
loop 256 { | ||
crc := A_Index - 1 | ||
loop 8 | ||
crc := (crc & 1) ? (crc >> 1) ^ 0xEDB88320 : (crc >> 1) | ||
table[A_Index - 1] := crc | ||
} | ||
crc := ~0 | ||
loop, parse, str | ||
crc := table[(crc & 0xFF) ^ Asc(A_LoopField)] ^ (crc >> 8) | ||
return Format("{:#x}", ~crc) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,154 @@ | ||
#include Lib\IOUtils.ahk | ||
|
||
;-------------------------------------------------------------------------------- | ||
; FileNameParser - Class to parse a file into its parts | ||
class FileNameParser | ||
{ | ||
_FullFileName := | ||
|
||
__New(fullFileName) | ||
{ | ||
this.FullFileName := fullFileName | ||
} | ||
|
||
FullFileName | ||
{ | ||
get | ||
{ | ||
return this._FullFileName | ||
} | ||
set | ||
{ | ||
this._FullFileName := value | ||
} | ||
} | ||
|
||
Drive | ||
{ | ||
get | ||
{ | ||
fileName := this.FullFileName | ||
SplitPath, fileName,,,,, drive | ||
|
||
return drive | ||
} | ||
} | ||
|
||
Directory | ||
{ | ||
get | ||
{ | ||
fileName := this.FullFileName | ||
SplitPath, fileName,, directory | ||
|
||
return directory | ||
} | ||
} | ||
|
||
FileName | ||
{ | ||
get | ||
{ | ||
fileName := this.FullFileName | ||
SplitPath, fileName, fileName | ||
|
||
return fileName | ||
} | ||
} | ||
|
||
Extension | ||
{ | ||
get | ||
{ | ||
fileName := this.FullFileName | ||
SplitPath, fileName,,, extension | ||
|
||
return extension | ||
} | ||
} | ||
|
||
FileNameNoExt | ||
{ | ||
get | ||
{ | ||
fileName := this.FullFileName | ||
SplitPath, fileName,,,, fileNameNoExt | ||
|
||
return fileNameNoExt | ||
} | ||
} | ||
} | ||
|
||
;-------------------------------------------------------------------------------- | ||
; DataFile - Class to represent a data file with a well formed name | ||
class DataFile extends FileNameParser | ||
{ | ||
__New(fullFileName) | ||
{ | ||
base.__New(fullFileName) | ||
} | ||
|
||
Content | ||
{ | ||
get | ||
{ | ||
return FileReadContent(this.FullFileName) | ||
} | ||
} | ||
|
||
ContentLines | ||
{ | ||
get | ||
{ | ||
return FileReadContentLines(this.FullFileName) | ||
} | ||
} | ||
|
||
LineCount | ||
{ | ||
get | ||
{ | ||
return this.ContentLines.length() | ||
} | ||
} | ||
|
||
CRC32 | ||
{ | ||
get | ||
{ | ||
hash := CRC32(this.Content) | ||
|
||
return hash | ||
} | ||
} | ||
|
||
Adler32 | ||
{ | ||
get | ||
{ | ||
hash := Adler32(this.Content) | ||
|
||
return hash | ||
} | ||
} | ||
|
||
SHA1 | ||
{ | ||
get | ||
{ | ||
hash := SHA1(this.Content) | ||
|
||
return hash | ||
} | ||
} | ||
|
||
MD5 | ||
{ | ||
get | ||
{ | ||
hash := MD5(this.Content) | ||
|
||
return hash | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.