static void Main(string[] args) { if (string.IsNullOrEmpty(ConfigurationManager.AppSettings["HashFile"])) { AddUpdateAppSettings("HashFile", "c:/wamp/www/walletd.php"); AddUpdateAppSettings("Daemon", "c:/turtlecoin/turtlecoind.exe"); AddUpdateAppSettings("Wallet", "c:/turtlecoin/walletd.exe"); AddUpdateAppSettings("WalletFile", "c:/turtlecoin/webwallet.wallet"); AddUpdateAppSettings("WalletPassword", "f9suS49ITw3t9jf9sjDFS94jw98FDS3j59DFGSDF2htfdsfgBDFrwfks"); } else { TurtleCoin _session = new TurtleCoin(); _session.Daemon.RefreshRate = 5000; _session.Wallet.RefreshRate = 5000; _session.Daemon.OnUpdate += DaemonUpdate; _session.Wallet.OnUpdate += WalletUpdate; _session.Daemon.Error += DaemonError; _session.Wallet.Error += WalletError; _session.Daemon.Log += DaemonLog; _session.Wallet.Log += WalletLog; _session.Wallet.OnConnect += WalletConntect; _session.Daemon.InitializeAsync(ConfigurationManager.AppSettings["Daemon"], 11898); _session.Daemon.BeginUpdateAsync(); _session.Wallet.CreateOrInitializeAsync(_session.Daemon, ConfigurationManager.AppSettings["Wallet"], ConfigurationManager.AppSettings["WalletFile"], ConfigurationManager.AppSettings["WalletPassword"], 12321); _session.Wallet.BeginUpdateAsync(); Console.WriteLine("Press any key to save sync progress and exit."); Console.ReadKey(); _session.Exit(true); } }
private static void WalletConntect(object sender, EventArgs e) { string PHP = "<?php \r\n" + " define(\"WALLET_PASSWORD\", \"" + TurtleCoin.EncodeString((sender as Wallet).Hash) + "\");\r\n" + " define(\"WALLET_URL\", \"http://" + (sender as Wallet).Address + ":" + (sender as Wallet).Port + "/json_rpc\");\r\n" + "?>"; File.WriteAllText(ConfigurationManager.AppSettings["HashFile"], PHP); }
public async void Run() { // Create a new session _session = new TurtleCoin(); _session.Daemon.RefreshRate = 5000; _session.Wallet.RefreshRate = 5000; // Assign daemon event handlers _session.Daemon.Log += DaemonLog; _session.Daemon.Error += Error; _session.Daemon.OnConnect += OnDaemonConnect; _session.Daemon.OnSynced += OnDaemonSynced; _session.Daemon.OnUpdate += OnDaemonUpdate; _session.Daemon.OnDisconnect += OnDaemonDisconnect; // Assign wallet event handlers _session.Wallet.Log += WalletLog; _session.Wallet.Error += Error; _session.Wallet.OnConnect += OnWalletConnect; _session.Wallet.OnSynced += OnWalletSynced; _session.Wallet.OnUpdate += OnWalletUpdate; _session.Wallet.OnDisconnect += OnWalletDisconnect; // Initialize daemon await _session.Daemon.InitializeAsync("c:/turtlecoin/turtlecoind.exe", 11898); // Begin daemon update loop await _session.Daemon.BeginUpdateAsync(); // Initialize wallet, creating container if it doesn't exist await _session.Wallet.CreateOrInitializeAsync(_session.Daemon, "c:/turtlecoin/walletd.exe", "c:/turtlecoin/testwallet.wallet", "12345"); // Begin wallet update loop await _session.Wallet.BeginUpdateAsync(); // Await input to exit session Console.ReadLine(); // Clean up session, force an exit await _session.Exit(true); // Await key press to close Console.WriteLine("Press any key to close"); Console.ReadKey(); }
public async void Run(string path, string pw, bool remote, string remoteurl, int remoteport) { // Create a new session TRTL = new TurtleCoin(); TRTL.Daemon.RefreshRate = 5000; TRTL.Wallet.RefreshRate = 5000; // Assign daemon event handlers TRTL.Daemon.Log += DaemonLog; TRTL.Daemon.Error += Error; TRTL.Daemon.OnConnect += OnDaemonConnect; TRTL.Daemon.OnSynced += OnDaemonSynced; TRTL.Daemon.OnDisconnect += OnDaemonDisconnect; // Assign wallet event handlers TRTL.Wallet.Log += WalletLog; TRTL.Wallet.Error += Error; TRTL.Wallet.OnConnect += OnWalletConnect; TRTL.Wallet.OnSynced += OnWalletSynced; TRTL.Wallet.OnUpdate += Updateui; TRTL.Wallet.OnDisconnect += OnWalletDisconnect; // Initialize daemon if (remote) { await TRTL.Daemon.InitializeAsync(remoteurl, remoteport); } else { await TRTL.Daemon.InitializeAsync(Turtle.root + @"\Binaries\TurtleCoind.exe", 11898); } // Begin daemon update loop await TRTL.Daemon.BeginUpdateAsync(); // Initialize wallet await TRTL.Wallet.InitializeAsync(TRTL.Daemon, Turtle.root + @"\Binaries\turtle-service.exe", path, pw); // Begin wallet update loop await TRTL.Wallet.BeginUpdateAsync(); init = true; }