1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60:
| #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 |