Exemplo n.º 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);
     }
 }
Exemplo n.º 2
0
 internal RemoteNode(LocalNode localNode, TcpClient tcp)
 {
     this.localNode = localNode;
     this.tcp = tcp;
     OnConnected();
 }
Exemplo n.º 3
0
 internal RemoteNode(LocalNode localNode, IPEndPoint remoteEndpoint)
 {
     this.localNode = localNode;
     this.tcp = new TcpClient(remoteEndpoint.Address.IsIPv4MappedToIPv6 ? AddressFamily.InterNetwork : remoteEndpoint.AddressFamily);
     this.RemoteEndpoint = remoteEndpoint;
 }
Exemplo n.º 4
0
 internal RemoteNode(LocalNode localNode, TcpClient tcp)
 {
     this.localNode = localNode;
     this.tcp       = tcp;
     OnConnected();
 }
Exemplo n.º 5
0
 internal RemoteNode(LocalNode localNode, IPEndPoint remoteEndpoint)
 {
     this.localNode      = localNode;
     this.tcp            = new TcpClient(remoteEndpoint.Address.IsIPv4MappedToIPv6 ? AddressFamily.InterNetwork : remoteEndpoint.AddressFamily);
     this.RemoteEndpoint = remoteEndpoint;
 }