#include <GUIConstantsEx.au3>
#Include <String.au3>
#Include <Array.au3>
GUICreate("Blocks", 300, 200)
$list = GUICtrlCreateList("", 10, 10, 130, 180)
$add = GUICtrlCreateButton("Add", 150, 10, 40)
$input = GUICtrlCreateInput("NewBlock", 200, 11, 85, 23)
$delete = GUICtrlCreateButton("Delete from List", 150, 50, 136)
$save = GUICtrlCreateButton("Save", 150, 160, 136)
GUISetState()
read()
Do
$msg = GUIGetMsg()
If $msg = $add Then
$new = GUICtrlRead($input)
_ArrayAdd($block, $new)
GUICtrlSetData($list, "")
For $i=1 To UBound($block)-1
GUICtrlSetData($list, $block[$i])
Next
EndIf
If $msg = $delete Then
$selected = GUICtrlRead($list)
$number = _ArraySearch($block, $selected, 0, 0, 0, 1)
_ArrayDelete($block, $number)
GUICtrlSetData($list, "")
For $i=1 To UBound($block)-1
GUICtrlSetData($list, $block[$i])
Next
EndIf
If $msg = $save Then
write()
EndIf
Until $msg = $GUI_EVENT_CLOSE
Func read()
$file = FileOpen(@ScriptDir&"\Setting\SRChattingBlockingList.dat", 4)
$start = FileRead($file, 4)
$number =
Dec(StringTrimLeft(String(FileRead($file, 1)), 2))
$shit = FileRead($file, 3)
Global $block[$number+1]
For $i=1 To $number
$chars =
Dec(StringTrimLeft(String(FileRead($file, 1)), 2))
$block[$i] = _HexToString(StringTrimLeft(String(FileRead($file, $chars)), 2))
GUICtrlSetData($list, $block[$i])
Next
FileClose($file)
EndFunc
Func write()
$file = FileOpen(@ScriptDir&"\Setting\SRChattingBlockingList.dat", 18)
FileWrite($file, 0x1)
FileWrite($file, UBound($block)-1)
For $i=1 To UBound($block)-1
FileWrite($file, BinaryMid("0x"&Hex(StringLen($block[$i])),4,4))
FileWrite($file, $block[$i])
Next
FileClose($file)
EndFunc