private bool TryParseArgs(string[] args, out string errorMessage)
        {
            if (args.Length < 2)
            {
                errorMessage = "Missing required parameters.";
                return(false);
            }

            string configPath = args[1].Trim();

            CoinControlIni ini;

            if (!IniHelper.TryReadIniFromFile <CoinControlIni>(configPath, out ini, out errorMessage))
            {
                errorMessage = string.Format(
                    "Failed to read coin control config: {0}\r\n{1}",
                    new FileInfo(configPath).FullName,
                    errorMessage);

                return(false);
            }

            m_config = ini;

            m_dataConnector = new LindaDataConnector(
                m_config.RpcUser,
                m_config.RpcPassword);

            errorMessage = null;
            return(true);
        }
Ejemplo n.º 2
0
        public bool TryStartLindaWallet(LindaDataConnector dataConnector, out string errorMessage)
        {
            if (!LindaWalletExeFileInfo.Exists)
            {
                errorMessage = string.Format("Linda wallet exe file not found at: {0}", LindaWalletExeFileInfo.FullName);
                return(false);
            }

            try
            {
                m_lindaWalletProcess                     = new Process();
                m_lindaWalletProcess.StartInfo           = LindaWalletStartInfo;
                m_lindaWalletProcess.EnableRaisingEvents = true;
                m_lindaWalletProcess.Exited             += ProcessExited;
                m_lindaWalletProcess.Disposed           += ProcessExited;

                m_lindaWalletProcess.Start();
            }
            catch (Exception exception)
            {
                errorMessage = string.Format("Failed to start linda wallet!  See exception: {0}", exception);
                return(false);
            }

            if (!WaitForWalletToComeUp(dataConnector))
            {
                errorMessage = "Wallet won't start!";
                return(false);
            }

            errorMessage = null;
            return(true);
        }
Ejemplo n.º 3
0
        public bool IsUp(LindaDataConnector dataConnector)
        {
            string       errorMessage;
            InfoRequest  request = new InfoRequest();
            InfoResponse response;

            return(dataConnector.TryPost <InfoResponse>(request, out response, out errorMessage));
        }
Ejemplo n.º 4
0
        public bool WaitForWalletToGoDown(LindaDataConnector dataConnector)
        {
            int attempt = 0;

            while (attempt < WALLET_WAIT_ATTEMPTS)
            {
                attempt++;
                if (!IsUp(dataConnector))
                {
                    return(true);
                }

                System.Threading.Thread.Sleep(WALLET_WAIT_MS);
            }

            return(false);
        }
Ejemplo n.º 5
0
        public bool TryStopLindaWallet(LindaDataConnector dataConnector, out string errorMessage)
        {
            StopRequest request = new StopRequest();
            string      responseStr;

            if (!dataConnector.TryPost <string>(request, out responseStr, out errorMessage))
            {
                return(false);
            }

            if (!WaitForWalletToGoDown(dataConnector))
            {
                errorMessage = "Wallet won't stop!";
                return(false);
            }

            return(true);
        }
 public TransactionHelper(LindaDataConnector dataConnector)
 {
     m_dataConnector = dataConnector;
 }
Ejemplo n.º 7
0
 public WalletHelper(LindaDataConnector dataConnector)
 {
     m_dataConnector = dataConnector;
 }