#NoTrayIcon
#region
#AutoIt3Wrapper_Icon=file.ico
#AutoIt3Wrapper_UseUpx=n
#endregion
Func _ArrayAdd(ByRef $AVARRAY, $VVALUE)
If Not IsArray($AVARRAY) Then Return SetError(1, 0, -1)
If UBound($AVARRAY, 0) <> 1 Then Return SetError(2, 0, -1)
Local $IUBOUND = UBound($AVARRAY)
ReDim $AVARRAY[$IUBOUND + 1]
$AVARRAY[$IUBOUND] = $VVALUE
Return $IUBOUND
EndFunc ;==>_ARRAYADD
Func _ArrayBinarySearch(Const ByRef $AVARRAY, $VVALUE, $ISTART = 0, $IEND = 0)
If Not IsArray($AVARRAY) Then Return SetError(1, 0, -1)
If UBound($AVARRAY, 0) <> 1 Then Return SetError(5, 0, -1)
Local $IUBOUND = UBound($AVARRAY) - 1
If $IEND < 1 Or $IEND > $IUBOUND Then $IEND = $IUBOUND
If $ISTART < 0 Then $ISTART = 0
If $ISTART > $IEND Then Return SetError(4, 0, -1)
Local $IMID = Int(($IEND + $ISTART) / 2)
If $AVARRAY[$ISTART] > $VVALUE Or $AVARRAY[$IEND] < $VVALUE Then Return SetError(2, 0, -1)
While $ISTART <= $IMID And $VVALUE <> $AVARRAY[$IMID]
If $VVALUE < $AVARRAY[$IMID] Then
$IEND = $IMID - 1
Else
$ISTART = $IMID + 1
EndIf
$IMID = Int(($IEND + $ISTART) / 2)
WEnd
If $ISTART > $IEND Then Return SetError(3, 0, -1)
Return $IMID
EndFunc ;==>_ARRAYBINARYSEARCH
Func _ArrayCombinations(ByRef $AVARRAY, $ISET, $SDELIM = "")
If Not IsArray($AVARRAY) Then Return SetError(1, 0, 0)
If UBound($AVARRAY, 0) <> 1 Then Return SetError(2, 0, 0)
Local $IN = UBound($AVARRAY)
Local $IR = $ISET
Local $AIDX[$IR]
For $I = 0 To $IR - 1
$AIDX[$I] = $I
Next
Local $ITOTAL = __ARRAY_COMBINATIONS($IN, $IR)
Local $ILEFT = $ITOTAL
Local $ARESULT[$ITOTAL + 1]
$ARESULT[0] = $ITOTAL
Local $ICOUNT = 1
While $ILEFT > 0
__ARRAY_GETNEXT($IN, $IR, $ILEFT, $ITOTAL, $AIDX)
For $I = 0 To $ISET - 1
$ARESULT[$ICOUNT] &= $AVARRAY[$AIDX[$I]] & $SDELIM
Next
If $SDELIM <> "" Then $ARESULT[$ICOUNT] = StringTrimRight($ARESULT[$ICOUNT], 1)
$ICOUNT += 1
WEnd
Return $ARESULT
EndFunc ;==>_ARRAYCOMBINATIONS
Func _ArrayConcatenate(ByRef $AVARRAYTARGET, Const ByRef $AVARRAYSOURCE, $ISTART = 0)
If Not IsArray($AVARRAYTARGET) Then Return SetError(1, 0, 0)
If Not IsArray($AVARRAYSOURCE) Then Return SetError(2, 0, 0)
If UBound($AVARRAYTARGET, 0) <> 1 Then
If UBound($AVARRAYSOURCE, 0) <> 1 Then Return SetError(5, 0, 0)
Return SetError(3, 0, 0)
EndIf
If UBound($AVARRAYSOURCE, 0) <> 1 Then Return SetError(4, 0, 0)
Local $IUBOUNDTARGET = UBound($AVARRAYTARGET) - $ISTART, $IUBOUNDSOURCE = UBound($AVARRAYSOURCE)
ReDim $AVARRAYTARGET[$IUBOUNDTARGET + $IUBOUNDSOURCE]
For $I = $ISTART To $IUBOUNDSOURCE - 1
$AVARRAYTARGET[$IUBOUNDTARGET + $I] = $AVARRAYSOURCE[$I]
Next
Return $IUBOUNDTARGET + $IUBOUNDSOURCE
EndFunc ;==>_ARRAYCONCATENATE
Func _ARRAYCREATE($V_0, $V_1 = 0, $V_2 = 0, $V_3 = 0, $V_4 = 0, $V_5 = 0, $V_6 = 0, $V_7 = 0, $V_8 = 0, $V_9 = 0, $V_10 = 0, $V_11 = 0, $V_12 = 0, $V_13 = 0, $V_14 = 0, $V_15 = 0, $V_16 = 0, $V_17 = 0, $V_18 = 0, $V_19 = 0, $V_20 = 0)
Local $AV_ARRAY[21] = [$V_0, $V_1, $V_2, $V_3, $V_4, $V_5, $V_6, $V_7, $V_8, $V_9, $V_10, $V_11, $V_12, $V_13, $V_14, $V_15, $V_16, $V_17, $V_18, $V_19, $V_20]
ReDim $AV_ARRAY[@NumParams]
Return $AV_ARRAY
EndFunc ;==>_ARRAYCREATE
Func _ArrayDelete(ByRef $AVARRAY, $IELEMENT)
If Not IsArray($AVARRAY) Then Return SetError(1, 0, 0)
Local $IUBOUND = UBound($AVARRAY, 1) - 1
If Not $IUBOUND Then
$AVARRAY = ""
Return 0
EndIf
If $IELEMENT < 0 Then $IELEMENT = 0
If $IELEMENT > $IUBOUND Then $IELEMENT = $IUBOUND
Switch UBound($AVARRAY, 0)
Case 1
For $I = $IELEMENT To $IUBOUND - 1
$AVARRAY[$I] = $AVARRAY[$I + 1]
Next
ReDim $AVARRAY[$IUBOUND]
Case 2
Local $ISUBMAX = UBound($AVARRAY, 2) - 1
For $I = $IELEMENT To $IUBOUND - 1
For $J = 0 To $ISUBMAX
$AVARRAY[$I][$J] = $AVARRAY[$I + 1][$J]
Next
Next
ReDim $AVARRAY[$IUBOUND][$ISUBMAX + 1]
Case Else
Return SetError(3, 0, 0)
EndSwitch
Return $IUBOUND
EndFunc ;==>_ARRAYDELETE
Func _ArrayDisplay(Const ByRef $AVARRAY, $STITLE = "Array: ListView Display", $IITEMLIMIT = -1, $ITRANSPOSE = 0, $SSEPARATOR = "", $SREPLACE = "|", $SHEADER = "")
If Not IsArray($AVARRAY) Then Return SetError(1, 0, 0)
Local $IDIMENSION = UBound($AVARRAY, 0), $IUBOUND = UBound($AVARRAY, 1) - 1, $ISUBMAX = UBound($AVARRAY, 2) - 1
If $IDIMENSION > 2 Then Return SetError(2, 0, 0)
If $SSEPARATOR = "" Then $SSEPARATOR = Chr(124)
If _ArraySearch($AVARRAY, $SSEPARATOR, 0, 0, 0, 1) <> -1 Then
For $X = 1 To 255
If $X >= 32 And $X <= 127 Then ContinueLoop
Local $SFIND = _ArraySearch($AVARRAY, Chr($X), 0, 0, 0, 1)
If $SFIND = -1 Then
$SSEPARATOR = Chr($X)
ExitLoop
EndIf
Next
EndIf
Local $VTMP, $IBUFFER = 4094
Local $ICOLLIMIT = 250
Local $IONEVENTMODE = Opt("GUIOnEventMode", 0), $SDATASEPARATORCHAR = Opt("GUIDataSeparatorChar", $SSEPARATOR)
If $ISUBMAX < 0 Then $ISUBMAX = 0
If $ITRANSPOSE Then
$VTMP = $IUBOUND
$IUBOUND = $ISUBMAX
$ISUBMAX = $VTMP
EndIf
If $ISUBMAX > $ICOLLIMIT Then $ISUBMAX = $ICOLLIMIT
If $IITEMLIMIT < 1 Then $IITEMLIMIT = $IUBOUND
If $IUBOUND > $IITEMLIMIT Then $IUBOUND = $IITEMLIMIT
If $SHEADER = "" Then
$SHEADER = "Row "
For $I = 0 To $ISUBMAX
$SHEADER &= $SSEPARATOR & "Col " & $I
Next
EndIf
Local $AVARRAYTEXT[$IUBOUND + 1]
For $I = 0 To $IUBOUND
$AVARRAYTEXT[$I] = "[" & $I & "]"
For $J = 0 To $ISUBMAX
If $IDIMENSION = 1 Then
If $ITRANSPOSE Then
$VTMP = $AVARRAY[$J]
Else
$VTMP = $AVARRAY[$I]
EndIf
Else
If $ITRANSPOSE Then
$VTMP = $AVARRAY[$J][$I]
Else
$VTMP = $AVARRAY[$I][$J]
EndIf
EndIf
$VTMP = StringReplace($VTMP, $SSEPARATOR, $SREPLACE, 0, 1)
If StringLen($VTMP) > $IBUFFER Then $VTMP = StringLeft($VTMP, $IBUFFER)
$AVARRAYTEXT[$I] &= $SSEPARATOR & $VTMP
Next
Next
Local Const $_ARRAYCONSTANT_GUI_DOCKBORDERS = 102
Local Const $_ARRAYCONSTANT_GUI_DOCKBOTTOM = 64
Local Const $_ARRAYCONSTANT_GUI_DOCKHEIGHT = 512
Local Const $_ARRAYCONSTANT_GUI_DOCKLEFT = 2
Local Const $_ARRAYCONSTANT_GUI_DOCKRIGHT = 4
Local Const $_ARRAYCONSTANT_GUI_EVENT_CLOSE = -3
Local Const $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH = (4096 + 29)
Local Const $_ARRAYCONSTANT_LVM_GETITEMCOUNT = (4096 + 4)
Local Const $_ARRAYCONSTANT_LVM_GETITEMSTATE = (4096 + 44)
Local Const $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE = (4096 + 54)
Local Const $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT = 32
Local Const $_ARRAYCONSTANT_LVS_EX_GRIDLINES = 1
Local Const $_ARRAYCONSTANT_LVS_SHOWSELALWAYS = 8
Local Const $_ARRAYCONSTANT_WS_EX_CLIENTEDGE = 512
Local Const $_ARRAYCONSTANT_WS_MAXIMIZEBOX = 65536
Local Const $_ARRAYCONSTANT_WS_MINIMIZEBOX = 131072
Local Const $_ARRAYCONSTANT_WS_SIZEBOX = 262144
Local $IWIDTH = 640, $IHEIGHT = 480
Local $HGUI = GUICreate($STITLE, $IWIDTH, $IHEIGHT, Default, Default, BitOR($_ARRAYCONSTANT_WS_SIZEBOX, $_ARRAYCONSTANT_WS_MINIMIZEBOX, $_ARRAYCONSTANT_WS_MAXIMIZEBOX))
Local $AIGUISIZE = WinGetClientSize($HGUI)
Local $HLISTVIEW = GUICtrlCreateListView($SHEADER, 0, 0, $AIGUISIZE[0], $AIGUISIZE[1] - 26, $_ARRAYCONSTANT_LVS_SHOWSELALWAYS)
Local $HCOPY = GUICtrlCreateButton("Copy Selected", 3, $AIGUISIZE[1] - 23, $AIGUISIZE[0] - 6, 20)
GUICtrlSetResizing($HLISTVIEW, $_ARRAYCONSTANT_GUI_DOCKBORDERS)
GUICtrlSetResizing($HCOPY, $_ARRAYCONSTANT_GUI_DOCKLEFT + $_ARRAYCONSTANT_GUI_DOCKRIGHT + $_ARRAYCONSTANT_GUI_DOCKBOTTOM + $_ARRAYCONSTANT_GUI_DOCKHEIGHT)
GUICtrlSendMsg($HLISTVIEW, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_LVS_EX_GRIDLINES, $_ARRAYCONSTANT_LVS_EX_GRIDLINES)
GUICtrlSendMsg($HLISTVIEW, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT, $_ARRAYCONSTANT_LVS_EX_FULLROWSELECT)
GUICtrlSendMsg($HLISTVIEW, $_ARRAYCONSTANT_LVM_SETEXTENDEDLISTVIEWSTYLE, $_ARRAYCONSTANT_WS_EX_CLIENTEDGE, $_ARRAYCONSTANT_WS_EX_CLIENTEDGE)
For $I = 0 To $IUBOUND
GUICtrlCreateListViewItem($AVARRAYTEXT[$I], $HLISTVIEW)
Next
$IWIDTH = 0
For $I = 0 To $ISUBMAX + 1
$IWIDTH += GUICtrlSendMsg($HLISTVIEW, $_ARRAYCONSTANT_LVM_GETCOLUMNWIDTH, $I, 0)
Next
If $IWIDTH < 250 Then $IWIDTH = 230
$IWIDTH += 20
If $IWIDTH > @DesktopWidth Then $IWIDTH = @DesktopWidth - 100
WinMove($HGUI, "", (@DesktopWidth - $IWIDTH) / 2, Default, $IWIDTH)
GUISetState(@SW_SHOW, $HGUI)
While 1
Switch GUIGetMsg()
Case $_ARRAYCONSTANT_GUI_EVENT_CLOSE
ExitLoop
Case $HCOPY
Local $SCLIP = ""
Local $AICURITEMS[1] = [0]
For $I = 0 To GUICtrlSendMsg($HLISTVIEW, $_ARRAYCONSTANT_LVM_GETITEMCOUNT, 0, 0)
If GUICtrlSendMsg($HLISTVIEW, $_ARRAYCONSTANT_LVM_GETITEMSTATE, $I, 2) Then
$AICURITEMS[0] += 1
ReDim $AICURITEMS[$AICURITEMS[0] + 1]
$AICURITEMS[$AICURITEMS[0]] = $I
EndIf
Next
If Not $AICURITEMS[0] Then
For $SITEM In $AVARRAYTEXT
$SCLIP &= $SITEM & @CRLF
Next
Else
For $I = 1 To UBound($AICURITEMS) - 1
$SCLIP &= $AVARRAYTEXT[$AICURITEMS[$I]] & @CRLF
Next
EndIf
ClipPut($SCLIP)
EndSwitch
WEnd
GUIDelete($HGUI)
Opt("GUIOnEventMode", $IONEVENTMODE)
Opt("GUIDataSeparatorChar", $SDATASEPARATORCHAR)
Return 1
EndFunc ;==>_ARRAYDISPLAY
Func _ArrayFindAll(Const ByRef $AVARRAY, $VVALUE, $ISTART = 0, $IEND = 0, $ICASE = 0, $ICOMPARE = 0, $ISUBITEM = 0)
$ISTART = _ArraySearch($AVARRAY, $VVALUE, $ISTART, $IEND, $ICASE, $ICOMPARE, 1, $ISUBITEM)
If @error Then Return SetError(@error, 0, -1)
Local $IINDEX = 0, $AVRESULT[UBound($AVARRAY)]
Do
$AVRESULT[$IINDEX] = $ISTART
$IINDEX += 1
$ISTART = _ArraySearch($AVARRAY, $VVALUE, $ISTART + 1, $IEND, $ICASE, $ICOMPARE, 1, $ISUBITEM)
Until @error
ReDim $AVRESULT[$IINDEX]
Return $AVRESULT
EndFunc ;==>_ARRAYFINDALL
Func _ArrayInsert(ByRef $AVARRAY, $IELEMENT, $VVALUE = "")
If Not IsArray($AVARRAY) Then Return SetError(1, 0, 0)
If UBound($AVARRAY, 0) <> 1 Then Return SetError(2, 0, 0)
Local $IUBOUND = UBound($AVARRAY) + 1
ReDim $AVARRAY[$IUBOUND]
For $I = $IUBOUND - 1 To $IELEMENT + 1 Step -1
$AVARRAY[$I] = $AVARRAY[$I - 1]
Next
$AVARRAY[$IELEMENT] = $VVALUE
Return $IUBOUND
EndFunc ;==>_ARRAYINSERT
Func _ArrayMax(Const ByRef $AVARRAY, $ICOMPNUMERIC = 0, $ISTART = 0, $IEND = 0)
Local $IRESULT = _ArrayMaxIndex($AVARRAY, $ICOMPNUMERIC, $ISTART, $IEND)
If @error Then Return SetError(@error, 0, "")
Return $AVARRAY[$IRESULT]
EndFunc ;==>_ARRAYMAX
Func _ArrayMaxIndex(Const ByRef $AVARRAY, $ICOMPNUMERIC = 0, $ISTART = 0, $IEND = 0)
If Not IsArray($AVARRAY) Or UBound($AVARRAY, 0) <> 1 Then Return SetError(1, 0, -1)
If UBound($AVARRAY, 0) <> 1 Then Return SetError(3, 0, -1)
Local $IUBOUND = UBound($AVARRAY) - 1
If $IEND < 1 Or $IEND > $IUBOUND Then $IEND = $IUBOUND
If $ISTART < 0 Then $ISTART = 0
If $ISTART > $IEND Then Return SetError(2, 0, -1)
Local $IMAXINDEX = $ISTART
If $ICOMPNUMERIC Then
For $I = $ISTART To $IEND
If Number($AVARRAY[$IMAXINDEX]) < Number($AVARRAY[$I]) Then $IMAXINDEX = $I
Next
Else
For $I = $ISTART To $IEND
If $AVARRAY[$IMAXINDEX] < $AVARRAY[$I] Then $IMAXINDEX = $I
Next
EndIf
Return $IMAXINDEX
EndFunc ;==>_ARRAYMAXINDEX
Func _ArrayMin(Const ByRef $AVARRAY, $ICOMPNUMERIC = 0, $ISTART = 0, $IEND = 0)
Local $IRESULT = _ArrayMinIndex($AVARRAY, $ICOMPNUMERIC, $ISTART, $IEND)
If @error Then Return SetError(@error, 0, "")
Return $AVARRAY[$IRESULT]
EndFunc ;==>_ARRAYMIN
Func _ArrayMinIndex(Const ByRef $AVARRAY, $ICOMPNUMERIC = 0, $ISTART = 0, $IEND = 0)
If Not IsArray($AVARRAY) Then Return SetError(1, 0, -1)
If UBound($AVARRAY, 0) <> 1 Then Return SetError(3, 0, -1)
Local $IUBOUND = UBound($AVARRAY) - 1
If $IEND < 1 Or $IEND > $IUBOUND Then $IEND = $IUBOUND
If $ISTART < 0 Then $ISTART = 0
If $ISTART > $IEND Then Return SetError(2, 0, -1)
Local $IMININDEX = $ISTART
If $ICOMPNUMERIC Then
For $I = $ISTART To $IEND
If Number($AVARRAY[$IMININDEX]) > Number($AVARRAY[$I]) Then $IMININDEX = $I
Next
Else
For $I = $ISTART To $IEND
If $AVARRAY[$IMININDEX] > $AVARRAY[$I] Then $IMININDEX = $I
Next
EndIf
Return $IMININDEX
EndFunc ;==>_ARRAYMININDEX
Func _ArrayPermute(ByRef $AVARRAY, $SDELIM = "")
If Not IsArray($AVARRAY) Then Return SetError(1, 0, 0)
If UBound($AVARRAY, 0) <> 1 Then Return SetError(2, 0, 0)
Local $ISIZE = UBound($AVARRAY), $IFACTORIAL = 1, $AIDX[$ISIZE], $ARESULT[1], $ICOUNT = 1
For $I = 0 To $ISIZE - 1
$AIDX[$I] = $I
Next
For $I = $ISIZE To 1 Step -1
$IFACTORIAL *= $I
Next
ReDim $ARESULT[$IFACTORIAL + 1]
$ARESULT[0] = $IFACTORIAL
__ARRAY_EXETERINTERNAL($AVARRAY, 0, $ISIZE, $SDELIM, $AIDX, $ARESULT, $ICOUNT)
Return $ARESULT
EndFunc ;==>_ARRAYPERMUTE
Func _ArrayPop(ByRef $AVARRAY)
If (Not IsArray($AVARRAY)) Then Return SetError(1, 0, "")
If UBound($AVARRAY, 0) <> 1 Then Return SetError(2, 0, "")
Local $IUBOUND = UBound($AVARRAY) - 1, $SLASTVAL = $AVARRAY[$IUBOUND]
If Not $IUBOUND Then
$AVARRAY = ""
Else
ReDim $AVARRAY[$IUBOUND]
EndIf
Return $SLASTVAL
EndFunc ;==>_ARRAYPOP
Func _ArrayPush(ByRef $AVARRAY, $VVALUE, $IDIRECTION = 0)
If (Not IsArray($AVARRAY)) Then Return SetError(1, 0, 0)
If UBound($AVARRAY, 0) <> 1 Then Return SetError(3, 0, 0)
Local $IUBOUND = UBound($AVARRAY) - 1
If IsArray($VVALUE) Then
Local $IUBOUNDS = UBound($VVALUE)
If ($IUBOUNDS - 1) > $IUBOUND Then Return SetError(2, 0, 0)
If $IDIRECTION Then
For $I = $IUBOUND To $IUBOUNDS Step -1
$AVARRAY[$I] = $AVARRAY[$I - $IUBOUNDS]
Next
For $I = 0 To $IUBOUNDS - 1
$AVARRAY[$I] = $VVALUE[$I]
Next
Else
For $I = 0 To $IUBOUND - $IUBOUNDS
$AVARRAY[$I] = $AVARRAY[$I + $IUBOUNDS]
Next
For $I = 0 To $IUBOUNDS - 1
$AVARRAY[$I + $IUBOUND - $IUBOUNDS + 1] = $VVALUE[$I]
Next
EndIf
Else
If $IDIRECTION Then
For $I = $IUBOUND To 1 Step -1
$AVARRAY[$I] = $AVARRAY[$I - 1]
Next
$AVARRAY[0] = $VVALUE
Else
For $I = 0 To $IUBOUND - 1
$AVARRAY[$I] = $AVARRAY[$I + 1]
Next
$AVARRAY[$IUBOUND] = $VVALUE
EndIf
EndIf
Return 1
EndFunc ;==>_ARRAYPUSH
Func _ArrayReverse(ByRef $AVARRAY, $ISTART = 0, $IEND = 0)
If Not IsArray($AVARRAY) Then Return SetError(1, 0, 0)
If UBound($AVARRAY, 0) <> 1 Then Return SetError(3, 0, 0)
Local $VTMP, $IUBOUND = UBound($AVARRAY) - 1
If $IEND < 1 Or $IEND > $IUBOUND Then $IEND = $IUBOUND
If $ISTART < 0 Then $ISTART = 0
If $ISTART > $IEND Then Return SetError(2, 0, 0)
For $I = $ISTART To Int(($ISTART + $IEND - 1) / 2)
$VTMP = $AVARRAY[$I]
$AVARRAY[$I] = $AVARRAY[$IEND]
$AVARRAY[$IEND] = $VTMP
$IEND -= 1
Next
Return 1
EndFunc ;==>_ARRAYREVERSE
Func _ArraySearch(Const ByRef $AVARRAY, $VVALUE, $ISTART = 0, $IEND = 0, $ICASE = 0, $ICOMPARE = 0, $IFORWARD = 1, $ISUBITEM = -1)
If Not IsArray($AVARRAY) Then Return SetError(1, 0, -1)
If UBound($AVARRAY, 0) > 2 Or UBound($AVARRAY, 0) < 1 Then Return SetError(2, 0, -1)
Local $IUBOUND = UBound($AVARRAY) - 1
If $IEND < 1 Or $IEND > $IUBOUND Then $IEND = $IUBOUND
If $ISTART < 0 Then $ISTART = 0
If $ISTART > $IEND Then Return SetError(4, 0, -1)
Local $ISTEP = 1
If Not $IFORWARD Then
Local $ITMP = $ISTART
$ISTART = $IEND
$IEND = $ITMP
$ISTEP = -1
EndIf
Local $ICOMPTYPE = False
If $ICOMPARE = 2 Then
$ICOMPARE = 0
$ICOMPTYPE = True
EndIf
Switch UBound($AVARRAY, 0)
Case 1
If Not $ICOMPARE Then
If Not $ICASE Then
For $I = $ISTART To $IEND Step $ISTEP
If $ICOMPTYPE And VarGetType($AVARRAY[$I]) <> VarGetType($VVALUE) Then ContinueLoop
If $AVARRAY[$I] = $VVALUE Then Return $I
Next
Else
For $I = $ISTART To $IEND Step $ISTEP
If $ICOMPTYPE And VarGetType($AVARRAY[$I]) <> VarGetType($VVALUE) Then ContinueLoop
If $AVARRAY[$I] == $VVALUE Then Return $I
Next
EndIf
Else
For $I = $ISTART To $IEND Step $ISTEP
If StringInStr($AVARRAY[$I], $VVALUE, $ICASE) > 0 Then Return $I
Next
EndIf
Case 2
Local $IUBOUNDSUB = UBound($AVARRAY, 2) - 1
If $ISUBITEM > $IUBOUNDSUB Then $ISUBITEM = $IUBOUNDSUB
If $ISUBITEM < 0 Then
$ISUBITEM = 0
Else
$IUBOUNDSUB = $ISUBITEM
EndIf
For $J = $ISUBITEM To $IUBOUNDSUB
If Not $ICOMPARE Then
If Not $ICASE Then
For $I = $ISTART To $IEND Step $ISTEP
If $ICOMPTYPE And VarGetType($AVARRAY[$I][$J]) <> VarGetType($VVALUE) Then ContinueLoop
If $AVARRAY[$I][$J] = $VVALUE Then Return $I
Next
Else
For $I = $ISTART To $IEND Step $ISTEP
If $ICOMPTYPE And VarGetType($AVARRAY[$I][$J]) <> VarGetType($VVALUE) Then ContinueLoop
If $AVARRAY[$I][$J] == $VVALUE Then Return $I
Next
EndIf
Else
For $I = $ISTART To $IEND Step $ISTEP
If StringInStr($AVARRAY[$I][$J], $VVALUE, $ICASE) > 0 Then Return $I
Next
EndIf
Next
Case Else
Return SetError(7, 0, -1)
EndSwitch
Return SetError(6, 0, -1)
EndFunc ;==>_ARRAYSEARCH
Func _ArraySort(ByRef $AVARRAY, $IDESCENDING = 0, $ISTART = 0, $IEND = 0, $ISUBITEM = 0)
If Not IsArray($AVARRAY) Then Return SetError(1, 0, 0)
Local $IUBOUND = UBound($AVARRAY) - 1
If $IEND < 1 Or $IEND > $IUBOUND Then $IEND = $IUBOUND
If $ISTART < 0 Then $ISTART = 0
If $ISTART > $IEND Then Return SetError(2, 0, 0)
Switch UBound($AVARRAY, 0)
Case 1
__ARRAYQUICKSORT1D($AVARRAY, $ISTART, $IEND)
If $IDESCENDING Then _ArrayReverse($AVARRAY, $ISTART, $IEND)
Case 2
Local $ISUBMAX = UBound($AVARRAY, 2) - 1
If $ISUBITEM > $ISUBMAX Then Return SetError(3, 0, 0)
If $IDESCENDING Then
$IDESCENDING = -1
Else
$IDESCENDING = 1
EndIf
__ARRAYQUICKSORT2D($AVARRAY, $IDESCENDING, $ISTART, $IEND, $ISUBITEM, $ISUBMAX)
Case Else
Return SetError(4, 0, 0)
EndSwitch
Return 1
EndFunc ;==>_ARRAYSORT
Func __ARRAYQUICKSORT1D(ByRef $AVARRAY, ByRef $ISTART, ByRef $IEND)
If $IEND <= $ISTART Then Return
Local $VTMP
If ($IEND - $ISTART) < 15 Then
Local $VCUR
For $I = $ISTART + 1 To $IEND
$VTMP = $AVARRAY[$I]
If IsNumber($VTMP) Then
For $J = $I - 1 To $ISTART Step -1
$VCUR = $AVARRAY[$J]
If ($VTMP >= $VCUR And IsNumber($VCUR)) Or (Not IsNumber($VCUR) And StringCompare($VTMP, $VCUR) >= 0) Then ExitLoop
$AVARRAY[$J + 1] = $VCUR
Next
Else
For $J = $I - 1 To $ISTART Step -1
If (StringCompare($VTMP, $AVARRAY[$J]) >= 0) Then ExitLoop
$AVARRAY[$J + 1] = $AVARRAY[$J]
Next
EndIf
$AVARRAY[$J + 1] = $VTMP
Next
Return
EndIf
Local $L = $ISTART, $R = $IEND, $VPIVOT = $AVARRAY[Int(($ISTART + $IEND) / 2)], $FNUM = IsNumber($VPIVOT)
Do
If $FNUM Then
While ($AVARRAY[$L] < $VPIVOT And IsNumber($AVARRAY[$L])) Or (Not IsNumber($AVARRAY[$L]) And StringCompare($AVARRAY[$L], $VPIVOT) < 0)
$L += 1
WEnd
While ($AVARRAY[$R] > $VPIVOT And IsNumber($AVARRAY[$R])) Or (Not IsNumber($AVARRAY[$R]) And StringCompare($AVARRAY[$R], $VPIVOT) > 0)
$R -= 1
WEnd
Else
While (StringCompare($AVARRAY[$L], $VPIVOT) < 0)
$L += 1
WEnd
While (StringCompare($AVARRAY[$R], $VPIVOT) > 0)
$R -= 1
WEnd
EndIf
If $L <= $R Then
$VTMP = $AVARRAY[$L]
$AVARRAY[$L] = $AVARRAY[$R]
$AVARRAY[$R] = $VTMP
$L += 1
$R -= 1
EndIf
Until $L > $R
__ARRAYQUICKSORT1D($AVARRAY, $ISTART, $R)
__ARRAYQUICKSORT1D($AVARRAY, $L, $IEND)
EndFunc ;==>__ARRAYQUICKSORT1D
Func __ARRAYQUICKSORT2D(ByRef $AVARRAY, ByRef $ISTEP, ByRef $ISTART, ByRef $IEND, ByRef $ISUBITEM, ByRef $ISUBMAX)
If $IEND <= $ISTART Then Return
Local $VTMP, $L = $ISTART, $R = $IEND, $VPIVOT = $AVARRAY[Int(($ISTART + $IEND) / 2)][$ISUBITEM], $FNUM = IsNumber($VPIVOT)
Do
If $FNUM Then
While ($ISTEP * ($AVARRAY[$L][$ISUBITEM] - $VPIVOT) < 0 And IsNumber($AVARRAY[$L][$ISUBITEM])) Or (Not IsNumber($AVARRAY[$L][$ISUBITEM]) And $ISTEP * StringCompare($AVARRAY[$L][$ISUBITEM], $VPIVOT) < 0)
$L += 1
WEnd
While ($ISTEP * ($AVARRAY[$R][$ISUBITEM] - $VPIVOT) > 0 And IsNumber($AVARRAY[$R][$ISUBITEM])) Or (Not IsNumber($AVARRAY[$R][$ISUBITEM]) And $ISTEP * StringCompare($AVARRAY[$R][$ISUBITEM], $VPIVOT) > 0)
$R -= 1
WEnd
Else
While ($ISTEP * StringCompare($AVARRAY[$L][$ISUBITEM], $VPIVOT) < 0)
$L += 1
WEnd
While ($ISTEP * StringCompare($AVARRAY[$R][$ISUBITEM], $VPIVOT) > 0)
$R -= 1
WEnd
EndIf
If $L <= $R Then
For $I = 0 To $ISUBMAX
$VTMP = $AVARRAY[$L][$I]
$AVARRAY[$L][$I] = $AVARRAY[$R][$I]
$AVARRAY[$R][$I] = $VTMP
Next
$L += 1
$R -= 1
EndIf
Until $L > $R
__ARRAYQUICKSORT2D($AVARRAY, $ISTEP, $ISTART, $R, $ISUBITEM, $ISUBMAX)
__ARRAYQUICKSORT2D($AVARRAY, $ISTEP, $L, $IEND, $ISUBITEM, $ISUBMAX)
EndFunc ;==>__ARRAYQUICKSORT2D
Func _ArraySwap(ByRef $VITEM1, ByRef $VITEM2)
Local $VTMP = $VITEM1
$VITEM1 = $VITEM2
$VITEM2 = $VTMP
EndFunc ;==>_ARRAYSWAP
Func _ArrayToClip(Const ByRef $AVARRAY, $ISTART = 0, $IEND = 0)
Local $SRESULT = _ArrayToString($AVARRAY, @CR, $ISTART, $IEND)
If @error Then Return SetError(@error, 0, 0)
Return ClipPut($SRESULT)
EndFunc ;==>_ARRAYTOCLIP
Func _ArrayToString(Const ByRef $AVARRAY, $SDELIM = "|", $ISTART = 0, $IEND = 0)
If Not IsArray($AVARRAY) Then Return SetError(1, 0, "")
If UBound($AVARRAY, 0) <> 1 Then Return SetError(3, 0, "")
Local $SRESULT, $IUBOUND = UBound($AVARRAY) - 1
If $IEND < 1 Or $IEND > $IUBOUND Then $IEND = $IUBOUND
If $ISTART < 0 Then $ISTART = 0
If $ISTART > $IEND Then Return SetError(2, 0, "")
For $I = $ISTART To $IEND
$SRESULT &= $AVARRAY[$I] & $SDELIM
Next
Return StringTrimRight($SRESULT, StringLen($SDELIM))
EndFunc ;==>_ARRAYTOSTRING
Func _ArrayTrim(ByRef $AVARRAY, $ITRIMNUM, $IDIRECTION = 0, $ISTART = 0, $IEND = 0)
If Not IsArray($AVARRAY) Then Return SetError(1, 0, 0)
If UBound($AVARRAY, 0) <> 1 Then Return SetError(2, 0, 0)
Local $IUBOUND = UBound($AVARRAY) - 1
If $IEND < 1 Or $IEND > $IUBOUND Then $IEND = $IUBOUND
If $ISTART < 0 Then $ISTART = 0
If $ISTART > $IEND Then Return SetError(5, 0, 0)
If $IDIRECTION Then
For $I = $ISTART To $IEND
$AVARRAY[$I] = StringTrimRight($AVARRAY[$I], $ITRIMNUM)
Next
Else
For $I = $ISTART To $IEND
$AVARRAY[$I] = StringTrimLeft($AVARRAY[$I], $ITRIMNUM)
Next
EndIf
Return 1
EndFunc ;==>_ARRAYTRIM
Func _ArrayUnique($AARRAY, $IDIMENSION = 1, $IBASE = 0, $ICASE = 0, $VDELIM = "|")
Local $IUBOUNDDIM
If $VDELIM = "|" Then $VDELIM = Chr(1)
If Not IsArray($AARRAY) Then Return SetError(1, 0, 0)
If Not $IDIMENSION > 0 Then
Return SetError(3, 0, 0)
Else
$IUBOUNDDIM = UBound($AARRAY, 1)
If @error Then Return SetError(3, 0, 0)
If $IDIMENSION > 1 Then
Local $AARRAYTMP[1]
For $I = 0 To $IUBOUNDDIM - 1
_ArrayAdd($AARRAYTMP, $AARRAY[$I][$IDIMENSION - 1])
Next
_ArrayDelete($AARRAYTMP, 0)
Else
If UBound($AARRAY, 0) = 1 Then
Dim $AARRAYTMP[1]
For $I = 0 To $IUBOUNDDIM - 1
_ArrayAdd($AARRAYTMP, $AARRAY[$I])
Next
_ArrayDelete($AARRAYTMP, 0)
Else
Dim $AARRAYTMP[1]
For $I = 0 To $IUBOUNDDIM - 1
_ArrayAdd($AARRAYTMP, $AARRAY[$I][$IDIMENSION - 1])
Next
_ArrayDelete($AARRAYTMP, 0)
EndIf
EndIf
EndIf
Local $SHOLD
For $ICC = $IBASE To UBound($AARRAYTMP) - 1
If Not StringInStr($VDELIM & $SHOLD, $VDELIM & $AARRAYTMP[$ICC] & $VDELIM, $ICASE) Then $SHOLD &= $AARRAYTMP[$ICC] & $VDELIM
Next
If $SHOLD Then
$AARRAYTMP = StringSplit(StringTrimRight($SHOLD, StringLen($VDELIM)), $VDELIM, 1)
Return $AARRAYTMP
EndIf
Return SetError(2, 0, 0)
EndFunc ;==>_ARRAYUNIQUE
Func __ARRAY_EXETERINTERNAL(ByRef $AVARRAY, $ISTART, $ISIZE, $SDELIM, ByRef $AIDX, ByRef $ARESULT, ByRef $ICOUNT)
If $ISTART == $ISIZE - 1 Then
For $I = 0 To $ISIZE - 1
$ARESULT[$ICOUNT] &= $AVARRAY[$AIDX[$I]] & $SDELIM
Next
If $SDELIM <> "" Then $ARESULT[$ICOUNT] = StringTrimRight($ARESULT[$ICOUNT], 1)
$ICOUNT += 1
Else
Local $ITEMP
For $I = $ISTART To $ISIZE - 1
$ITEMP = $AIDX[$I]
$AIDX[$I] = $AIDX[$ISTART]
$AIDX[$ISTART] = $ITEMP
__ARRAY_EXETERINTERNAL($AVARRAY, $ISTART + 1, $ISIZE, $SDELIM, $AIDX, $ARESULT, $ICOUNT)
$AIDX[$ISTART] = $AIDX[$I]
$AIDX[$I] = $ITEMP
Next
EndIf
EndFunc ;==>__ARRAY_EXETERINTERNAL
Func __ARRAY_COMBINATIONS($IN, $IR)
Local $I_TOTAL = 1
For $I = $IR To 1 Step -1
$I_TOTAL *= ($IN / $I)
$IN -= 1
Next
Return Round($I_TOTAL)
EndFunc ;==>__ARRAY_COMBINATIONS
Func __ARRAY_GETNEXT($IN, $IR, ByRef $ILEFT, $ITOTAL, ByRef $AIDX)
If $ILEFT == $ITOTAL Then
$ILEFT -= 1
Return
EndIf
Local $I = $IR - 1
While $AIDX[$I] == $IN - $IR + $I
$I -= 1
WEnd
$AIDX[$I] += 1
For $J = $I + 1 To $IR - 1
$AIDX[$J] = $AIDX[$I] + $J - $I
Next
$ILEFT -= 1
EndFunc ;==>__ARRAY_GETNEXT
Func _HexToString($STRHEX)
If StringLeft($STRHEX, 2) = "0x" Then Return BinaryToString($STRHEX)
Return BinaryToString("0x" & $STRHEX)
EndFunc ;==>_HEXTOSTRING
Func _StringBetween($S_STRING, $S_START, $S_END, $V_CASE = -1)
Local $S_CASE = ""
If $V_CASE = Default Or $V_CASE = -1 Then $S_CASE = "(?i)"
Local $S_PATTERN_ESCAPE = "(\.|\||\*|\?|\+|\(|\)|\{|\}|\[|\]|\^|\$|\\)"
$S_START = StringRegExpReplace($S_START, $S_PATTERN_ESCAPE, "\\$1")
$S_END = StringRegExpReplace($S_END, $S_PATTERN_ESCAPE, "\\$1")
If $S_START = "" Then $S_START = "\A"
If $S_END = "" Then $S_END = "\z"
Local $A_RET = StringRegExp($S_STRING, "(?s)" & $S_CASE & $S_START & "(.*?)" & $S_END, 3)
If @error Then Return SetError(1, 0, 0)
Return $A_RET
EndFunc ;==>_STRINGBETWEEN
Func _StringEncrypt($I_ENCRYPT, $S_ENCRYPTTEXT, $S_ENCRYPTPASSWORD, $I_ENCRYPTLEVEL = 1)
If $I_ENCRYPT <> 0 And $I_ENCRYPT <> 1 Then
SetError(1, 0, "")
ElseIf $S_ENCRYPTTEXT = "" Or $S_ENCRYPTPASSWORD = "" Then
SetError(1, 0, "")
Else
If Number($I_ENCRYPTLEVEL) <= 0 Or Int($I_ENCRYPTLEVEL) <> $I_ENCRYPTLEVEL Then $I_ENCRYPTLEVEL = 1
Local $V_ENCRYPTMODIFIED
Local $I_ENCRYPTCOUNTH
Local $I_ENCRYPTCOUNTG
Local $V_ENCRYPTSWAP
Local $AV_ENCRYPTBOX[256][2]
Local $I_ENCRYPTCOUNTA
Local $I_ENCRYPTCOUNTB
Local $I_ENCRYPTCOUNTC
Local $I_ENCRYPTCOUNTD
Local $I_ENCRYPTCOUNTE
Local $V_ENCRYPTCIPHER
Local $V_ENCRYPTCIPHERBY
If $I_ENCRYPT = 1 Then
For $I_ENCRYPTCOUNTF = 0 To $I_ENCRYPTLEVEL Step 1
$I_ENCRYPTCOUNTG = ""
$I_ENCRYPTCOUNTH = ""
$V_ENCRYPTMODIFIED = ""
For $I_ENCRYPTCOUNTG = 1 To StringLen($S_ENCRYPTTEXT)
If $I_ENCRYPTCOUNTH = StringLen($S_ENCRYPTPASSWORD) Then
$I_ENCRYPTCOUNTH = 1
Else
$I_ENCRYPTCOUNTH += 1
EndIf
$V_ENCRYPTMODIFIED = $V_ENCRYPTMODIFIED & Chr(BitXOR(Asc(StringMid($S_ENCRYPTTEXT, $I_ENCRYPTCOUNTG, 1)), Asc(StringMid($S_ENCRYPTPASSWORD, $I_ENCRYPTCOUNTH, 1)), 255))
Next
$S_ENCRYPTTEXT = $V_ENCRYPTMODIFIED
$I_ENCRYPTCOUNTA = ""
$I_ENCRYPTCOUNTB = 0
$I_ENCRYPTCOUNTC = ""
$I_ENCRYPTCOUNTD = ""
$I_ENCRYPTCOUNTE = ""
$V_ENCRYPTCIPHERBY = ""
$V_ENCRYPTCIPHER = ""
$V_ENCRYPTSWAP = ""
$AV_ENCRYPTBOX = ""
Local $AV_ENCRYPTBOX[256][2]
For $I_ENCRYPTCOUNTA = 0 To 255
$AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][1] = Asc(StringMid($S_ENCRYPTPASSWORD, Mod($I_ENCRYPTCOUNTA, StringLen($S_ENCRYPTPASSWORD)) + 1, 1))
$AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][0] = $I_ENCRYPTCOUNTA
Next
For $I_ENCRYPTCOUNTA = 0 To 255
$I_ENCRYPTCOUNTB = Mod(($I_ENCRYPTCOUNTB + $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][0] + $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][1]), 256)
$V_ENCRYPTSWAP = $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][0]
$AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][0] = $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTB][0]
$AV_ENCRYPTBOX[$I_ENCRYPTCOUNTB][0] = $V_ENCRYPTSWAP
Next
For $I_ENCRYPTCOUNTA = 1 To StringLen($S_ENCRYPTTEXT)
$I_ENCRYPTCOUNTC = Mod(($I_ENCRYPTCOUNTC + 1), 256)
$I_ENCRYPTCOUNTD = Mod(($I_ENCRYPTCOUNTD + $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTC][0]), 256)
$I_ENCRYPTCOUNTE = $AV_ENCRYPTBOX[Mod(($AV_ENCRYPTBOX[$I_ENCRYPTCOUNTC][0] + $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTD][0]), 256)][0]
$V_ENCRYPTCIPHERBY = BitXOR(Asc(StringMid($S_ENCRYPTTEXT, $I_ENCRYPTCOUNTA, 1)), $I_ENCRYPTCOUNTE)
$V_ENCRYPTCIPHER &= Hex($V_ENCRYPTCIPHERBY, 2)
Next
$S_ENCRYPTTEXT = $V_ENCRYPTCIPHER
Next
Else
For $I_ENCRYPTCOUNTF = 0 To $I_ENCRYPTLEVEL Step 1
$I_ENCRYPTCOUNTB = 0
$I_ENCRYPTCOUNTC = ""
$I_ENCRYPTCOUNTD = ""
$I_ENCRYPTCOUNTE = ""
$V_ENCRYPTCIPHERBY = ""
$V_ENCRYPTCIPHER = ""
$V_ENCRYPTSWAP = ""
$AV_ENCRYPTBOX = ""
Local $AV_ENCRYPTBOX[256][2]
For $I_ENCRYPTCOUNTA = 0 To 255
$AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][1] = Asc(StringMid($S_ENCRYPTPASSWORD, Mod($I_ENCRYPTCOUNTA, StringLen($S_ENCRYPTPASSWORD)) + 1, 1))
$AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][0] = $I_ENCRYPTCOUNTA
Next
For $I_ENCRYPTCOUNTA = 0 To 255
$I_ENCRYPTCOUNTB = Mod(($I_ENCRYPTCOUNTB + $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][0] + $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][1]), 256)
$V_ENCRYPTSWAP = $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][0]
$AV_ENCRYPTBOX[$I_ENCRYPTCOUNTA][0] = $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTB][0]
$AV_ENCRYPTBOX[$I_ENCRYPTCOUNTB][0] = $V_ENCRYPTSWAP
Next
For $I_ENCRYPTCOUNTA = 1 To StringLen($S_ENCRYPTTEXT) Step 2
$I_ENCRYPTCOUNTC = Mod(($I_ENCRYPTCOUNTC + 1), 256)
$I_ENCRYPTCOUNTD = Mod(($I_ENCRYPTCOUNTD + $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTC][0]), 256)
$I_ENCRYPTCOUNTE = $AV_ENCRYPTBOX[Mod(($AV_ENCRYPTBOX[$I_ENCRYPTCOUNTC][0] + $AV_ENCRYPTBOX[$I_ENCRYPTCOUNTD][0]), 256)][0]
$V_ENCRYPTCIPHERBY = BitXOR(Dec(StringMid($S_ENCRYPTTEXT, $I_ENCRYPTCOUNTA, 2)), $I_ENCRYPTCOUNTE)
$V_ENCRYPTCIPHER = $V_ENCRYPTCIPHER & Chr($V_ENCRYPTCIPHERBY)
Next
$S_ENCRYPTTEXT = $V_ENCRYPTCIPHER
$I_ENCRYPTCOUNTG = ""
$I_ENCRYPTCOUNTH = ""
$V_ENCRYPTMODIFIED = ""
For $I_ENCRYPTCOUNTG = 1 To StringLen($S_ENCRYPTTEXT)
If $I_ENCRYPTCOUNTH = StringLen($S_ENCRYPTPASSWORD) Then
$I_ENCRYPTCOUNTH = 1
Else
$I_ENCRYPTCOUNTH += 1
EndIf
$V_ENCRYPTMODIFIED &= Chr(BitXOR(Asc(StringMid($S_ENCRYPTTEXT, $I_ENCRYPTCOUNTG, 1)), Asc(StringMid($S_ENCRYPTPASSWORD, $I_ENCRYPTCOUNTH, 1)), 255))
Next
$S_ENCRYPTTEXT = $V_ENCRYPTMODIFIED
Next
EndIf
Return $S_ENCRYPTTEXT
EndIf
EndFunc ;==>_STRINGENCRYPT
Func _StringExplode($SSTRING, $SDELIMITER, $ILIMIT = 0)
If $ILIMIT > 0 Then
$SSTRING = StringReplace($SSTRING, $SDELIMITER, Chr(0), $ILIMIT)
$SDELIMITER = Chr(0)
ElseIf $ILIMIT < 0 Then
Local $IINDEX = StringInStr($SSTRING, $SDELIMITER, 0, $ILIMIT)
If $IINDEX Then
$SSTRING = StringLeft($SSTRING, $IINDEX - 1)
EndIf
EndIf
Return StringSplit($SSTRING, $SDELIMITER, 3)
EndFunc ;==>_STRINGEXPLODE
Func _StringInsert($S_STRING, $S_INSERTSTRING, $I_POSITION)
Local $I_LENGTH, $S_START, $S_END
If $S_STRING = "" Or (Not IsString($S_STRING)) Then
Return SetError(1, 0, $S_STRING)
ElseIf $S_INSERTSTRING = "" Or (Not IsString($S_STRING)) Then
Return SetError(2, 0, $S_STRING)
Else
$I_LENGTH = StringLen($S_STRING)
If (Abs($I_POSITION) > $I_LENGTH) Or (Not IsInt($I_POSITION)) Then
Return SetError(3, 0, $S_STRING)
EndIf
EndIf
If $I_POSITION = 0 Then
Return $S_INSERTSTRING & $S_STRING
ElseIf $I_POSITION > 0 Then
$S_START = StringLeft($S_STRING, $I_POSITION)
$S_END = StringRight($S_STRING, $I_LENGTH - $I_POSITION)
Return $S_START & $S_INSERTSTRING & $S_END
ElseIf $I_POSITION < 0 Then
$S_START = StringLeft($S_STRING, Abs($I_LENGTH + $I_POSITION))
$S_END = StringRight($S_STRING, Abs($I_POSITION))
Return $S_START & $S_INSERTSTRING & $S_END
EndIf
EndFunc ;==>_STRINGINSERT
Func _StringProper($S_STRING)
Local $IX = 0
Local $CAPNEXT = 1
Local $S_NSTR = ""
Local $S_CURCHAR
For $IX = 1 To StringLen($S_STRING)
$S_CURCHAR = StringMid($S_STRING, $IX, 1)
Select
Case $CAPNEXT = 1
If StringRegExp($S_CURCHAR, "[a-zA-ZÀ-ÿšœžŸ]") Then
$S_CURCHAR = StringUpper($S_CURCHAR)
$CAPNEXT = 0
EndIf
Case Not StringRegExp($S_CURCHAR, "[a-zA-ZÀ-ÿšœžŸ]")
$CAPNEXT = 1
Case Else
$S_CURCHAR = StringLower($S_CURCHAR)
EndSelect
$S_NSTR &= $S_CURCHAR
Next
Return $S_NSTR
EndFunc ;==>_STRINGPROPER
Func _StringRepeat($SSTRING, $IREPEATCOUNT)
Local $SRESULT
Select
Case Not StringIsInt($IREPEATCOUNT)
SetError(1)
Return ""
Case StringLen($SSTRING) < 1
SetError(1)
Return ""
Case $IREPEATCOUNT <= 0
SetError(1)
Return ""
Case Else
For $ICOUNT = 1 To $IREPEATCOUNT
$SRESULT &= $SSTRING
Next
Return $SRESULT
EndSelect
EndFunc ;==>_STRINGREPEAT
Func _StringReverse($S_STRING)
Local $I_LEN = StringLen($S_STRING)
If $I_LEN < 1 Then Return SetError(1, 0, "")
Local $T_CHARS = DllStructCreate("char[" & $I_LEN + 1 & "]")
DllStructSetData($T_CHARS, 1, $S_STRING)
Local $A_REV = DllCall("msvcrt.dll", "ptr:cdecl", "_strrev", "struct*", $T_CHARS)
If @error Or $A_REV[0] = 0 Then Return SetError(2, 0, "")
Return DllStructGetData($T_CHARS, 1)
EndFunc ;==>_STRINGREVERSE
Func _StringToHex($STRCHAR)
Return Hex(StringToBinary($STRCHAR))
EndFunc ;==>_STRINGTOHEX
HttpSetProxy(1)
HttpSetUserAgent("Internet")
Local $SHWID = _HWID()
If _GETHWID($SHWID) Then
MsgBox(4096, "", "Welcome - you have successfully been authenticated")
Else
MsgBox(4096, "", "You have not bought this software.")
EndIf
ConsoleWrite($SHWID)
Func _GETHWID($SHWID)
Local $AARRAY = StringSplit(BinaryToString(InetRead("http://blackscripts.net/cryptomatic/paid/users.txt")), @LF)
If @error Then
Return SetError(1, 0, 0)
EndIf
Return _ArraySearch($AARRAY, $SHWID) > -1
EndFunc ;==>_GETHWID
Func _HWID()
$TEST = DriveGetSerial(@HomeDrive)
$REVERSE = _StringReverse($TEST)
$DOUBLEREVERSE = _StringEncrypt(1, $REVERSE, "0x3keEkrjD32")
$SHWID = _StringReverse($DOUBLEREVERSE)
Return $SHWID
EndFunc ;==>_HWID