Exemple #1
0
 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);
     }
 }