public bool TryCheckWalletCompaitibility(ConsoleMessageHandlingService messageService, out string errorMessage) { InfoResponse info; InfoRequest requestForInfo = new InfoRequest(); messageService.Info("Connecting and reading Linda wallet info..."); if (!m_dataConnector.TryPost <InfoResponse>(requestForInfo, out info, out errorMessage)) { return(false); } messageService.Info("Linda wallet info retrieved!"); messageService.Info("Checking for wallet compatibility..."); messageService.Info(string.Format("Compatible versions: {0}", COMPATIBLE_WALLET_VERSIONS)); if (!COMPATIBLE_WALLET_VERSIONS.Contains(info.Version.ToLower())) { errorMessage = string.Format( "Linda wallet version: '{0}' is not compatible!", info.Version); return(false); } messageService.Info(string.Format("Connected wallet version: {0} is compatible!", info.Version)); return(true); }
public void Report(ConsoleMessageHandlingService messageService) { if (RewardTotal > 0) { DateTimeOffset nowDate = DateTimeOffset.Now.Date; TimeSpan diff = nowDate - OldestRewardDateTime.LocalDateTime.Date; messageService.Info(string.Format( "Rewards: {0} LINDA over {1} days = {2} LINDA per day.", Math.Round(RewardTotal, 4), Math.Ceiling(diff.TotalDays), Math.Round(RewardTotal / (decimal)diff.TotalDays, 4))); } else { messageService.Info("Rewards: No rewards received."); } switch (Status) { case CoinControlStatus.NotReadyOneUnspent: { messageService.Info(string.Format( "Staking: {0}.", (CoinControlAddressStaking ? "Yes" : "No"))); if (CoinControlAddressStaking) { messageService.Info(string.Format( "Expected time to earn reward: {0} day(s) {1} hour(s).", ExpectedTimeToEarnReward.Days, ExpectedTimeToEarnReward.Hours)); messageService.Info(string.Format( "Time spent staking: {0} day(s) {1} hour(s) {2} minute(s).", ExpectedTimeToStartStaking.Days * -1, ExpectedTimeToStartStaking.Hours * -1, ExpectedTimeToStartStaking.Minutes * -1)); } else { if (ExpectedTimeToStartStaking.TotalSeconds > 0) { messageService.Info(string.Format( "Expected time to start staking: {0} hours {1} minutes.", Math.Floor(ExpectedTimeToStartStaking.TotalHours), ExpectedTimeToStartStaking.Minutes)); } else { messageService.Warning("You should have already started staking! Please troubleshoot your wallet."); } } break; } case CoinControlStatus.NotReadyWaitingForPaymentToYourself: case CoinControlStatus.WaitingForStakeToMature: case CoinControlStatus.WaitingForUnspentConfirmations: case CoinControlStatus.Starting: default: { break; } } messageService.Info(FormatCoinControlStatusMessage(StatusMessage)); }
public static void Main(string[] args) { Console.WriteLine(Assembly.GetExecutingAssembly().FullName); Console.WriteLine(); if (args.Length < 1 || args[0].Equals("h", StringComparison.InvariantCultureIgnoreCase) || args[0].Equals("help", StringComparison.InvariantCultureIgnoreCase) || args[0].Equals("?")) { Console.WriteLine(USAGE); return; } Verb verb; if (!Enum.TryParse <Verb>(args[0], true, out verb)) { Console.WriteLine("Specified verb not recognized!"); Environment.Exit(-1); } ConsoleMessageHandlingService messageService = new ConsoleMessageHandlingService(); IRunnable runnable = null; bool runOk = false; string errorMessage = null; // TODO: Add a verb for handling master node earnings. try { switch (verb) { case Verb.CoinControl: default: { runnable = new CoinControlService(messageService); break; } } runOk = runnable.Run(args, out errorMessage); } finally { if (runnable != null) { runnable.Dispose(); } } if (!runOk) { if (!string.IsNullOrEmpty(errorMessage)) { Console.WriteLine("Run failed! See error: {0}", errorMessage); } Environment.Exit(-2); } }