public Form4() { InitializeComponent(); rsa.AssignNewKey(); string subKey = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion"; RegistryKey key = Microsoft.Win32.Registry.LocalMachine; RegistryKey skey = key.OpenSubKey(subKey); string name = skey.GetValue("ProductName").ToString(); string releaseId = skey.GetValue("ReleaseId").ToString(); lb_osInfo.Text = name + " " + releaseId + (Environment.Is64BitOperatingSystem ? " 64-bit" : " 32-bit"); if (File.Exists("data.blc")) { chain.LoadFile("data.blc"); for (int i = 0; i < chain.Blocks.Count; i++) { nBlock++; cb_blockList.Items.Add("Block " + (i + 1).ToString()); } lb_blockName.Text = "Block " + (nBlock + 1).ToString(); cb_blockList.SelectedIndex = cb_blockList.Items.Count - 1; cacheBlock = new Block(nBlock); } }
public Form1() { InitializeComponent(); rsa.AssignNewKey(); if (File.Exists("Blockchain.txt")) { chain.LoadFile("Blockchain.txt"); for (int i = 0; i < chain.Blocks.Count; i++) { nBlock++; cb_blockList.Items.Add("Block " + (i + 1).ToString()); } txt_nameBlock.Text = "Block " + (nBlock + 1).ToString(); cb_blockList.SelectedIndex = cb_blockList.Items.Count - 1; cacheBlock = new Block(nBlock); } }
private void btn_importBlockchain_Click(object sender, EventArgs e) { if (ofd_importBlockchain.ShowDialog() == System.Windows.Forms.DialogResult.OK) { chain = new BlockChain(); chain.LoadFile(ofd_importBlockchain.FileName); cb_blockList.Items.Clear(); dtg_inTransactions.Rows.Clear(); dtg_outTransactions.Rows.Clear(); nBlock = 0; for (int i = 0; i < chain.Blocks.Count; i++) { nBlock++; cb_blockList.Items.Add("Block " + (i + 1).ToString()); } txt_nameBlock.Text = "Block " + (nBlock + 1).ToString(); cb_blockList.SelectedIndex = cb_blockList.Items.Count - 1; cacheBlock = new Block(nBlock); } }