static void Main() { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); WindowsFormsSynchronizationContext.AutoInstall = false; MainForm = new MainForm(); const string path = "nodes.dat"; if (File.Exists(path)) { using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) { LocalNode.LoadState(fs); } } using (LevelDBBlockchain blockchain = new LevelDBBlockchain(Settings.Default.ChainPath)) using (LocalNode = new LocalNode()) { Blockchain.RegisterBlockchain(blockchain); LocalNode.Start(); Application.Run(MainForm); } using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write)) { LocalNode.SaveState(fs); } }
public static void RegisteBlockChain() { FileStream fss = null; const string PeerStatePath = "peers.dat"; if (File.Exists(PeerStatePath)) { using (fss = new FileStream(PeerStatePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { LocalNode.LoadState(fss); } } using (Blockchain.RegisterBlockchain(new LevelDBBlockchain(Settings.Default.Paths.Chain))) { using (LocalNode = new LocalNode()) { LocalNode.UpnpEnabled = true; MainWindow mainWindow = new MainWindow(); mainWindow.ShowDialog(); App.Current.MainWindow = mainWindow; } } using (FileStream fs = new FileStream(PeerStatePath, FileMode.Create, FileAccess.Write, FileShare.None)) { LocalNode.SaveState(fs); } }
private void Window_Closed(object sender, EventArgs e) { if (isNext == false && isPrev == false) { if (Constant.NotifyMessageMgr != null) { Constant.NotifyMessageMgr.Stop(); } if (Constant.LocalNode != null) { using (FileStream fs = new FileStream(Constant.PEER_STATE_PATH, FileMode.Create, FileAccess.Write, FileShare.None)) { LocalNode.SaveState(fs); } Constant.LocalNode.Dispose(); } if (Blockchain.Default != null) { Blockchain.Default.Dispose(); } } }
static void Main() { if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); #if DEBUG Debug.WriteLine("Wallet starting ..."); //AllocConsole(); #endif XDocument xdoc = null; try { xdoc = XDocument.Load("http://localhost/pure/update/update.xml"); } catch { } if (xdoc != null) { Version version = Assembly.GetExecutingAssembly().GetName().Version; Version minimum = Version.Parse(xdoc.Element("update").Attribute("minimum").Value); if (version < minimum) { using (UpdateWindow dialog = new UpdateWindow(xdoc)) { dialog.ShowDialog(); } return; } } Form startForm; startForm = new MainForm(); if (File.Exists(Constant.PEER_STATE_PATH)) { using (FileStream fs = new FileStream(Constant.PEER_STATE_PATH, FileMode.Open, FileAccess.Read, FileShare.Read)) { LocalNode.LoadState(fs); } } using (Blockchain.RegisterBlockchain(new LevelDBBlockchain("chain"))) using (Constant.LocalNode = new LocalNode()) { Constant.LocalNode.UpnpEnabled = true; Application.Run(startForm); } using (FileStream fs = new FileStream(Constant.PEER_STATE_PATH, FileMode.Create, FileAccess.Write, FileShare.None)) { LocalNode.SaveState(fs); } }
public static void Main() { // Create eventlog.txt for writing event logs to using (StreamWriter sw = File.CreateText("eventlog.txt")) { sw.WriteLine("Event log started at {0}", DateTime.Now.ToString()); sw.WriteLine(); } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); XDocument xdoc = null; try { xdoc = XDocument.Load("https://neo.org/client/update.xml"); } catch { } if (xdoc != null) { Version version = Assembly.GetExecutingAssembly().GetName().Version; Version minimum = Version.Parse(xdoc.Element("update").Attribute("minimum").Value); if (version < minimum) { using (UpdateDialog dialog = new UpdateDialog(xdoc)) { dialog.ShowDialog(); } return; } } if (!InstallCertificate()) { return; } const string PeerStatePath = "peers.dat"; if (File.Exists(PeerStatePath)) { using (FileStream fs = new FileStream(PeerStatePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { LocalNode.LoadState(fs); } } using (Blockchain.RegisterBlockchain(new LevelDBBlockchain(Settings.Default.Paths.Chain))) using (LocalNode = new LocalNode()) { LocalNode.UpnpEnabled = true; Application.Run(MainForm = new MainForm(xdoc)); } using (FileStream fs = new FileStream(PeerStatePath, FileMode.Create, FileAccess.Write, FileShare.None)) { LocalNode.SaveState(fs); } }
public override void WillTerminate(NSNotification notification) { const string PeerStatePath = "peers.dat"; using (FileStream fs = new FileStream(PeerStatePath, FileMode.Create, FileAccess.Write, FileShare.None)) { LocalNode.SaveState(fs); } MainClass mc = new MainClass(); Blockchain.PersistCompleted -= mc.Blockchain_PersistCompleted; mc.ChangeWallet(null); }
public static void Main() { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(true); XDocument xdoc = null; try { xdoc = XDocument.Load(Settings.Default.UpdateUrl); } catch { } if (xdoc != null) { Version version = Assembly.GetExecutingAssembly().GetName().Version; Version minimum = Version.Parse(xdoc.Element("update").Attribute("minimum").Value); if (version < minimum) { //using (UpdateDialog dialog = new UpdateDialog(xdoc)) //{ // dialog.ShowDialog(); //} return; } } if (!InstallCertificate()) { return; } const string PeerStatePath = "peers.dat"; if (File.Exists(PeerStatePath)) { using (FileStream fs = new FileStream(PeerStatePath, FileMode.Open, FileAccess.Read, FileShare.Read)) { LocalNode.LoadState(fs); } } using (Blockchain.RegisterBlockchain(new LevelDBBlockchain(Settings.Default.DataDirectoryPath))) using (LocalNode = new LocalNode()) { LocalNode.UpnpEnabled = true; Application.Run(MainForm = new MainForm(xdoc)); } using (FileStream fs = new FileStream(PeerStatePath, FileMode.Create, FileAccess.Write, FileShare.None)) { LocalNode.SaveState(fs); } }
public static void Save() { try { using (var fileStream = new FileStream(PeerStatePath, FileMode.Create, FileAccess.Write, FileShare.None)) { LocalNode.SaveState(fileStream); } } catch { // Swallow exception // TODO Log exception somewhere } }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (isLogOut) { Constant.CurrentWallet.Dispose(); Constant.NotifyMessageMgr.Stop(); } else { Constant.CurrentWallet.Dispose(); Constant.NotifyMessageMgr.Stop(); using (FileStream fs = new FileStream(Constant.PEER_STATE_PATH, FileMode.Create, FileAccess.Write, FileShare.None)) { LocalNode.SaveState(fs); } Constant.LocalNode.Dispose(); Blockchain.Default.Dispose(); } }
static void Main() { if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); XDocument xdoc = null; try { xdoc = XDocument.Load("http://13.230.62.42/quras/update/update.xml"); } catch { } if (xdoc != null) { Version version = Assembly.GetExecutingAssembly().GetName().Version; Version minimum = Version.Parse(xdoc.Element("update").Attribute("minimum").Value); if (version < minimum) { using (UpdateWindow dialog = new UpdateWindow(xdoc)) { dialog.ShowDialog(); if (dialog.DialogResult != DialogResult.Cancel) { return; } } } } SplashForm splash = new SplashForm(); splash.Show(); Application.DoEvents(); int zkSnarksKeyStatus = Global.Utils.CheckZKSnarksKeyStatus(); splash.Hide(); if (zkSnarksKeyStatus != 0) { using (DownloadKeyForm dialog = new DownloadKeyForm(zkSnarksKeyStatus)) { dialog.ShowDialog(); if (dialog.DialogResult == DialogResult.Cancel) { return; } } } Form startForm; startForm = new WelcomeForm(); /* * if (Settings.Default.LastWalletPath.Length == 0) * { * startForm = new WelcomeForm(); * } * else * { * startForm = new RestoreWalletForm(); * } */ FormManager.GetInstance().Push(startForm); if (File.Exists(Constant.PEER_STATE_PATH)) { using (FileStream fs = new FileStream(Constant.PEER_STATE_PATH, FileMode.Open, FileAccess.Read, FileShare.Read)) { LocalNode.LoadState(fs); } } using (Blockchain.RegisterBlockchain(new LevelDBBlockchain("chain"))) using (Constant.LocalNode = new LocalNode()) { Constant.LocalNode.UpnpEnabled = true; Application.Run(startForm); } using (FileStream fs = new FileStream(Constant.PEER_STATE_PATH, FileMode.Create, FileAccess.Write, FileShare.None)) { LocalNode.SaveState(fs); } }