private static void CheckMnSendMoney() { var valuesSection = Configuration.GetSection("Nodes").GetChildren(); Console.WriteLine("----------------------------------------------------"); foreach (var item in valuesSection) { var bc = new BitnetClient("http://" + Configuration[item.Path + ":Server"] + ":" + Configuration[item.Path + ":Port"]) { Credentials = new NetworkCredential(Configuration[item.Path + ":RpcUser"], Configuration[item.Path + ":RpcPasword"]) }; try { Console.WriteLine("БАЛАНС {0} РАВЕН {1}", Configuration[item.Path + ":Symbol"], bc.GetBalance() + "\n"); } catch (Exception e) { Console.WriteLine("ЗАПИСАЛ ОШИБКУ ЗАПРОСА В ЛОГ"); } if (bc.GetBalance() > 1001) { var sendmoney = bc.GetBalance() - 1001; Console.WriteLine("Отправка денег на биржу {0} монет", sendmoney); bc.SendToAddress(Configuration[item.Path + ":WalletAddress"], sendmoney, "MNManager", ""); } } Console.WriteLine("----------------------------------------------------"); }
bool walletConnect() { //TODO: грузить данные для подключения из .conf файла //TODO: сделать генерацию .conf файлов со случайными данными BitnetClient client = new BitnetClient("http://127.0.0.1:22823"); client.Credentials = new NetworkCredential("user", "password"); bool result = true; //проверка try { client.GetBalance(); bc = client; } catch (Exception ex) { result = false; Debug.Print("Отловлено исключение: " + ex.Message); } return(result); }