Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1)
            {
                LogRichTextBox.AppendText("请选择串口\n");
                return;
            }
            WriteInfo req  = new WriteInfo();
            writeInfo info = new writeInfo();//写入设备的信息
            string    temp = numericUpDown1.Value.ToString().PadLeft(3, '0');



            req.cfgInit(comboBox1.Items[comboBox1.SelectedIndex].ToString(), LogRichTextBox);
            info.action = 3;
            reinfo      = req.WriteInfoFunc(info);
            byte[] snData = reinfo.SN;
            info.encKey = AESHelper.AESEncrypt(snData, KEY);
            info.action = 1;
            info.ID     = textBox1.Text + textBox6.Text + textBox5.Text + temp;
            info.verson = textBox2.Text;
            LogRichTextBox.AppendText("ID: " + info.ID + ",硬件版本: " + info.verson + "\n开始烧写...\n");
            req.WriteInfoFunc(info);
            LogRichTextBox.AppendText("烧写成功\n");
        }
Esempio n. 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (comboBox1.SelectedIndex == -1)
            {
                LogRichTextBox.AppendText("请选择串口\n");
                return;
            }
            WriteInfo req   = new WriteInfo();
            writeInfo wInfo = new writeInfo();

            req.cfgInit(comboBox1.Items[comboBox1.SelectedIndex].ToString(), LogRichTextBox);
            wInfo.action = 2;
            string result = req.WriteInfoFunc(wInfo).ID;

            string[] info = result.Split(new char[3] {
                '/', '|', '/'
            }, StringSplitOptions.RemoveEmptyEntries);
            if (info.Count() == 0)
            {
                LogRichTextBox.AppendText("读取失败\n");
                return;
            }
            MessageBox.Show("ID:" + info[0]);
            LogRichTextBox.AppendText("ID: " + info[0] + ",硬件版本: " + info[1] + "\n");
        }
Esempio n. 3
0
        private void button3_Click(object sender, EventArgs e)
        {
            string temp = numericUpDown1.Value.ToString().PadLeft(3, '0');
            string ID   = textBox1.Text + textBox6.Text + textBox5.Text + temp;

            LogRichTextBox.AppendText("ID: " + ID + "\n");
            //textBox3.Text = Convert.ToBase64String(AESHelper.AESEncrypt(ID, KEY));
        }
 private void Logger_OnLog(string messaeg)
 {
     Dispatcher.BeginInvoke(new Action(() =>
     {
         LogRichTextBox.AppendText(messaeg + Environment.NewLine);
         LogRichTextBox.ScrollToEnd();
     }));
 }
Esempio n. 5
0
        public void ShowProgressBar(string message)
        {
            if (!_isClosed)
            {
                Invoke((MethodInvoker) delegate
                {
                    logProgressBar.Visible = true;
                    LogRichTextBox.Size    = new Size(LogRichTextBox.Width, 62);

                    LogRichTextBox.AppendText(message + "\r\n");
                    LogRichTextBox.SelectionStart = LogRichTextBox.Text.Length;
                    LogRichTextBox.ScrollToCaret();
                });
            }
        }
Esempio n. 6
0
        private void AddText(string text, Logtype type = Logtype.Normal)
        {
            var theme = ThemeManager.Current.DetectTheme(Application.Current);

            var errorColor     = Colors.Red.ToString();
            var importantColor = Colors.Orange.ToString();
            var successColor   = Colors.LimeGreen.ToString();
            var defaultColor   = Colors.WhiteSmoke.ToString();

            if (theme == null)
            {
                defaultColor = Colors.Black.ToString();
            }
            if (theme != null && theme.BaseColorScheme == "Light")
            {
                errorColor     = Colors.Red.ToString();
                importantColor = Colors.Orange.ToString();
                successColor   = Colors.Green.ToString();
                defaultColor   = Colors.Black.ToString();
            }


            switch (type)
            {
            case Logtype.Error:
                this.LogRichTextBox.AppendText(text, errorColor);
                break;

            case Logtype.Important:
                LogRichTextBox.AppendText(text, importantColor);
                break;

            case Logtype.Success:
                LogRichTextBox.AppendText(text, successColor);
                break;

            case Logtype.Normal:
            case Logtype.Wcc:
            default:
                LogRichTextBox.AppendText(text, defaultColor);
                break;
            }
        }
Esempio n. 7
0
        /////////////////////////////////////////////////////////////////////////////////////////
        private void CacheLoadTimer_Tick(object sender, EventArgs e)
        {
            DirectoryInfo dir = new DirectoryInfo(@"D:\MyClouds\YandexDisk\wot\REP_Cache");

            FileSystemInfo[] infos = dir.GetFiles("*.dat");
            BattleResult_v2  BRv2;

            FbTransaction myTransaction;
            AppendResult  Res;

            foreach (FileSystemInfo file in infos)
            {
                if (!CacheFilesProcessed.Contains(file.Name))
                {
                    myTransaction = myConnection.BeginTransaction();
                    try
                    {
                        BRv2 = new BattleResult_v2(file.FullName.ToString());
                        Res  = CDB.AppendBattle(ref BRv2, ref myTransaction);
                        myTransaction.Commit();
                        CacheFilesProcessed.Add(file.Name);
                        if (Res == AppendResult.Exist)
                        {
                            LogRichTextBox.AppendText(file.Name + " - добавлен ранее" + "\n");
                        }
                        else
                        {
                            LogRichTextBox.AppendText(file.Name + " - добавлен" + "\n");
                        }
                    }
                    catch (Exception expept)
                    {
                        myTransaction.Rollback();
                        throw new Exception("Ooops! ---> CacheLoadTimer_Tick: " + expept.Message);
                    }
                }
                else
                {
                    LogRichTextBox.AppendText(file.Name + " - обработан ранее" + "\n");
                }
            }
        }
Esempio n. 8
0
        public void DrawLine(LogLine logline)
        {
            switch (logline.type)
            {
            case (int)LogLine.LineType.GlobalChat:
                LogRichTextBox.AppendText("[" + logline.datetime.ToString("HH:mm:ss") + "] ", Color.FromArgb(180, 180, 180));
                LogRichTextBox.AppendText("[G] ", Color.FromArgb(0, 180, 255));
                LogRichTextBox.AppendText(logline.nick + ": ", Color.FromArgb(180, 180, 180), true);
                LogRichTextBox.AppendText(logline.text + "\n", Color.FromArgb(0, 180, 255));
                break;

            case (int)LogLine.LineType.LocalChat:
                LogRichTextBox.AppendText("[" + logline.datetime.ToString("HH:mm:ss") + "] ", Color.FromArgb(180, 180, 180));
                LogRichTextBox.AppendText("[L] ", Color.FromArgb(0, 255, 180));
                LogRichTextBox.AppendText(logline.nick + ": ", Color.FromArgb(180, 180, 180), true);
                LogRichTextBox.AppendText(logline.text + "\n", Color.FromArgb(0, 255, 180));
                break;

            case (int)LogLine.LineType.Command:
                LogRichTextBox.AppendText("[" + logline.datetime.ToString("HH:mm:ss") + "] ", Color.FromArgb(180, 180, 180));
                LogRichTextBox.AppendText("[C] ", Color.FromArgb(180, 80, 0));
                LogRichTextBox.AppendText(logline.nick + ": ", Color.FromArgb(180, 180, 180), true);
                LogRichTextBox.AppendText(logline.text + "\n", Color.FromArgb(180, 80, 0));
                break;

            case (int)LogLine.LineType.PlayerConnect:
                LogRichTextBox.AppendText("[" + logline.datetime.ToString("HH:mm:ss") + "] ", Color.FromArgb(180, 180, 180));
                LogRichTextBox.AppendText("[P] ", Color.FromArgb(139, 0, 255));
                LogRichTextBox.AppendText(logline.nick + " зашёл\n", Color.FromArgb(139, 0, 255), true);
                break;

            case (int)LogLine.LineType.PlayerDisconnect:
                LogRichTextBox.AppendText("[" + logline.datetime.ToString("HH:mm:ss") + "] ", Color.FromArgb(180, 180, 180));
                LogRichTextBox.AppendText("[P] ", Color.FromArgb(139, 0, 255));
                LogRichTextBox.AppendText(logline.nick + " вышел\n", Color.FromArgb(139, 0, 255), true);
                break;

            case (int)LogLine.LineType.Kick:
                LogRichTextBox.AppendText("[" + logline.datetime.ToString("HH:mm:ss") + "] ", Color.FromArgb(180, 180, 180));
                LogRichTextBox.AppendText("[P] ", Color.FromArgb(139, 0, 255));
                LogRichTextBox.AppendText(logline.nick + " был кикнут\n", Color.Red, true);
                break;

            case (int)LogLine.LineType.Death:
                LogRichTextBox.AppendText("[" + logline.datetime.ToString("HH:mm:ss") + "] ", Color.FromArgb(180, 180, 180));
                LogRichTextBox.AppendText("[P] ", Color.FromArgb(139, 0, 255));
                LogRichTextBox.AppendText(logline.nick + " умер\n", Color.FromArgb(180, 180, 180), true);
                break;

            case (int)LogLine.LineType.Kill:
                LogRichTextBox.AppendText("[" + logline.datetime.ToString("HH:mm:ss") + "] ", Color.FromArgb(180, 180, 180));
                LogRichTextBox.AppendText("[PvP] ", Color.Olive);
                LogRichTextBox.AppendText(logline.nick + " убил " + logline.nick2 + "\n", Color.Olive, true);
                break;

            case (int)LogLine.LineType.Message:
                LogRichTextBox.AppendText("[" + logline.datetime.ToString("HH:mm:ss") + "] ", Color.FromArgb(180, 180, 180));
                LogRichTextBox.AppendText("[M] ", Color.Orange);
                LogRichTextBox.AppendText(logline.nick + " ✉→ " + logline.nick2 + ": ", Color.Orange, true);
                LogRichTextBox.AppendText(logline.text + "\n", Color.OrangeRed);

                break;
            }
        }
Esempio n. 9
0
 private void metroButton1_Click(object sender, EventArgs e)
 {
     LogUpdateTimer.Enabled = true;
     LogRichTextBox.AppendText(core.settings.currentLog.name + "\n", Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
 }
Esempio n. 10
0
 /////////////////////////////////////////////////////////////////////////////////////////
 private void buttonTest2_Click(object sender, EventArgs e)
 {
     CacheLoadTimer.Interval = MyConfig.ScanInterval;
     CacheLoadTimer.Enabled  = !CacheLoadTimer.Enabled;
     LogRichTextBox.AppendText("Timer Enabled - " + CacheLoadTimer.Enabled.ToString() + "\n");
 }