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