コード例 #1
0
        private void minerOutputReceived(MinerOutputMessage msg)
        {
            DispatcherHelper.CheckBeginInvokeOnUI(() =>
            {
                if (MinerOutputString.Count > 100)
                {
                    MinerOutputString.RemoveAt(0);
                }

                MinerOutputString.Add(msg.OutputText);
                if (msg.IsError)
                {
                    if (msg.Exception != null)
                    {
                        Log.InsertError(msg.OutputText, msg.Exception);
                    }
                    else
                    {
                        Log.InsertError(msg.OutputText);
                    }
                }
                else
                {
                    if (SelectedMinerSettings == null || SelectedMinerSettings.IsLogging)
                    {
                        Log.InsertDebug(msg.OutputText);
                    }
                }
            });
        }
コード例 #2
0
        private void minerOutputReceived(MinerOutputMessage msg)
        {
            if (!string.IsNullOrEmpty(msg.OutputText))
            {
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    if (msg.OutputText.Contains("use pool"))
                    {
                        var tmpUrl  = string.Empty;
                        var tmpPort = 0;

                        int startIndex = msg.OutputText.IndexOf("pool ") + 5;
                        tmpUrl         = msg.OutputText.Substring(startIndex);
                        tmpPort        = Convert.ToInt32(tmpUrl.Substring(tmpUrl.IndexOf(":") + 1, tmpUrl.IndexOf(" ") - tmpUrl.IndexOf(":")));
                        tmpUrl         = tmpUrl.Substring(0, tmpUrl.IndexOf(":"));

                        Messenger.Default.Send(new ActivePoolMessage()
                        {
                            IsActiveCPUPool = true, IsActiveGPUPool = false, URL = tmpUrl, Port = tmpPort
                        });
                    }

                    if (MinerOutputString.Count > 100)
                    {
                        MinerOutputString.RemoveAt(0);
                    }

                    MinerOutputString.Add(msg.OutputText.Replace('\r', ' '));
                    if (msg.IsError)
                    {
                        if (msg.Exception != null)
                        {
                            Log.InsertError(msg.OutputText, msg.Exception);
                        }
                        else
                        {
                            Log.InsertError(msg.OutputText);
                        }
                    }
                    else
                    {
                        if (SelectedMinerSettings == null || SelectedMinerSettings.IsLogging)
                        {
                            Log.InsertDebug(msg.OutputText);
                        }
                    }
                });
            }
        }