Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. SetWorkingDir, %A_ScriptDir%
  2. IfNotExist, config.ini
  3. {
  4.     MsgBox, 4, Cannot find config.ini, Cannot find the config.ini file, create?
  5.     IfMsgBox, No
  6.         ExitApp
  7.     IfMsgBox, Yes
  8.     {
  9.         Random, Result, 1000, 9999
  10.         NewClient := MakeConfig("NoName" . Result,800,600,10,0,0,0,5)
  11.         FileAppend, %NewClient%, config.ini
  12.     }
  13. }
  14. IniRead, NickName, config.ini, client, name
  15. IniRead, XRes, config.ini, client, xres
  16. IniRead, YRes, config.ini, client, yres
  17. IniRead, Volume, config.ini, client, vol
  18. IniRead, Invert, config.ini, client, inverty
  19. IniRead, Windowed, config.ini, client, windowed
  20. IniRead, Mouse, config.ini, client, mouse_sensitivity
  21. Invert := Invert ? "Checked" : ""
  22. Windowed := Windowed ? "Checked" : ""
  23. Gui, Add, Text, x12 y10 h20 , Nickname:
  24. Gui, Add, Text, x12 y40 h20, XResolution:
  25. Gui, Add, Text, x12 y70 h20, YResolution:
  26. Gui, Add, Text, x12 y100 h20 , Volume:
  27. Gui, Add, Text, x12 y130 h20 , Mouse Sensitivity:
  28. Gui, Add, Edit, x112 y10 w350 h20 vNickName, %NickName%
  29. Gui, Add, Edit, x112 y40 w350 h20 vXRes Number, %XRes%
  30. Gui, Add, Edit, x112 y70 w350 h20 vYRes Number, %YRes%
  31. Gui, Add, Edit, x112 y100 w350 h20 Number
  32. Gui, Add, UpDown, vVolume Range0-10, %Volume%
  33. Gui, Add, Edit, x112 y130 w350 h20 Number
  34. Gui, Add, UpDown, vMouse Range0-10, %Mouse%
  35. Gui, Add, CheckBox, x12 y160 w90 h20 vInvert %Invert%, Invert Y Axis
  36. Gui, Add, CheckBox, x232 y160 w80 h20 vWindowed %Windowed%, Windowed
  37. Gui, Add, Button, x182 y190 w100 h30 gUpdate, Update config.ini
  38. Gui, Show, h234 w479, AoS Configurator
  39. Return
  40.  
  41. Update:
  42. Gui, Submit, NoHide
  43. IniRead, Language, config.ini, client, language
  44. If (Language = "ERROR")
  45.     Language = 0
  46. If (Volume < 0)
  47.     Volume = 0
  48. If (Volume > 10)
  49.     Volume = 10
  50. If (Mouse < 0)
  51.     Mouse = 0
  52. If (Mouse > 10)
  53.     Mouse = 10
  54. GuiControl,, Volume, %Volume%
  55. GuiControl,, Mouse, %Mouse%
  56. IfExist, config.ini
  57.     FileRead, BKConfig, config.ini
  58. FileDelete, config.ini
  59. IfExist, config.ini
  60. {
  61.     MsgBox, 0, Failure!, Could not remove existing config.ini
  62.     Return
  63. }
  64. AppendConfig := MakeConfig(NickName,XRes,YRes,Volume,Invert,Windowed,Language,Mouse)
  65. FileAppend, %AppendConfig%, config.ini
  66. IfNotExist, config.ini
  67. {
  68.     MsgBox, 0, Failure!, Could not write to config.ini
  69.     Return
  70. }
  71. FileRead, NewConfig, config.ini
  72. If (AppendConfig != NewConfig)
  73. {
  74.     MsgBox, 4, Failure!, New config.ini didn't write correctly, Restore old one?
  75.     IfMsgBox, Yes
  76.     {
  77.         FileDelete, config.ini
  78.         IfExist, config.ini
  79.         {
  80.             MsgBox, 0, Failure!, Could not remove existing config.ini
  81.             Return
  82.         }
  83.         FileAppend, %BKConfig%, config.ini
  84.         IfNotExist, config.ini
  85.         {
  86.             MsgBox, 0, Failure!, Could not write to config.ini
  87.             Return
  88.         }
  89.         FileRead, NewConfig, config.ini
  90.         If (BKConfig != NewConfig)
  91.         {
  92.             MsgBox, 0, Failure!, Could not restore old config.ini
  93.             Return
  94.         }
  95.         Else
  96.         {
  97.             MsgBox, 0, Success!, Restored old config.ini
  98.             Return
  99.         }
  100.     }
  101.     IfMsgBox, No
  102.         Return
  103. }
  104. MsgBox, 0, Success!, New config.ini written
  105. Return
  106.  
  107. D(N)
  108. {
  109. Loop,%N%
  110. W.=" "
  111. Return W
  112. }
  113.  
  114. MakeConfig(Name,XRes,YRes,Vol,Invert,Win,Lang,Mouse)
  115. {
  116. Config := "`r`n[client]`r`nname" . D(27) . "= " . Name . "`r`nxres" . D(27) . "= " . Xres . "`r`nyres" . D(27) . "= " . YRes . "`r`nvol" . D(28) . "= " . Vol . "`r`ninverty" . D(24) . "= " . Invert . "`r`nwindowed" . D(23) . "= " . Win . "`r`nlanguage" . D(23) . "= " . Lang . "`r`nmouse_sensitivity" . D(14) . "= " . Mouse . "`r`n"
  117. Return Config
  118. }
  119.  
  120. GuiClose:
  121. ExitApp