private void HandleProcessOutput(object sender, DataReceivedEventArgs e) { if (String.IsNullOrEmpty(e.Data)) { return; } errorHandledByEvent = false; if ((e.Data.IndexOf("auth failed", StringComparison.OrdinalIgnoreCase) >= 0) && (AuthenticationFailed != null)) { errorHandledByEvent = true; //must be done first as its async AuthenticationFailedArgs args = new AuthenticationFailedArgs(); Match match = Regex.Match(e.Data, @" pool (\d) "); string poolIndex = "??"; if (match.Success) { poolIndex = match.Groups[1].Value; } args.Reason = String.Format("Authentication failed ({0} pool {1})", minerConfiguration.CoinName, poolIndex); AuthenticationFailed(this, args); } if (((e.Data.IndexOf("No servers could be used", StringComparison.OrdinalIgnoreCase) >= 0) || (e.Data.IndexOf("No servers were found", StringComparison.OrdinalIgnoreCase) >= 0)) && (LaunchFailed != null)) { errorHandledByEvent = true; //must be done first as its async LaunchFailedArgs args = new LaunchFailedArgs(); args.Reason = String.Format("None of the pools configured for {0} could be used. Verify your pool settings and try again.", minerConfiguration.CoinName); args.CoinName = minerConfiguration.CoinName; LaunchFailed(this, args); } if (e.Data.IndexOf("detected new block", StringComparison.OrdinalIgnoreCase) >= 0) { ((Process)sender).CancelOutputRead(); ((Process)sender).CancelErrorRead(); } }
private void HandleProcessOutput(object sender, DataReceivedEventArgs e) { if (String.IsNullOrEmpty(e.Data)) return; errorHandledByEvent = false; if ((e.Data.IndexOf("auth failed", StringComparison.OrdinalIgnoreCase) >= 0) && (AuthenticationFailed != null)) { errorHandledByEvent = true; //must be done first as its async AuthenticationFailedArgs args = new AuthenticationFailedArgs(); Match match = Regex.Match(e.Data, @" pool (\d) "); string poolIndex = "??"; if (match.Success) poolIndex = match.Groups[1].Value; args.Reason = String.Format("Authentication failed ({0} pool {1})", minerConfiguration.CoinName, poolIndex); AuthenticationFailed(this, args); } if (((e.Data.IndexOf("No servers could be used", StringComparison.OrdinalIgnoreCase) >= 0) || (e.Data.IndexOf("No servers were found", StringComparison.OrdinalIgnoreCase) >= 0)) && (LaunchFailed != null)) { errorHandledByEvent = true; //must be done first as its async LaunchFailedArgs args = new LaunchFailedArgs(); args.Reason = String.Format("None of the pools configured for {0} could be used. Verify your pool settings and try again.", minerConfiguration.CoinName); args.CoinName = minerConfiguration.CoinName; LaunchFailed(this, args); } if (e.Data.IndexOf("detected new block", StringComparison.OrdinalIgnoreCase) >= 0) { ((Process)sender).CancelOutputRead(); ((Process)sender).CancelErrorRead(); } }
private void ProcessAuthenticationFailed(object sender, AuthenticationFailedArgs ea) { this.BeginInvoke((Action)(() => { //code to update UI notificationsControl.AddNotification(ea.Reason, ea.Reason, () => { ConfigureCoins(); }, ""); })); }
private void ProcessAuthenticationFailed(object sender, AuthenticationFailedArgs ea) { this.BeginInvoke((Action)(() => { //code to update UI PostNotification(ea.Reason, ea.Reason, () => { ConfigureCoinsLocally(); }, ToolTipIcon.Error, ""); })); }
private void ProcessAuthenticationFailed(object sender, AuthenticationFailedArgs ea) { Context.BeginInvoke((Action)(() => { //code to update UI PostNotification(ea.Reason, ConfigurePoolsLocally, NotificationKind.Danger); }), null); }