Guest User

Untitled

a guest
Nov 26th, 2014
506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.76 KB | None | 0 0
  1. #include <GUIConstantsEx.au3>
  2. #include <GuiMenu.au3>
  3. #include <WinAPI.au3>
  4. #include <EditConstants.au3>
  5. #include <WindowsConstants.au3>
  6. #include <ColorConstants.au3>
  7. #include <Table.au3>
  8. #include <Process.au3>
  9. #include <File.au3>
  10. #include <InetConstants.au3>
  11.  
  12. Global $g_idMemo, $hGUI, $hFile, $hHelp, $hMain, $hSettings, $aGUI
  13. Global $bOverview, $lWallet, $lBalance, $lUnconfirmed, $lRecent, $bRefresh
  14. Global $bSend, $bPay, $lPayto, $lAmount, $iPayto, $iAmount, $lStatus
  15. Global $bReceive, $lAddress, $iAddress
  16. Global $bTransactions, $tTrans, $Data, $Type, $Trans, $Amou
  17. Global $bAddresses, $tAddy, $Addy, $bAdd
  18. Global $bMine, $bStart, $bEnd, $lMiningStatus, $lPool, $lHashrate, $lMoneroMade
  19. Global $bConsole, $eConsole
  20. Global Enum $e_idNew = 1000, $e_idBU, $e_idExit, $e_idAbout, $e_idConsole
  21. Global $State
  22. Global $about = 0
  23. $bitmonorodlog = @ScriptDir & "\bitmonerod.log"
  24. $simplewalletlog = @ScriptDir & "\simplewallet.log"
  25. $moneroguilog = @ScriptDir & "\monerogui.log"
  26. $addresslist = @ScriptDir & "\addresslist.txt"
  27. $mineconf = @ScriptDir & "\cpuminer\minerdconf.txt"
  28. FileOpen($moneroguilog, 10)
  29. FileOpen($addresslist, 9)
  30. If FileExists($mineconf) Then
  31. ;Do Nothing
  32. Else
  33. FileOpen($mineconf, 10)
  34. FileWrite($mineconf, @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF & @CRLF)
  35. EndIf
  36. $TransLN = _FileCountLines($simplewalletlog)
  37. If $TransLN > 100 Then
  38. $TransLN = 100
  39. EndIf
  40. If FileReadLine($moneroguilog, 1) = "" Then
  41. For $y = 0 to $TransLN Step 1
  42. $Trans = FileReadLine($simplewalletlog, $y)
  43. If StringInStr($Trans, "received") and StringInStr($Trans, "transaction") Then
  44. FileWrite($moneroguilog, $Trans & @CRLF)
  45. EndIf
  46. If StringInStr($Trans, "spent") and StringInStr($Trans, "transaction") Then
  47. FileWrite($moneroguilog, $Trans & @CRLF)
  48. EndIf
  49. Next
  50. EndIf
  51. If FileExists(@ScriptDir & "\wallet.bin") = 0 Then
  52. _FirstSetup()
  53. Endif
  54. If ProcessExists("bitmonerod.exe") Then
  55. ConsoleWrite("bitmonero is already running" & @CRLF)
  56. Else
  57. FileDelete(@ScriptDir & "\bitmonerod.log")
  58. If FileExists(@ScriptDir & "\bitmonerod.exe") Then
  59. $ibitonero = Run(@ScriptDir & "\bitmonerod.exe", @ScriptDir, @SW_HIDE)
  60. ConsoleWrite("bitmonero started PID= " & $ibitonero & @CRLF)
  61. Sleep(4000)
  62. Else
  63. $reply = MsgBox(17, "Fatal Error", "bitmonrod.exe not found, click Ok do download latest versions")
  64. If $reply = 1 Then
  65. _Download()
  66. Else
  67. Exit
  68. EndIf
  69. EndIf
  70. EndIf
  71.  
  72. If ProcessExists("simplewallet.exe") Then
  73. ConsoleWrite("simplewallet is already running" & @CRLF)
  74. Else
  75. FileDelete(@ScriptDir & "\simplewallet.log")
  76. If FileExists(@ScriptDir & "\simplewallet.exe") Then
  77. $isimplewallet = Run(@ScriptDir & "\simplewallet.exe --wallet wallet.bin", @ScriptDir, @SW_HIDE)
  78. $Password = InputBox("Wallet Password", "Please provide your wallet password", "", "*", 250, 130)
  79. ConsoleWrite("simplewallet started PID= " & $isimplewallet & @CRLF)
  80. $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
  81. ControlSend($simplewallet,"","", $Password & @CRLF)
  82. Else
  83. $reply = MsgBox(17, "Fatal Error", "simplewallet.exe not found, click Ok do download latest versions")
  84. If $reply = 1 Then
  85. _Download()
  86. Else
  87. Exit
  88. EndIf
  89. EndIf
  90. EndIf
  91.  
  92. $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
  93. $bitmonorod = WinGetHandle(@ScriptDir & "\bitmonerod.exe", "")
  94.  
  95. Func MoneroGUI()
  96. ConsoleWrite("you are in MoneroGUI" & @CRLF)
  97. $sGUI = GUICreate("Monero GUI Wallet: Loading...", 920, 300)
  98. GUISetFont(8, 400, 0, "Tahoma")
  99. GUISetBkColor(0x464646)
  100. $lLoading = GUICtrlCreateLabel("Please wait while bitmonero starts up....", 10, 10, 400, 20)
  101. $eLoading = GUICtrlCreateEdit("", 10, 40, 600, 230)
  102. GUICtrlSetFont($lLoading, 10, 600, 0, "Tahoma")
  103. GUICtrlSetColor($lLoading, 0xC3B54C)
  104. GUISetState(@SW_SHOW)
  105.  
  106. While 1
  107. $Load = FileRead($bitmonorodlog)
  108. GUICtrlSetData($eLoading, $Load)
  109. If StringInStr($Load, "The daemon will start synchronizing with the network.") Then
  110. GUIDelete($sGUI)
  111. ExitLoop
  112. EndIf
  113. Sleep(1000)
  114. WEnd
  115.  
  116. Sleep(1000)
  117.  
  118. $hGUI = GUICreate("Monero GUI Wallet", 920, 300)
  119. GUISetFont(8, 400, 0, "Tahoma")
  120. GUISetBkColor(0x464646)
  121. $hFile = _GUICtrlMenu_CreateMenu()
  122. _GUICtrlMenu_InsertMenuItem($hFile, 0, "Backup", $e_idBU)
  123. _GUICtrlMenu_InsertMenuItem($hFile, 1, "", 0)
  124. _GUICtrlMenu_InsertMenuItem($hFile, 2, "Exit", $e_idExit)
  125. $hHelp = _GUICtrlMenu_CreateMenu()
  126. _GUICtrlMenu_InsertMenuItem($hHelp, 0, "About", $e_idAbout)
  127. _GUICtrlMenu_InsertMenuItem($hHelp, 0, "Console", $e_idConsole)
  128. $hMain = _GUICtrlMenu_CreateMenu()
  129. _GUICtrlMenu_InsertMenuItem($hMain, 0, "File", 0, $hFile)
  130. _GUICtrlMenu_InsertMenuItem($hMain, 1, "Settings", 0, $hSettings)
  131. _GUICtrlMenu_InsertMenuItem($hMain, 2, "Help", 0, $hHelp)
  132. _GUICtrlMenu_SetMenu($hGUI, $hMain)
  133.  
  134. GUICtrlSetFont($lRecent, 10, 400, 0, "Tahoma")
  135. $bOverview = GUICtrlCreateButton("Overview", 10, 10, 80, 25, 0)
  136. GUICtrlSetFont($bOverview, 10, 400, 0, "Tahoma")
  137. $bSend = GUICtrlCreateButton("Send", 95, 10, 80, 25, 0)
  138. GUICtrlSetFont($bSend, 10, 400, 0, "Tahoma")
  139. $bReceive = GUICtrlCreateButton("Receive", 180, 10, 80, 25, 0)
  140. GUICtrlSetFont($bReceive, 10, 400, 0, "Tahoma")
  141. $bTransactions = GUICtrlCreateButton("Transactions", 265, 10, 80, 25, 0)
  142. GUICtrlSetFont($bTransactions, 10, 400, 0, "Tahoma")
  143. $bAddresses = GUICtrlCreateButton("Addresses", 350, 10, 80, 25, 0)
  144. GUICtrlSetFont($bAddresses, 10, 400, 0, "Tahoma")
  145. $bMine = GUICtrlCreateButton("Mining", 435, 10, 80, 25, 0)
  146. GUICtrlSetFont($bMine, 10, 400, 0, "Tahoma")
  147.  
  148. $lWallet = GUICtrlCreateLabel("Wallet:", 15, 40, 400, 20)
  149. GUICtrlSetFont($lWallet, 10, 600, 0, "Tahoma")
  150. GUICtrlSetColor($lWallet, 0xC3B54C)
  151. $lBalance = GUICtrlCreateLabel("Balance:", 15, 70, 400, 20)
  152. GUICtrlSetFont($lBalance, 10, 600, 0, "Tahoma")
  153. GUICtrlSetColor($lBalance, 0xC3B54C)
  154. $lUnconfirmed = GUICtrlCreateLabel("Unconfirmed:", 15, 100, 400, 20)
  155. GUICtrlSetFont($lUnconfirmed, 10, 600, 0, "Tahoma")
  156. GUICtrlSetColor($lUnconfirmed, 0xC3B54C)
  157. $lRecent = GUICtrlCreateLabel("Recent:", 15, 130, 950, 50)
  158. GUICtrlSetFont($lRecent, 10, 600, 0, "Tahoma")
  159. GUICtrlSetColor($lRecent, 0xC3B54C)
  160. $bRefresh = GUICtrlCreateButton("Refresh", 830, 250, 76, 25, 0)
  161. GUICtrlSetFont($bRefresh, 10, 400, 0, "Tahoma")
  162.  
  163. $lPayto = GUICtrlCreateLabel("Pay to:", 15, 40, 70, 20)
  164. GUICtrlSetFont($lPayto, 10, 600, 0, "Tahoma")
  165. GUICtrlSetColor($lPayto, 0xC3B54C)
  166. GUICtrlSetState($lPayto, $GUI_HIDE)
  167. $iPayto = GUICtrlCreateInput("", 85, 40, 800, 20)
  168. GUICtrlSetFont($iPayto, 10, 400, 0, "Tahoma")
  169. GUICtrlSetState($iPayto, $GUI_HIDE)
  170. $lAmount = GUICtrlCreateLabel("Amount:", 15, 70, 70, 20)
  171. GUICtrlSetFont($lAmount, 10, 600, 0, "Tahoma")
  172. GUICtrlSetColor($lAmount, 0xC3B54C)
  173. GUICtrlSetState($lAmount, $GUI_HIDE)
  174. $iAmount = GUICtrlCreateInput("", 85, 70, 120, 20)
  175. GUICtrlSetFont($iAmount, 10, 400, 0, "Tahoma")
  176. GUICtrlSetState($iAmount, $GUI_HIDE)
  177. $lStatus = GUICtrlCreateLabel("Status:", 15, 100, 900, 150)
  178. GUICtrlSetFont($lStatus, 10, 600, 0, "Tahoma")
  179. GUICtrlSetColor($lStatus, 0xC3B54C)
  180. GUICtrlSetState($lStatus, $GUI_HIDE)
  181. $bPay = GUICtrlCreateButton("Pay", 830, 250, 76, 25, 0)
  182. GUICtrlSetFont($bPay, 10, 400, 0, "Tahoma")
  183. GUICtrlSetState($bPay, $GUI_HIDE)
  184.  
  185. $lAddress = GUICtrlCreateLabel("Your address:", 15, 40, 100, 20)
  186. GUICtrlSetFont($lAddress, 10, 600, 0, "Tahoma")
  187. GUICtrlSetColor($lAddress, 0xC3B54C)
  188. GUICtrlSetState($lAddress, $GUI_HIDE)
  189. $iAddress = GUICtrlCreateInput("Your address:", 115, 40, 700, 20,$ES_READONLY,$WS_EX_TOOLWINDOW)
  190. GUICtrlSetFont($iAddress, 10, 400, 0, "Tahoma")
  191. GUICtrlSetState($iAddress, $GUI_HIDE)
  192.  
  193. $bAdd = GUICtrlCreateButton("Add", 830, 250, 76, 25, 0)
  194. GUICtrlSetFont($bAdd, 10, 400, 0, "Tahoma")
  195. GUICtrlSetState($bAdd, $GUI_HIDE)
  196.  
  197. $bStart = GUICtrlCreateButton("Start", 10, 40, 70, 25, 0)
  198. GUICtrlSetFont($bStart, 10, 400, 0, "Tahoma")
  199. GUICtrlSetState($bStart, $GUI_HIDE)
  200. $bEnd = GUICtrlCreateButton("End", 85, 40, 70, 25, 0)
  201. GUICtrlSetFont($bEnd, 10, 400, 0, "Tahoma")
  202. GUICtrlSetState($bEnd, $GUI_HIDE)
  203. $lMiningStatus = GUICtrlCreateLabel("Status:", 15, 70, 700, 20)
  204. GUICtrlSetFont($lMiningStatus, 10, 600, 0, "Tahoma")
  205. GUICtrlSetColor($lMiningStatus, 0xC3B54C)
  206. GUICtrlSetState($lMiningStatus, $GUI_HIDE)
  207. $lPool = GUICtrlCreateLabel("Your pool:", 15, 100, 700, 20)
  208. GUICtrlSetFont($lPool, 10, 600, 0, "Tahoma")
  209. GUICtrlSetColor($lPool, 0xC3B54C)
  210. GUICtrlSetState($lPool, $GUI_HIDE)
  211. $lHashrate = GUICtrlCreateLabel("Your address: ", 15, 130, 900, 20)
  212. GUICtrlSetFont($lHashrate, 10, 600, 0, "Tahoma")
  213. GUICtrlSetColor($lHashrate, 0xC3B54C)
  214. GUICtrlSetState($lHashrate, $GUI_HIDE)
  215. $lMoneroMade = GUICtrlCreateLabel("Daily income: ", 15, 160, 700, 20)
  216. GUICtrlSetFont($lMoneroMade, 10, 600, 0, "Tahoma")
  217. GUICtrlSetColor($lMoneroMade, 0xC3B54C)
  218. GUICtrlSetState($lMoneroMade, $GUI_HIDE)
  219.  
  220. $eConsole = GUICtrlCreateEdit("", 10, 40, 600, 230)
  221. GUICtrlSetFont($eConsole, 10, 600, 0, "Tahoma")
  222. GUICtrlSetState($eConsole, $GUI_HIDE)
  223.  
  224. GUISetState(@SW_SHOW)
  225.  
  226. FileOpen($moneroguilog, 10)
  227. $TransLN = _FileCountLines($simplewalletlog)
  228. If $TransLN > 100 Then
  229. $TransLN = 100
  230. EndIf
  231. If FileReadLine($moneroguilog, 1) = "" Then
  232. For $y = 0 to $TransLN Step 1
  233. $Trans = FileReadLine($simplewalletlog, $y)
  234. If StringInStr($Trans, "received") and StringInStr($Trans, "transaction") Then
  235. FileWrite($moneroguilog, $Trans & @CRLF)
  236. EndIf
  237. If StringInStr($Trans, "spent") and StringInStr($Trans, "transaction") Then
  238. FileWrite($moneroguilog, $Trans & @CRLF)
  239. EndIf
  240. Next
  241. EndIf
  242. $lines = _FileCountLines($moneroguilog)
  243. $Recent = FileReadLine($moneroguilog, $lines)
  244. GUICtrlSetData($lRecent, "Recent: " & $Recent)
  245.  
  246.  
  247.  
  248. $x = 0
  249. $e = 0
  250. While 1
  251. If $x > 10 Then $x = 0
  252. $State = _FileCountLines($bitmonorodlog)
  253. $State = FileReadLine($bitmonorodlog, $State - $x)
  254. If StringInStr($State, "behind") Or StringInStr($State, "SYNCHRONIZED OK") Then
  255. If StringInStr($State, "behind") Then
  256. $BehindLeft = StringInStr($State, "blocks")
  257. $Behind = StringTrimLeft($State, $BehindLeft + 7)
  258. $BehindRight = StringInStr($Behind, "behind")
  259. $Behind = StringLeft($Behind, $BehindRight - 3)
  260. $State = "Out of sync (" & $Behind & ")"
  261. GUICtrlSetColor($lWallet, $COLOR_RED)
  262. ExitLoop
  263. EndIf
  264. If StringInStr($State, "SYNCHRONIZED OK") Then
  265. $State = "Synchronized"
  266. GUICtrlSetColor($lWallet, $COLOR_GREEN)
  267. ExitLoop
  268. EndIf
  269. EndIf
  270. If $e > 10 Then
  271. $State = "Unknown"
  272. ExitLoop
  273. EndIf
  274. $e = $e + 1
  275. $x = $x + 1
  276. WEnd
  277.  
  278. GUICtrlSetData($lWallet, "Wallet: " & $State)
  279.  
  280. $i = 0
  281. $e = 0
  282. While 1
  283. If $i > 10 Then $i = 0
  284. $Bal = _FileCountLines($simplewalletlog)
  285. If $Bal > 500 Then
  286. $Bal = 500
  287. EndIf
  288. $Bal = FileReadLine($simplewalletlog, $Bal - $i)
  289. If StringInStr($Bal, "balance:") Then
  290. ExitLoop
  291. EndIf
  292. If $e > 10 Then
  293. $Bal = "0"
  294. ExitLoop
  295. EndIf
  296. $e = $e + 1
  297. $i = $i + 1
  298. WEnd
  299. $BalanceLeft = StringInStr($Bal, "balance:")
  300. $Balance = StringTrimLeft($Bal, $BalanceLeft + 8)
  301. ConsoleWrite($Balance & @CRLF)
  302. $BalRight = StringInStr($Balance, ",")
  303. $Balance = StringLeft($Balance, $BalRight - 1)
  304. ConsoleWrite($Balance & @CRLF)
  305. GUICtrlSetData($lBalance, "Balance: " & $Balance)
  306. $UnconfLeft = StringInStr($Bal, "balance:", 0, 2)
  307. $Unconf = StringTrimLeft($Bal, $UnconfLeft + 8)
  308. $Unconf = $Balance - $Unconf
  309. GUICtrlSetData($lUnconfirmed, "Unconfirmed: " & $Unconf)
  310.  
  311. GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")
  312. ;Do
  313. ;Until GUIGetMsg() = $GUI_EVENT_CLOSE
  314. While 1
  315. Switch GUIGetMsg()
  316. Case $GUI_EVENT_CLOSE
  317. If $about > 0 Then
  318. GUIDelete($aGUI)
  319. $about = 0
  320. _Overview()
  321. Else
  322. ConsoleWrite($about & @CRLF)
  323. ExitLoop
  324. EndIf
  325. EndSwitch
  326. WEnd
  327.  
  328. EndFunc
  329.  
  330. Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam)
  331. #forceref $hWnd, $iMsg, $lParam
  332. Switch _WinAPI_LoWord($wParam)
  333. Case $e_idBU
  334. _Backup()
  335. Case $e_idExit
  336. _Exit()
  337. Case $e_idAbout
  338. _About()
  339. Case $e_idConsole
  340. _Console()
  341. Case $bOverview
  342. _Overview()
  343. Case $bRefresh
  344. _Refresh()
  345. Case $bSend
  346. _Send()
  347. Case $bPay
  348. _Pay()
  349. Case $bReceive
  350. _Receive()
  351. Case $bTransactions
  352. _Transactions()
  353. Case $bAddresses
  354. _Addresses()
  355. Case $bAdd
  356. _Add()
  357. Case $bMine
  358. _Mine()
  359. Case $bStart
  360. _Start()
  361. Case $bEnd
  362. _End()
  363. EndSwitch
  364. Return $GUI_RUNDEFMSG
  365. EndFunc
  366.  
  367. Func _Refresh()
  368. $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
  369. $bitmonorod = WinGetHandle(@ScriptDir & "\bitmonerod.exe", "")
  370. ControlSend($simplewallet,"","","refresh" & @CRLF)
  371. _Overview()
  372.  
  373. EndFunc
  374.  
  375. Func _Backup()
  376. ConsoleWrite("you are in backup" & @CRLF)
  377. EndFunc
  378.  
  379. Func _Exit()
  380. ConsoleWrite("you are in exit" & @CRLF)
  381. $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
  382. $bitmonorod = WinGetHandle(@ScriptDir & "\bitmonerod.exe", "")
  383. ControlSend($simplewallet,"","","exit" & @CRLF)
  384. ControlSend($bitmonorod,"","","exit" & @CRLF)
  385. While ProcessExists("bitmonerod.exe")
  386. Sleep(1000)
  387. WEnd
  388. While ProcessExists("simplewallet.exe")
  389. Sleep(1000)
  390. WEnd
  391.  
  392. Exit
  393. EndFunc
  394.  
  395. Func _About()
  396. ConsoleWrite("you are in about" & @CRLF)
  397. $about = 1
  398. $aGUI = GUICreate("About", 420, 220)
  399. GUISetFont(8, 400, 0, "Tahoma")
  400. GUISetBkColor(0x464646)
  401. $eAbout = GUICtrlCreateEdit("Monero GUI Wallet Version 0.1" & @CRLF & "----------------------------------" & @CRLF & "Nov 25 2014" & @CRLF & "todo: Backup, Exitscreen, Get passphrase, Auto updates, First Setup, Console" & @CRLF & "by Farianman", 10, 10, 400, 200,$ES_READONLY,$WS_EX_TOOLWINDOW)
  402. GUISetState(@SW_SHOW)
  403. EndFunc
  404.  
  405. Func _Overview()
  406. ConsoleWrite("you are in overview" & @CRLF)
  407. GUICtrlSetState($lWallet, $GUI_SHOW)
  408. GUICtrlSetState($lBalance, $GUI_SHOW)
  409. GUICtrlSetState($lUnconfirmed, $GUI_SHOW)
  410. GUICtrlSetState($lRecent, $GUI_SHOW)
  411. GUICtrlSetState($bRefresh, $GUI_SHOW)
  412.  
  413. GUICtrlSetState($lPayto, $GUI_HIDE)
  414. GUICtrlSetState($lAmount, $GUI_HIDE)
  415. GUICtrlSetState($bPay, $GUI_HIDE)
  416. GUICtrlSetState($iPayto, $GUI_HIDE)
  417. GUICtrlSetState($iAmount, $GUI_HIDE)
  418. GUICtrlSetState($lStatus, $GUI_HIDE)
  419.  
  420. GUICtrlSetState($lAddress, $GUI_HIDE)
  421. GUICtrlSetState($iAddress, $GUI_HIDE)
  422.  
  423. GUICtrlSetState($bAdd, $GUI_HIDE)
  424.  
  425. _GUICtrlTable_Delete($tTrans)
  426. _GUICtrlTable_Delete($tAddy)
  427.  
  428. GUICtrlSetState($bStart, $GUI_HIDE)
  429. GUICtrlSetState($bEnd, $GUI_HIDE)
  430. GUICtrlSetState($lMiningStatus, $GUI_HIDE)
  431. GUICtrlSetState($lPool, $GUI_HIDE)
  432. GUICtrlSetState($lHashrate, $GUI_HIDE)
  433. GUICtrlSetState($lMoneroMade, $GUI_HIDE)
  434.  
  435. GUICtrlSetState($eConsole, $GUI_HIDE)
  436.  
  437. FileOpen($moneroguilog, 10)
  438. $TransLN = _FileCountLines($simplewalletlog)
  439. If $TransLN > 100 Then
  440. $TransLN = 100
  441. EndIf
  442. If FileReadLine($moneroguilog, 1) = "" Then
  443. For $y = 0 to $TransLN Step 1
  444. $Trans = FileReadLine($simplewalletlog, $y)
  445. If StringInStr($Trans, "received") and StringInStr($Trans, "transaction") Then
  446. FileWrite($moneroguilog, $Trans & @CRLF)
  447. EndIf
  448. If StringInStr($Trans, "spent") and StringInStr($Trans, "transaction") Then
  449. FileWrite($moneroguilog, $Trans & @CRLF)
  450. EndIf
  451. Next
  452. EndIf
  453. $lines = _FileCountLines($moneroguilog)
  454. $Recent = FileReadLine($moneroguilog, $lines)
  455. GUICtrlSetData($lRecent, "Recent: " & $Recent)
  456.  
  457. $x = 0
  458. $e = 0
  459. While 1
  460. If $x > 10 Then $x = 0
  461. $State = _FileCountLines($bitmonorodlog)
  462. $State = FileReadLine($bitmonorodlog, $State - $x)
  463. If StringInStr($State, "behind") Or StringInStr($State, "SYNCHRONIZED OK") Then
  464. If StringInStr($State, "behind") Then
  465. If StringInStr($State, "behind") Then
  466. $BehindLeft = StringInStr($State, "blocks")
  467. $Behind = StringTrimLeft($State, $BehindLeft + 7)
  468. $BehindRight = StringInStr($Behind, "behind")
  469. $Behind = StringLeft($Behind, $BehindRight - 3)
  470. $State = "Out of sync (" & $Behind & ")"
  471. GUICtrlSetColor($lWallet, $COLOR_RED)
  472. ExitLoop
  473. EndIf
  474. GUICtrlSetColor($lWallet, $COLOR_RED)
  475. ExitLoop
  476. EndIf
  477. If StringInStr($State, "SYNCHRONIZED OK") Then
  478. $State = "Synchronized"
  479. GUICtrlSetColor($lWallet, $COLOR_GREEN)
  480. ExitLoop
  481. EndIf
  482. EndIf
  483. If $e > 10 Then
  484. $State = "Unknown"
  485. ExitLoop
  486. EndIf
  487. $e = $e + 1
  488. $x = $x + 1
  489. WEnd
  490. GUICtrlSetData($lWallet, "Wallet: " & $State)
  491.  
  492. $i = 0
  493. $e = 0
  494. While 1
  495. If $i > 10 Then $i = 0
  496. $Bal = _FileCountLines($simplewalletlog)
  497. If $Bal > 500 Then
  498. $Bal = 500
  499. EndIf
  500. $Bal = FileReadLine($simplewalletlog, $Bal - $i)
  501. ConsoleWrite($Bal & @CRLF)
  502. If StringInStr($Bal, "balance:") Then
  503. ExitLoop
  504. EndIf
  505. If $e > 10 Then
  506. $Bal = "0"
  507. ExitLoop
  508. EndIf
  509. $e = $e + 1
  510. $i = $i + 1
  511. WEnd
  512. $BalanceLeft = StringInStr($Bal, "balance:")
  513. $Balance = StringTrimLeft($Bal, $BalanceLeft + 8)
  514. ConsoleWrite($Balance & @CRLF)
  515. $BalRight = StringInStr($Balance, ",")
  516. $Balance = StringLeft($Balance, $BalRight - 1)
  517. ConsoleWrite($Balance & @CRLF)
  518. GUICtrlSetData($lBalance, "Balance: " & $Balance)
  519. $UnconfLeft = StringInStr($Bal, "balance:", 0, 2)
  520. $Unconf = StringTrimLeft($Bal, $UnconfLeft + 8)
  521. $Unconf = $Balance - $Unconf
  522. GUICtrlSetData($lUnconfirmed, "Unconfirmed: " & $Unconf)
  523. EndFunc
  524.  
  525. Func _Send()
  526. ConsoleWrite("you are in send" & @CRLF)
  527. GUICtrlSetState($lWallet, $GUI_HIDE)
  528. GUICtrlSetState($lBalance, $GUI_HIDE)
  529. GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
  530. GUICtrlSetState($lRecent, $GUI_HIDE)
  531.  
  532. GUICtrlSetState($lAmount, $GUI_SHOW)
  533. GUICtrlSetState($lPayto, $GUI_SHOW)
  534. GUICtrlSetState($bPay, $GUI_SHOW)
  535. GUICtrlSetState($iPayto, $GUI_SHOW)
  536. GUICtrlSetState($iAmount, $GUI_SHOW)
  537. GUICtrlSetState($lStatus, $GUI_SHOW)
  538.  
  539. GUICtrlSetState($lAddress, $GUI_HIDE)
  540. GUICtrlSetState($iAddress, $GUI_HIDE)
  541.  
  542. GUICtrlSetState($bRefresh, $GUI_HIDE)
  543.  
  544. GUICtrlSetState($bAdd, $GUI_HIDE)
  545.  
  546. _GUICtrlTable_Delete($tTrans)
  547. _GUICtrlTable_Delete($tAddy)
  548.  
  549. GUICtrlSetState($bStart, $GUI_HIDE)
  550. GUICtrlSetState($bEnd, $GUI_HIDE)
  551. GUICtrlSetState($lMiningStatus, $GUI_HIDE)
  552. GUICtrlSetState($lPool, $GUI_HIDE)
  553. GUICtrlSetState($lHashrate, $GUI_HIDE)
  554. GUICtrlSetState($lMoneroMade, $GUI_HIDE)
  555.  
  556. GUICtrlSetState($eConsole, $GUI_HIDE)
  557.  
  558. EndFunc
  559.  
  560. Func _Pay()
  561. ConsoleWrite("you are in pay" & @CRLF)
  562. $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
  563. $bitmonorod = WinGetHandle(@ScriptDir & "\bitmonerod.exe", "")
  564. ControlSend($simplewallet,"","","transfer 3 " & GUICtrlRead($iPayto) & " " & GUICtrlRead($iAmount) & @CRLF)
  565. Sleep(1000)
  566. $Status = _FileCountLines($simplewalletlog)
  567. If $Status > 100 Then
  568. $Status = 100
  569. EndIf
  570. $Status = FileReadLine($simplewalletlog, $Status)
  571. ConsoleWrite($Status & @CRLF)
  572. GUICtrlSetData($lStatus, "Status: " & $Status)
  573. If StringInStr($Status, "Money successfully sent") Then
  574. GUICtrlSetColor($lStatus, $COLOR_GREEN)
  575. Else
  576. GUICtrlSetColor($lStatus, $COLOR_RED)
  577. EndIf
  578. EndFunc
  579.  
  580. Func _Receive()
  581. ConsoleWrite("you are in receive" & @CRLF)
  582. GUICtrlSetState($lAddress, $GUI_SHOW)
  583. GUICtrlSetState($iAddress, $GUI_SHOW)
  584.  
  585. GUICtrlSetState($lWallet, $GUI_HIDE)
  586. GUICtrlSetState($lBalance, $GUI_HIDE)
  587. GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
  588. GUICtrlSetState($lRecent, $GUI_HIDE)
  589.  
  590. GUICtrlSetState($lPayto, $GUI_HIDE)
  591. GUICtrlSetState($lAmount, $GUI_HIDE)
  592. GUICtrlSetState($bPay, $GUI_HIDE)
  593. GUICtrlSetState($iPayto, $GUI_HIDE)
  594. GUICtrlSetState($iAmount, $GUI_HIDE)
  595. GUICtrlSetState($lStatus, $GUI_HIDE)
  596.  
  597. GUICtrlSetState($bRefresh, $GUI_HIDE)
  598.  
  599. GUICtrlSetState($bAdd, $GUI_HIDE)
  600.  
  601. _GUICtrlTable_Delete($tTrans)
  602. _GUICtrlTable_Delete($tAddy)
  603.  
  604. GUICtrlSetState($bStart, $GUI_HIDE)
  605. GUICtrlSetState($bEnd, $GUI_HIDE)
  606. GUICtrlSetState($lMiningStatus, $GUI_HIDE)
  607. GUICtrlSetState($lPool, $GUI_HIDE)
  608. GUICtrlSetState($lHashrate, $GUI_HIDE)
  609. GUICtrlSetState($lMoneroMade, $GUI_HIDE)
  610.  
  611. GUICtrlSetState($eConsole, $GUI_HIDE)
  612.  
  613. $Address = FileRead($simplewalletlog)
  614. $AddressLeft = StringInStr($Address, "Opened wallet:")
  615. If $AddressLeft < 5 Then
  616. $AddressLeft = StringInStr($Address, "ed new wallet:")
  617. EndIf
  618. $Address = StringTrimLeft($Address, $AddressLeft + 14)
  619. $Address = StringLeft($Address, 96)
  620. ConsoleWrite("Your address: " & $Address & @CRLF)
  621. GUICtrlSetData($iAddress, $Address)
  622. EndFunc
  623.  
  624. Func _Transactions()
  625. ConsoleWrite("you are in transactions" & @CRLF)
  626. GUICtrlSetState($lWallet, $GUI_HIDE)
  627. GUICtrlSetState($lBalance, $GUI_HIDE)
  628. GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
  629. GUICtrlSetState($lRecent, $GUI_HIDE)
  630.  
  631. GUICtrlSetState($lPayto, $GUI_HIDE)
  632. GUICtrlSetState($lAmount, $GUI_HIDE)
  633. GUICtrlSetState($bPay, $GUI_HIDE)
  634. GUICtrlSetState($iPayto, $GUI_HIDE)
  635. GUICtrlSetState($iAmount, $GUI_HIDE)
  636. GUICtrlSetState($lStatus, $GUI_HIDE)
  637.  
  638. GUICtrlSetState($lAddress, $GUI_HIDE)
  639. GUICtrlSetState($iAddress, $GUI_HIDE)
  640.  
  641. GUICtrlSetState($bRefresh, $GUI_HIDE)
  642.  
  643. GUICtrlSetState($bAdd, $GUI_HIDE)
  644.  
  645. _GUICtrlTable_Delete($tTrans)
  646. _GUICtrlTable_Delete($tAddy)
  647.  
  648. GUICtrlSetState($bStart, $GUI_HIDE)
  649. GUICtrlSetState($bEnd, $GUI_HIDE)
  650. GUICtrlSetState($lMiningStatus, $GUI_HIDE)
  651. GUICtrlSetState($lPool, $GUI_HIDE)
  652. GUICtrlSetState($lHashrate, $GUI_HIDE)
  653. GUICtrlSetState($lMoneroMade, $GUI_HIDE)
  654.  
  655. GUICtrlSetState($eConsole, $GUI_HIDE)
  656.  
  657. $tTrans = _GUICtrlTable_Create(15, 40, 128, 18, 10, 4, 0)
  658. _GUICtrlTable_Set_RowHeight($tTrans, 1, 35)
  659. _GUICtrlTable_Set_Justify_All($tTrans, 1, 1)
  660. _GUICtrlTable_Set_TextFont_All($tTrans, 8.5, 800, 0, "Tahoma")
  661. _GUICtrlTable_Set_CellColor_Row($tTrans, 1, 0x555555)
  662. _GUICtrlTable_Set_TextColor_All($tTrans, 0x555555)
  663. _GUICtrlTable_Set_TextColor_Row($tTrans, 1, 0xC3B54C)
  664. For $row = 3 To 11 Step 2
  665. _GUICtrlTable_Set_CellColor_Row($tTrans, $row, 0xDDDDDD)
  666. Next
  667.  
  668. _GUICtrlTable_Set_ColumnWidth($tTrans, 1, 145)
  669. _GUICtrlTable_Set_ColumnWidth($tTrans, 2, 50)
  670. _GUICtrlTable_Set_ColumnWidth($tTrans, 3, 460)
  671. _GUICtrlTable_Set_ColumnWidth($tTrans, 4, 155)
  672. _GUICtrlTable_Set_Text_Row($tTrans, 1, "Date|Type|Transaction|Amount")
  673.  
  674. FileOpen($moneroguilog, 10)
  675. $TransLN = _FileCountLines($simplewalletlog)
  676. If $TransLN > 100 Then
  677. $TransLN = 100
  678. EndIf
  679. If FileReadLine($moneroguilog, 1) = "" Then
  680. For $y = 0 to $TransLN Step 1
  681. $Trans = FileReadLine($simplewalletlog, $y)
  682. If StringInStr($Trans, "received") and StringInStr($Trans, "transaction") Then
  683. FileWrite($moneroguilog, $Trans & @CRLF)
  684. EndIf
  685. If StringInStr($Trans, "spent") and StringInStr($Trans, "transaction") Then
  686. FileWrite($moneroguilog, $Trans & @CRLF)
  687. EndIf
  688. Next
  689. EndIf
  690.  
  691. $lines = _FileCountLines($moneroguilog)
  692.  
  693. For $i = 10 To 2 Step - 1
  694. $Type = ""
  695. $Data = FileReadLine($moneroguilog, $lines - $i)
  696. $Date = StringLeft($Data, 20)
  697. ConsoleWrite($Date & @CRLF)
  698. If StringInStr($Data, "received") Then $Type = "In"
  699. If StringInStr($Data, "spent") Then $Type = "Out"
  700. ConsoleWrite($Type & @CRLF)
  701. $TransLeft = StringInStr($Data, "transaction <")
  702. $Trans = StringTrimLeft($Data, $TransLeft + 12)
  703. $TransRight = StringInStr($Trans, ">,")
  704. $Trans = StringLeft($Trans, $TransRight - 1)
  705. ConsoleWrite($Trans & @CRLF)
  706. $Trim = 8
  707. $AmouLeft = StringInStr($Data, "received")
  708. If $AmouLeft = 0 Then
  709. $AmouLeft = StringInStr($Data, "spent")
  710. $Trim = 5
  711. EndIf
  712. $Amou = StringTrimLeft($Data, $AmouLeft + $Trim)
  713. ConsoleWrite($Amou & "|" & $AmouLeft & @CRLF)
  714.  
  715. _GUICtrlTable_Set_Text_Row($tTrans, $i, $Date & "|" & $Type & "|" & $Trans & "|" & $Amou)
  716. Next
  717.  
  718. _GUICtrlTable_Set_Border_Table($tTrans, 0x555555)
  719.  
  720.  
  721. EndFunc
  722.  
  723. Func _Addresses()
  724. ConsoleWrite("you are in addresses" & @CRLF)
  725. GUICtrlSetState($lWallet, $GUI_HIDE)
  726. GUICtrlSetState($lBalance, $GUI_HIDE)
  727. GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
  728. GUICtrlSetState($lRecent, $GUI_HIDE)
  729.  
  730. GUICtrlSetState($lPayto, $GUI_HIDE)
  731. GUICtrlSetState($lAmount, $GUI_HIDE)
  732. GUICtrlSetState($bPay, $GUI_HIDE)
  733. GUICtrlSetState($iPayto, $GUI_HIDE)
  734. GUICtrlSetState($iAmount, $GUI_HIDE)
  735. GUICtrlSetState($lStatus, $GUI_HIDE)
  736.  
  737. GUICtrlSetState($lAddress, $GUI_HIDE)
  738. GUICtrlSetState($iAddress, $GUI_HIDE)
  739.  
  740. GUICtrlSetState($bRefresh, $GUI_HIDE)
  741.  
  742. GUICtrlSetState($bAdd, $GUI_SHOW)
  743.  
  744. _GUICtrlTable_Delete($tTrans)
  745. _GUICtrlTable_Delete($tAddy)
  746.  
  747. GUICtrlSetState($bStart, $GUI_HIDE)
  748. GUICtrlSetState($bEnd, $GUI_HIDE)
  749. GUICtrlSetState($lMiningStatus, $GUI_HIDE)
  750. GUICtrlSetState($lPool, $GUI_HIDE)
  751. GUICtrlSetState($lHashrate, $GUI_HIDE)
  752. GUICtrlSetState($lMoneroMade, $GUI_HIDE)
  753.  
  754. GUICtrlSetState($eConsole, $GUI_HIDE)
  755.  
  756.  
  757. $addyLN = _FileCountLines($addresslist)
  758. ConsoleWrite($addyLN & @CRLF)
  759. $tAddy = _GUICtrlTable_Create(15, 40, 128, 18, $addyLN + 1, 2, 0)
  760. _GUICtrlTable_Set_RowHeight($tAddy, 1, 35)
  761. _GUICtrlTable_Set_Justify_All($tAddy, 1, 1)
  762. _GUICtrlTable_Set_TextFont_All($tAddy, 8.5, 800, 0, "Tahoma")
  763. _GUICtrlTable_Set_CellColor_Row($tAddy, 1, 0x555555)
  764. _GUICtrlTable_Set_TextColor_All($tAddy, 0x555555)
  765. _GUICtrlTable_Set_TextColor_Row($tAddy, 1, 0xC3B54C)
  766. For $row = 3 To $addyLN Step 2
  767. _GUICtrlTable_Set_CellColor_Row($tAddy, $row, 0xDDDDDD)
  768. Next
  769.  
  770. _GUICtrlTable_Set_ColumnWidth($tAddy, 1, 190)
  771. _GUICtrlTable_Set_ColumnWidth($tAddy, 2, 700)
  772. _GUICtrlTable_Set_Text_Row($tAddy, 1, "Label|Address")
  773. _GUICtrlTable_Set_Border_Table($tAddy, 0x555555)
  774.  
  775. For $t = 1 To $addyLN Step 1
  776. $Addy = FileReadLine($addresslist, $t)
  777. ConsoleWrite($Addy & @CRLF)
  778. _GUICtrlTable_Set_Text_Row($tAddy, 1 + $t, $Addy)
  779. Next
  780.  
  781. EndFunc
  782.  
  783. Func _Add()
  784. $Label = InputBox("Label", "Please provide a contact label", "", "", 250, 130)
  785. $Addy = InputBox("Address", "Please provide a contact address", "", "", 250, 130)
  786. $Write = $Label & "|" & $Addy & @CRLF
  787. FileWrite($addresslist, $Write)
  788. _Addresses()
  789. EndFunc
  790.  
  791. Func _Mine()
  792. ConsoleWrite("you are in mine" & @CRLF)
  793. GUICtrlSetState($lWallet, $GUI_HIDE)
  794. GUICtrlSetState($lBalance, $GUI_HIDE)
  795. GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
  796. GUICtrlSetState($lRecent, $GUI_HIDE)
  797.  
  798. GUICtrlSetState($lAmount, $GUI_HIDE)
  799. GUICtrlSetState($lPayto, $GUI_HIDE)
  800. GUICtrlSetState($bPay, $GUI_HIDE)
  801. GUICtrlSetState($iPayto, $GUI_HIDE)
  802. GUICtrlSetState($iAmount, $GUI_HIDE)
  803. GUICtrlSetState($lStatus, $GUI_HIDE)
  804.  
  805. GUICtrlSetState($lAddress, $GUI_HIDE)
  806. GUICtrlSetState($iAddress, $GUI_HIDE)
  807.  
  808. GUICtrlSetState($bRefresh, $GUI_HIDE)
  809.  
  810. GUICtrlSetState($bAdd, $GUI_HIDE)
  811.  
  812. _GUICtrlTable_Delete($tTrans)
  813. _GUICtrlTable_Delete($tAddy)
  814.  
  815. GUICtrlSetState($bStart, $GUI_SHOW)
  816. GUICtrlSetState($bEnd, $GUI_SHOW)
  817. GUICtrlSetState($lMiningStatus, $GUI_SHOW)
  818. GUICtrlSetState($lPool, $GUI_SHOW)
  819. GUICtrlSetState($lHashrate, $GUI_SHOW)
  820. GUICtrlSetState($lMoneroMade, $GUI_HIDE)
  821.  
  822. GUICtrlSetState($eConsole, $GUI_HIDE)
  823.  
  824. If ProcessExists("minerd.exe") Then
  825. GUICtrlSetData($lMiningStatus, "Status: Mining ")
  826. GUICtrlSetColor($lMiningStatus, $COLOR_GREEN)
  827. Else
  828. GUICtrlSetData($lMiningStatus, "Status: Stopped ")
  829. GUICtrlSetColor($lMiningStatus, $COLOR_YELLOW)
  830. EndIf
  831. $Address = FileReadLine($mineconf, 2)
  832. GUICtrlSetData($lHashrate, "Your address: " & $Address)
  833. $URL = FileReadLine($mineconf, 3)
  834. GUICtrlSetData($lPool, "Your pool: " & $URL)
  835.  
  836. EndFunc
  837.  
  838. Func _Start()
  839. ConsoleWrite("you are in start" & @CRLF)
  840.  
  841. If ProcessExists("minerd.exe") Then
  842. MsgBox(0, "Already mining", "You are already mining")
  843. Else
  844.  
  845. If FileExists(@ScriptDir & "\cpuminer\minerd.exe") Then
  846.  
  847. If FileExists($mineconf) Then
  848. $data = FileRead($mineconf)
  849. Else
  850. GUICtrlSetData($lMiningStatus, "Status: Error: minerdconf.txt not found at " & @ScriptDir & "\cpuminer")
  851. GUICtrlSetColor($lMiningStatus, $COLOR_RED)
  852. _Mine()
  853. EndIf
  854.  
  855. $Threads = FileReadLine($mineconf, 1)
  856. If $Threads = "" Then
  857. $Threads = InputBox("Threads", "Home many CPU threads whould you like to mine?", "1", "", 250, 130)
  858. _FileWriteToLine($mineconf, 1, $Threads, 1)
  859. EndIf
  860. $Address = FileReadLine($mineconf, 2)
  861. If $Address = "" Then
  862. $Address = InputBox("Address", "Please provide your address", "49UVJ7trbssXWdRiuhoADB2Ud9i8MtfEtCstP4EcWwP4eohrF3dJYgyHuGsZqKWWwEHNr24i9Hzv66XMUrq8Xkkx9W6spTk", "", 250, 130)
  863. _FileWriteToLine($mineconf, 2, $Address, 1)
  864. EndIf
  865. $URL = FileReadLine($mineconf, 3)
  866. If $URL = "" Then
  867. $URL = InputBox("Pool", "Please provide your pool", "stratum.backup-pool.com:9333", "", 250, 130)
  868. _FileWriteToLine($mineconf, 3, $URL, 1)
  869. EndIf
  870. ConsoleWrite(@ScriptDir & "\cpuminer\minerd.exe -a cryptonight -o stratum+tcp://" & $URL & " -u " & $Address & " -p x -t " & $Threads & @CRLF)
  871. $minerd = Run(@ComSpec & " /c " & @ScriptDir & "\cpuminer\minerd.exe -a cryptonight -o stratum+tcp://" & $URL & " -u " & $Address & " -p x -t " & $Threads, @ScriptDir, @SW_SHOW)
  872.  
  873. Sleep(1000)
  874. If ProcessExists("minerd.exe") Then
  875. GUICtrlSetData($lMiningStatus, "Status: Mining ")
  876. GUICtrlSetColor($lMiningStatus, $COLOR_GREEN)
  877. GUICtrlSetData($lPool, "Your pool: " & $URL)
  878. GUICtrlSetData($lHashrate, "Your address: " & $Address)
  879. EndIf
  880. Else
  881. GUICtrlSetData($lMiningStatus, "Status: Error: cpuminer folder not found at " & @ScriptDir)
  882. GUICtrlSetColor($lMiningStatus, $COLOR_RED)
  883. EndIf
  884. EndIf
  885. EndFunc
  886.  
  887. Func _End()
  888. ConsoleWrite("you are in end" & @CRLF)
  889.  
  890. If ProcessExists("minerd.exe") Then
  891. ProcessClose("minerd.exe")
  892. GUICtrlSetData($lMiningStatus, "Status: Stopped ")
  893. GUICtrlSetColor($lMiningStatus, $COLOR_YELLOW)
  894. Else
  895. GUICtrlSetData($lMiningStatus, "Status: Stopped ")
  896. GUICtrlSetColor($lMiningStatus, $COLOR_YELLOW)
  897. MsgBox(0, "Not mining", "Nothing to stop")
  898. EndIf
  899.  
  900.  
  901.  
  902. EndFunc
  903.  
  904. Func _Console()
  905.  
  906. ConsoleWrite("you are in console" & @CRLF)
  907. GUICtrlSetState($lWallet, $GUI_HIDE)
  908. GUICtrlSetState($lBalance, $GUI_HIDE)
  909. GUICtrlSetState($lUnconfirmed, $GUI_HIDE)
  910. GUICtrlSetState($lRecent, $GUI_HIDE)
  911.  
  912. GUICtrlSetState($lAmount, $GUI_HIDE)
  913. GUICtrlSetState($lPayto, $GUI_HIDE)
  914. GUICtrlSetState($bPay, $GUI_HIDE)
  915. GUICtrlSetState($iPayto, $GUI_HIDE)
  916. GUICtrlSetState($iAmount, $GUI_HIDE)
  917. GUICtrlSetState($lStatus, $GUI_HIDE)
  918.  
  919. GUICtrlSetState($lAddress, $GUI_HIDE)
  920. GUICtrlSetState($iAddress, $GUI_HIDE)
  921.  
  922. GUICtrlSetState($bRefresh, $GUI_HIDE)
  923.  
  924. GUICtrlSetState($bAdd, $GUI_HIDE)
  925.  
  926. _GUICtrlTable_Delete($tTrans)
  927. _GUICtrlTable_Delete($tAddy)
  928.  
  929. GUICtrlSetState($bStart, $GUI_HIDE)
  930. GUICtrlSetState($bEnd, $GUI_HIDE)
  931. GUICtrlSetState($lMiningStatus, $GUI_HIDE)
  932. GUICtrlSetState($lPool, $GUI_HIDE)
  933. GUICtrlSetState($lHashrate, $GUI_HIDE)
  934. GUICtrlSetState($lMoneroMade, $GUI_HIDE)
  935.  
  936. GUICtrlSetState($eConsole, $GUI_SHOW)
  937.  
  938. EndFunc
  939.  
  940. Func _Download()
  941. ConsoleWrite("you are in download" & @CRLF)
  942. $hDownload = InetGet("http://monero.cc/downloads/monero.win.x64.latest.zip", @ScriptDir & "\monero.win.x64.latest.zip", $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
  943. $iSourceSize1 = 2200000
  944. ProgressOn("Downloading monero.win.x64.latest.zip", "This could take some time", "0 percent")
  945. Do
  946. $iDestSize1 = FileGetSize(@ScriptDir & "\monero.win.x64.latest.zip")
  947. $iPercent1 = Int($iDestSize1 / ( $iSourceSize1 / 100))
  948. ProgressSet($iPercent1, $iPercent1 & " percent")
  949. Sleep(200)
  950. Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)
  951. ProgressSet(100 , "Done", "Complete")
  952. Sleep(500)
  953. ProgressOff()
  954. InetClose($hDownload)
  955. ConsoleWrite("The total download size: " & $iSourceSize1 & @CRLF & "The total filesize: " & $iDestSize1 & @CRLF)
  956. MsgBox(0, "Program pause", "Paused until you unzip monero.win.x64.latest.zip into " & @ScriptDir)
  957. While 1
  958. MsgBox(0, "Checking", "Looking for " & @ScriptDir & "\bitmonerod.exe")
  959. If FileExists(@ScriptDir & "\bitmonerod.exe") Then
  960. ExitLoop
  961. EndIf
  962. Sleep(500)
  963. WEnd
  964. MsgBox(0, "Found", "Awesome. Found " & @ScriptDir & "\bitmonerod.exe! Going to first setup")
  965. _FirstSetup()
  966. EndFunc
  967.  
  968. Func _FirstSetup()
  969. ConsoleWrite("you are in firstsetup" & @CRLF)
  970. MsgBox(0, "Welcome", "Welcome to first setup, we will now create wallet.bin")
  971. If ProcessExists("bitmonerod.exe") Then
  972. ConsoleWrite("bitmonero is already running" & @CRLF)
  973. Else
  974. FileDelete(@ScriptDir & "\bitmonerod.log")
  975. If FileExists(@ScriptDir & "\bitmonerod.exe") Then
  976. $ibitonero = Run(@ScriptDir & "\bitmonerod.exe", @ScriptDir, @SW_HIDE)
  977. ConsoleWrite("bitmonero started PID= " & $ibitonero & @CRLF)
  978. Sleep(4000)
  979. Else
  980. $reply = MsgBox(17, "Fatal Error", "bitmonrod.exe not found, click Ok do download latest versions")
  981. If $reply = 1 Then
  982. _Download()
  983. Else
  984. Exit
  985. EndIf
  986. EndIf
  987. EndIf
  988.  
  989. If ProcessExists("simplewallet.exe") Then
  990. ConsoleWrite("simplewallet is already running" & @CRLF)
  991. Else
  992. FileDelete(@ScriptDir & "\simplewallet.log")
  993. If FileExists(@ScriptDir & "\simplewallet.exe") Then
  994. $isimplewallet = Run(@ScriptDir & "\simplewallet.exe --generate-new-wallet wallet.bin", @ScriptDir, @SW_HIDE)
  995. $Password = InputBox("Wallet First Setup", "Please provide your new wallet password", "", "*", 250, 130)
  996. ConsoleWrite("simplewallet started PID= " & $isimplewallet & @CRLF)
  997. $simplewallet = WinGetHandle(@ScriptDir & "\simplewallet.exe", "")
  998. ControlSend($simplewallet,"","", $Password & @CRLF)
  999. Else
  1000. $reply = MsgBox(17, "Fatal Error", "simplewallet.exe not found, click Ok do download latest versions")
  1001. If $reply = 1 Then
  1002. _Download()
  1003. Else
  1004. Exit
  1005. EndIf
  1006. EndIf
  1007. EndIf
  1008. EndFunc
  1009.  
  1010.  
  1011. MoneroGUI()
Advertisement
Add Comment
Please, Sign In to add comment