/// <summary> /// Test a generic key generation with 5 parameters 5-5-5-5-5 /// </summary> [Test] public void Test15_Gen5DisParB16Bit55555() { int lopcnt; try { GenerateKey gkey; string finalkey; string result; for (lopcnt = 1; lopcnt < 30; lopcnt++) { gkey = new GenerateKey(); gkey.LicenseTemplate = "vvvvvvvvppppxxxxxxxx-wwwwxxxxxxxxxxxxxxxx-ssssssssxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxrrrr"; gkey.MaxTokens = 5; gkey.AddToken(0, "v", LicenseKey.GenerateKey.TokenTypes.NUMBER, "14"); gkey.AddToken(1, "p", LicenseKey.GenerateKey.TokenTypes.NUMBER, "2"); gkey.AddToken(2, "w", LicenseKey.GenerateKey.TokenTypes.NUMBER, "6"); gkey.AddToken(3, "s", LicenseKey.GenerateKey.TokenTypes.NUMBER, "BC"); gkey.AddToken(4, "r", LicenseKey.GenerateKey.TokenTypes.NUMBER, "5"); gkey.UseBase10 = false; gkey.UseBytes = false; gkey.CreateKey(); finalkey = gkey.GetLicenseKey(); if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4) / 4)) { throw new Exception("Keys are not the same length"); } result = gkey.DisassembleKey("v"); if (result != "14") { throw new Exception("The first tokens are not equal"); } result = gkey.DisassembleKey("p"); if (result != "2") { throw new Exception("The second tokens are not equal"); } result = gkey.DisassembleKey("w"); if (result != "6") { throw new Exception("The third tokens are not equal"); } result = gkey.DisassembleKey("s"); if (result != "BC") { throw new Exception("The third tokens are not equal"); } result = gkey.DisassembleKey("r"); if (result != "5") { throw new Exception("The third tokens are not equal"); } } } catch (Exception e) { Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message); } }
/// <summary> /// Test a generic key generation with 2 parameters 5-5-5-5-5 /// </summary> [Test] public void Test10_Gen3ParB16Bit55555() { int lopcnt; try { GenerateKey gkey; string finalkey; for (lopcnt = 1; lopcnt < 30; lopcnt++) { gkey = new GenerateKey(); gkey.LicenseTemplate = "vvvvppppxxxxxxxxxxxx-wwwwwwwwxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx"; gkey.MaxTokens = 3; gkey.AddToken(0, "v", LicenseKey.GenerateKey.TokenTypes.NUMBER, "1"); gkey.AddToken(1, "p", LicenseKey.GenerateKey.TokenTypes.NUMBER, "2"); gkey.AddToken(2, "w", LicenseKey.GenerateKey.TokenTypes.CHARACTER, "QR"); gkey.UseBase10 = false; gkey.UseBytes = false; gkey.CreateKey(); finalkey = gkey.GetLicenseKey(); if ((finalkey.Length - 4) != ((gkey.LicenseTemplate.Length - 4) / 4)) { throw new Exception("Keys are not the same length"); } } } catch (Exception e) { Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message); } }
/// <summary> /// Test a generic key generation with no parameters 8-4-8-4 /// </summary> [Test] public void Test02_GenNoParB10Byt8484() { int lopcnt; try { GenerateKey gkey; string finalkey; for (lopcnt = 1; lopcnt < 30; lopcnt++) { gkey = new GenerateKey(); gkey.LicenseTemplate = "xxxxxxxx-xxxx-xxxxxxxx-xxxx"; gkey.MaxTokens = 0; gkey.UseBase10 = true; gkey.UseBytes = true; gkey.CreateKey(); finalkey = gkey.GetLicenseKey(); if (finalkey.Length != gkey.LicenseTemplate.Length) { throw new Exception("Keys are not the same length"); } } } catch (Exception e) { Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message); } }
private void button1_Click(object sender, EventArgs e) { GenerateKey gkey; //gkey = new GenerateKey(); //gkey.LicenseTemplate = "xxxxxxxx-xxxx-xxxxxxxx-xxxx"; //gkey.MaxTokens = 0; //gkey.UseBase10 = true; //gkey.UseBytes = true; //gkey.CreateKey(); gkey = new GenerateKey(); gkey.LicenseTemplate = "vvvvvvvvppppxxxxxxxx-wwwwxxxxxxxxxxxxxxxx-ssssssssxxxxxxxxxxxx-xxxxxxxxxxxxcccccccc-xxxxxxxxxxxxxxxxrrrr"; gkey.MaxTokens = 5; gkey.ChecksumAlgorithm = Checksum.ChecksumType.Type1; gkey.AddToken(0, "v", LicenseKey.GenerateKey.TokenTypes.NUMBER, "34"); gkey.AddToken(1, "p", LicenseKey.GenerateKey.TokenTypes.NUMBER, "6"); gkey.AddToken(2, "w", LicenseKey.GenerateKey.TokenTypes.NUMBER, "8"); gkey.AddToken(3, "s", LicenseKey.GenerateKey.TokenTypes.CHARACTER, "ab"); gkey.AddToken(4, "r", LicenseKey.GenerateKey.TokenTypes.NUMBER, "3"); gkey.UseBase10 = false; gkey.UseBytes = false; gkey.CreateKey(); MessageBox.Show(gkey.GetLicenseKey()); }
public static void Run() { lock (_lock_session) { foreach (GameSession session in m_DicSession.Values) { byte[] retData = session.m_GamePack.GetData(); if (retData != null) { PackIn packin = new PackIn(retData); ushort tag = packin.ReadUInt16(); switch (tag) { case PacketProtoco.C_LOGINGAME: { packin.ReadUInt32(); int _key = 0, _key2 = 0; GenerateKey.GenerateKey_(ref _key, ref _key2); //取封包帐号- 发给dbserver byte[] bAccount = packin.ReadBuff(16); String account = Coding.GetDefauleCoding().GetString(bAccount); GameBase.Network.Internal.QueryRole query = new GameBase.Network.Internal.QueryRole(session.gameid, _key, _key2, bAccount); mTcpClient.SendData(query.GetBuffer()); Log.Instance().WriteLog("帐号登录!" + account); break; } } } } } }
/// <summary> /// Test a generic key generation with no parameters 5-5-5-5-5 /// </summary> [Test] public void Test06_Gen2ParB16Byt55555() { int lopcnt; try { GenerateKey gkey; string finalkey; for (lopcnt = 1; lopcnt < 30; lopcnt++) { gkey = new GenerateKey(); gkey.LicenseTemplate = "vvxxx-xxxxx-ppxxx-xxxxx-xxxxx"; gkey.MaxTokens = 2; gkey.AddToken(0, "v", LicenseKey.GenerateKey.TokenTypes.NUMBER, "12"); gkey.AddToken(1, "p", LicenseKey.GenerateKey.TokenTypes.NUMBER, "23"); gkey.UseBase10 = false; gkey.UseBytes = true; gkey.CreateKey(); finalkey = gkey.GetLicenseKey(); if (finalkey.Length != gkey.LicenseTemplate.Length) { throw new Exception("Keys are not the same length"); } } } catch (Exception e) { Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message); } }
/// <summary> /// Permet de sauvegarder les données en DB à partir d'un requête et d'un dictionnaire contenant le nom des paramètres (Key) et sa valeur (value) /// <code> /// string query = "INSERT INTO [MedicoDB].[dbo].[Medecin] /// ([INAMI] /// ,[FKIdUtilisateur]) /// VALUES /// (@INAMI,@FKIdUtilisateur)"; /// /// //les données a insérer dans un dictionnaire /// Dictionary<string, object> valeurs = new Dictionary<string, object>(); /// valeurs.Add("INAMI", this.INAMI); /// valeurs.Add("FKIdUtilisateur", this.IdUtilisateur); //idUtilisateur est récupéré du parent qui a été préalablement enregistré /// /// //Sauvegarde via la classe globale de gestion de données /// if (GestionConnexion.Instance.saveData(query, GenerateKey.APP, valeurs)) /// { /// return true; /// } /// else /// { /// return false; /// } /// </code> /// </summary> /// <param name="Query">Requête parametrée exemp: insert into table values (@champ)</param> /// <param name="gen">Permet de spécifier si la clé primaire est autogénéré ou pas. Si elle est autogénéré, on ne ferme pas la connexion pour permettre l'appel /// à la fonction getLastGenerateId /// </param> /// <param name="valeurs">Dictionnaire contenant le nom des paramètres (Key) et leur valeur (value)</param> /// <returns>True si la requête a pu s'effectuer</returns> public bool saveData(string Query, GenerateKey gen, Dictionary <string, object> valeurs) { if (connectDb()) { //parcours des valeurs et ajout comme pramètre dans la commande foreach (KeyValuePair <string, object> item in valeurs) { SqlParameter param = new SqlParameter(item.Key, item.Value); //Création d'un paramètre pour la commande _oCom.Parameters.Add(param); //ajout du paramètre à la commande } _oCom.CommandText = Query; //Attribution de la requête à la commande try { _oCom.ExecuteNonQuery(); if (gen == GenerateKey.APP) { _oConn.Close(); //Si nous sommes face à une clé non générée par la DB on ferme la connexion } return(true); } catch (Exception) { _oConn.Close(); return(false); } } else { return(false); } }
public static int RunGenerate(GenerateKey GenerateKeyOpts) { // Checks int inError = 0; StringBuilder errMsgText = new StringBuilder(); try { using (FileStream tfs = File.OpenWrite(GenerateKeyOpts.KeyFile)) { } } catch (UnauthorizedAccessException) { inError = 2; errMsgText.Append($"- Unable to open output file, '{GenerateKeyOpts.KeyFile}', for writting\n"); } catch (DirectoryNotFoundException) { inError = 3; errMsgText.Append($"- Directory not found, cannot create output file: '{GenerateKeyOpts.KeyFile}'\n"); } catch (Exception ex) { inError = 9; errMsgText.Append($"- Unknown error encountered:\n{ex.Message}\n"); } if (GenerateKeyOpts.Password.Trim() == string.Empty) { inError = 4; errMsgText.Append($"- Provided password value is empty or contains only whitespace\n"); } if (inError > 0) { Console.Write($"\nThere is a problem with the provided parameters:\n\n{errMsgText.ToString()}\n\n"); return(inError); } // Work FileInfo generateFile = new FileInfo(GenerateKeyOpts.KeyFile); bool result = GenerateSecureKey.Generate(GenerateKeyOpts.Password, generateFile); if (!result) { Console.Write($"\nUnable to generate secure key."); return(5); } if (File.Exists(GenerateKeyOpts.KeyFile) && new FileInfo(GenerateKeyOpts.KeyFile).Length > 10) { Console.Write($"\nKey, {GenerateKeyOpts.KeyFile}, created successfully!\n"); return(0); } else { Console.Write($"\nKey, {GenerateKeyOpts.KeyFile}, creation failed!\n"); return(-1); } }
static void Main(string[] args) { //日志路径 Log.Instance().Init("./LogicServer"); //异常 GameBase.Core.GlobalException.InitException(); MemIniFile ini = new MemIniFile(); if (!ini.LoadFromFile(TextDefine.GoldConfig)) { return; } m_DicSession = new Dictionary <Socket, GameBase.Network.GameSession>(); m_DicSession.Clear(); String sIP = ini.ReadValue(TextDefine.LogicServerSection, TextDefine.NormalIPKey, TextDefine.NormalIP); int nPort = ini.ReadValue(TextDefine.LogicServerSection, TextDefine.NormalPortKey, TextDefine.LoginServerPort); m_Key = ini.ReadValue(TextDefine.GlobalSection, TextDefine.EncodeKey, System.Environment.TickCount); m_Key2 = ini.ReadValue(TextDefine.GlobalSection, TextDefine.EncodeKey2, System.Environment.TickCount); m_GameServerIP = ini.ReadValue(TextDefine.GameServerSetion, TextDefine.NormalIPKey, TextDefine.NormalIP); m_GameServerPort = ini.ReadValue(TextDefine.GameServerSetion, TextDefine.NormalPortKey, TextDefine.GameServerPort); server = new TcpServer(); server.onConnect += new TcpServerEvent.OnConnectEventHandler(OnConnect); server.onReceive += new TcpServerEvent.OnReceiveEventHandler(OnReceive); server.onClose += new TcpServerEvent.OnCloseEventHandler(OnClose); if (!server.Start(sIP, nPort)) { Console.WriteLine("start server error!"); return; } //连接dbserver mDBPacket = new InternalPacket(); GenerateKey.Init(m_Key, m_Key2); sIP = ini.ReadValue(TextDefine.DBServerSestion, TextDefine.NormalIPKey, TextDefine.NormalIP); nPort = ini.ReadValue(TextDefine.DBServerSestion, TextDefine.NormalPortKey, TextDefine.DBServerPort); mTcpClient = new GameBase.Network.TcpClient(); mTcpClient.onConnect += new TcpClientEvent.OnConnectEventHandler(OnDBConnect); mTcpClient.onReceive += new TcpClientEvent.OnReceiveEventHandler(OnDBReceive); mTcpClient.onClose += new TcpClientEvent.OnCloseEventHandler(OnDBClose); mTcpClient.Connect(sIP, nPort); //逻辑处理 Thread logicThread = new Thread(new ThreadStart(LogicTimer)); logicThread.IsBackground = true; logicThread.Start(); while (true) { String command = Console.ReadLine(); if (command == "exit") { break; } } }
private void btGenerate_Click(object sender, EventArgs e) { GenerateKey obj = new GenerateKey(mainGen); this.Hide(); obj.ShowDialog(); mainGen = obj.ReturnGen(); this.Show(); }
public Task <DataKeys> InsertKey(inputData model) { DataKeys dataKeys; using (GenerateKey set = new GenerateKey(_dbContext)) { dataKeys = set.GenKey(model); _dbContext.tblDataKeys.Add(dataKeys); _dbContext.SaveChanges(); } return(Task.FromResult(dataKeys)); }
public void TestGenerateKey() { var configuration = MockBuilder.BuildConfiguration(); var store = new Raven.Client.Documents.DocumentStore { Urls = new[] { configuration.DocumentStore.Url } }; store.Initialize(); var documentStore = new DocumentStore(new DocumentSessionFactory(store, new NullLogger(), false), store); var generateKey = new GenerateKey(documentStore); Assert.IsTrue(generateKey.GetNextNumericalKey("Tests") != 0); }
/// <summary> /// This method will gives the license key /// </summary> /// <returns>License key string</returns> public string GetlicenseKey() { var keygeneration = new GenerateKey(); keygeneration.LicenseTemplate = "vvvvppppxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx" + "-xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx"; keygeneration.MaxTokens = 2; keygeneration.AddToken(0, "v", GenerateKey.TokenTypes.NUMBER, "1"); keygeneration.AddToken(1, "p", GenerateKey.TokenTypes.NUMBER, "2"); keygeneration.UseBase10 = false; keygeneration.UseBytes = false; keygeneration.CreateKey(); return(keygeneration.GetLicenseKey()); }
/// <summary> /// Test a generic key generation with no parameters 5-5-5-5-5 /// </summary> [Test] public void Test13_GenDis3ParB16Byt55555() { int lopcnt; try { GenerateKey gkey; string finalkey; string result; for (lopcnt = 1; lopcnt < 30; lopcnt++) { gkey = new GenerateKey(); gkey.LicenseTemplate = "vvxxx-xxxxx-ppxxx-ssxxx-xxxxx"; gkey.MaxTokens = 3; gkey.AddToken(0, "v", LicenseKey.GenerateKey.TokenTypes.NUMBER, "12"); gkey.AddToken(1, "p", LicenseKey.GenerateKey.TokenTypes.NUMBER, "23"); gkey.AddToken(2, "s", LicenseKey.GenerateKey.TokenTypes.CHARACTER, "GH"); gkey.UseBase10 = false; gkey.UseBytes = true; gkey.CreateKey(); finalkey = gkey.GetLicenseKey(); if (finalkey.Length != gkey.LicenseTemplate.Length) { throw new Exception("Keys are not the same length"); } result = gkey.DisassembleKey("v"); if (result != "12") { throw new Exception("The first tokens are not equal"); } result = gkey.DisassembleKey("p"); if (result != "23") { throw new Exception("The second tokens are not equal"); } result = gkey.DisassembleKey("s"); if (result != "GH") { throw new Exception("The third tokens are not equal"); } } } catch (Exception e) { Assert.AreEqual(66, 1, "UnExpected Failure. " + e.Message); } }
public void Louer(Mobile from) { if (!Banker.Withdraw(from, this.PrixLocation)) { from.SendMessage("Vous n'avez pas assez d'argent sur votre compte."); } else { from.SendMessage("Vous louez le batiment."); Proprio = from; m_Owned = true; from.SendMessage("Sous quel nom voulez-vous l'enregistrer ?"); from.Prompt = new OwnerNamePrompt(this); GenerateKey.GenerateNewKey(from, Porte1, 1); GenerateKey.GenerateNewKey(from, Porte2, 1); } }
// Deux sous fonctions qui permettent de vider la zone de location, lorsque le proprio perd la maison. private void DumpItems() { if (m_Container != null) { WoodenBox b = new WoodenBox(); b.MaxItems = int.MaxValue; b.Name = m_OwnerName; List <Item> toMove = new List <Item>(); Rectangle2D rect = new Rectangle2D(RegionPoint1, RegionPoint2); IPooledEnumerable <Item> list = Map.Felucca.GetItemsInBounds(rect); foreach (Item i in list) { if (i != null && !(i is BaseDoor)) { toMove.Add(i); } } list.Free(); for (int i = 0; i < toMove.Count; ++i) { b.DropItem(toMove[i]); toMove[i].Movable = true; } // Seulement ouvrable par le owner, qui obtient une nouvelle clef à chaque fois. GenerateKey.GenerateNewKey(m_Proprio, b, 1); b.Locked = true; // Ajout de la boite lockée dans le container lié à la maison. m_Container.DropItem(b); b.CanBeAltered = false; b.Movable = false; } }
public IActionResult Register(RegisterViewModel model) { if (ModelState.IsValid) { GenerateKey generateKey = new GenerateKey(); User newUser = new User { FirstName = model.FirstName, LastName = model.LastName, Email = model.Email, Password = model.Password, UserKey = generateKey.RandKey() }; PasswordHasher <User> hasher = new PasswordHasher <User>(); newUser.Password = hasher.HashPassword(newUser, newUser.Password); _context.Users.Add(newUser); _context.SaveChanges(); Account newAccount = new Account { Balance = 0, UserID = newUser.UserID, UserKey = newUser.UserKey }; _context.Accounts.Add(newAccount); _context.SaveChanges(); HttpContext.Session.SetString("CurrentUserKey", newUser.UserKey); return(RedirectToAction("Account", "Bank", new { UserKey = newUser.UserKey })); } return(View("Index")); }
private void btnDecode_Click(object sender, System.EventArgs e) { GenerateKey gkey; int numtokens; int lop; string result; string tokenvalue = ""; if (txtKeyInput.Text.Length == 0) { MessageBox.Show("Enter a Key Template", "Layout"); txtKeyInput.Focus(); return; } gkey = new GenerateKey(); // set the base type. if (rdobtn10.Checked) { // use base 10 gkey.UseBase10 = true; } else { // use base 16 gkey.UseBase10 = false; } // set the token type. if (rdobtnBytes.Checked) { // use bytes gkey.UseBytes = true; } else { // use bits gkey.UseBytes = false; } // set the Checksum type. if (rdoBtnChksum1.Checked) { // use Algorithm 1 gkey.ChecksumAlgorithm = Checksum.ChecksumType.Type1; } else { // use Algorithm 2 gkey.ChecksumAlgorithm = Checksum.ChecksumType.Type2; } // Set the number of tokens. numtokens = listView1.Items.Count; if (numtokens > 0) { gkey.MaxTokens = numtokens; lop = 0; foreach (ListViewItem item in listView1.Items) { GenerateKey.TokenTypes ttypes; string tempstr; tempstr = item.SubItems[1].Text; ttypes = GenerateKey.TokenTypes.NUMBER; // default junk switch (tempstr) { case "numeric": case "Numeric": ttypes = GenerateKey.TokenTypes.NUMBER; break; case "character": case "Character": ttypes = GenerateKey.TokenTypes.CHARACTER; break; default: MessageBox.Show("Illegal Token type in switch", "Generatekey"); break; } try { gkey.AddToken(lop, item.SubItems[0].Text, ttypes, item.SubItems[2].Text); } catch (Exception ex) { MessageBox.Show("Error is " + ex.InnerException); btnAdd.Focus(); return; } lop++; } gkey.LicenseTemplate = txtKeyInput.Text; // first create the key try { gkey.CreateKey(); } catch (Exception ex) { MessageBox.Show("Error exception is: " + ex.Message); return; } txtLicKey.Text = gkey.GetLicenseKey(); foreach (ListViewItem item in listView1.Items) { tokenvalue = item.SubItems[0].Text; // now decode the key try { result = gkey.DisassembleKey(tokenvalue); } catch (Exception ex) { MessageBox.Show("Error exception is: " + ex.Message); return; } item.SubItems[3].Text = result; } } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { int val = info.ButtonID; switch (val) { default: break; case 1: { m_item.Louer(m_from); break; } case 2: { m_item.MontrerProprio = !m_item.MontrerProprio; break; } case 3: { m_from.SendMessage("Sous quel nom voulez-vous enregistrer le batiment ?"); m_from.Prompt = new OwnerNamePrompt(m_item); break; } case 4: { m_from.Target = new AddTargetCoproprio(m_item); m_from.SendMessage("Qui desirez vous ajouter comme coproprietaire?"); break; } case 5: { m_item.CoProprio[0] = null; break; } case 6: { m_item.CoProprio[1] = null; break; } case 7: { m_item.CoProprio[2] = null; break; } case 8: { m_from.Target = new AddTargetChangeProprio(m_item); m_from.SendMessage("A qui voulez vous transferer la maison?"); break; } case 9: { if (m_item.Porte1 != null) { if (!GenerateKey.GenerateKeyFor(m_from, m_item.Porte1, 1)) { GenerateKey.GenerateNewKey(m_from, m_item.Porte1, 1); } } break; } case 10: { if (m_item.Porte2 != null) { if (!GenerateKey.GenerateKeyFor(m_from, m_item.Porte2, 1)) { GenerateKey.GenerateNewKey(m_from, m_item.Porte2, 1); } } break; } case 11: { m_item.Disown(); break; } } }
static void Main(string[] args) { int menuOption = 0; do { menuOption = DisplayMenu(); switch (menuOption) { case 1: //Gerando uma chave privada { try { Console.WriteLine("Informe a senha para criar sua chave privada: "); var senha = Console.ReadLine(); var generatekey = new GenerateKey(); var wordList = generatekey.GetWordList(); //Gerando lista de palavras var pkey = generatekey.GetPrivateKey(wordList.ToString(), senha); //Gerando chave com senha Console.WriteLine($"\nAnote a lista de palavras: {wordList.ToString()}"); Console.WriteLine($"\nAnote o seu endereço na rede: {pkey.PrivateKey.PubKey.GetAddress(Network.TestNet)}"); Console.WriteLine("\nSalve essas informações para recuperar a sua chave!"); } catch (Exception ex) { Console.WriteLine($"Ocorreu um erro: {ex.Message}"); } break; } case 2: //Recuperando chave privada { try { Console.WriteLine("Informe o conjunto de 12 palavras: "); var words = Console.ReadLine(); Console.WriteLine("Informe a senha da chave privada: "); var senha = Console.ReadLine(); var generatekey = new GenerateKey(); var pkey = generatekey.GetPrivateKey(words, senha); //Gerando chave com senha Console.WriteLine($"\nSeu endereço na rede é: {pkey.PrivateKey.PubKey.GetAddress(Network.TestNet)}"); } catch (Exception ex) { Console.WriteLine($"Ocorreu um erro: {ex.Message}"); } break; } case 3: //Obtendo saldo do endereço { try { Console.WriteLine("Informe o endereço na rede: "); var address = Console.ReadLine(); var account = new AccountBitcoin(); account.GetBalance(address); } catch (Exception ex) { Console.WriteLine($"Ocorreu um erro: {ex.Message}"); } break; } case 4: //Obtendo histórico de transações do endereço { try { Console.WriteLine("Informe o endereço na rede: "); var address = Console.ReadLine(); var account = new AccountBitcoin(); account.GetHistory(address); } catch (Exception ex) { Console.WriteLine($"Ocorreu um erro: {ex.Message}"); } break; } case 5: //Criando uma transação na rede { try { Console.WriteLine("Informe o conjunto de 12 palavras: "); var words = Console.ReadLine(); Console.WriteLine("Informe a senha da chave privada: "); var senha = Console.ReadLine(); Console.WriteLine("Informe o endereço para envio: "); var addressSend = Console.ReadLine(); Console.WriteLine("Informe a quantidade de SATOSHIS para envio: "); var moneySend = Console.ReadLine(); Console.WriteLine("Informe a quantidade de SATOSHIS para a taxa: "); var fee = Console.ReadLine(); //Recuperando chave privada var generatekey = new GenerateKey(); var pkey = generatekey.GetPrivateKey(words, senha); //Gerando chave com senha //Criando a transação var transaction = new TransactionBitcoin(); transaction.SendTransaction( pkey, addressSend, new Money(Convert.ToInt64(moneySend)), new Money(Convert.ToInt64(fee)) ); } catch (Exception ex) { Console.WriteLine($"Ocorreu um erro: {ex.Message}"); } break; } default: break; } } while (menuOption != 6); }