Ejemplo n.º 1
0
        private void CreateBackUpDir_Click(object sender, EventArgs e)
        {
            CreateBackupDir CBU = new CreateBackupDir();

            CBU.CreateDir(TextLog);
            TextLog.AppendText("--------------------------------------------------------------------------\r\n");
        }
Ejemplo n.º 2
0
 public void DisplayLog(LogWrapper log)
 {
     if (log == null)
     {
         return;
     }
     try
     {
         var content = $"[{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture)}] [{log.LogLevel.ToString()}] {log.FormattedString}";
         var ex      = log.Exception;
         while (ex != null)
         {
             content += $"\n Error: [{ex.GetType().FullName}] {ex.Message}\n Stack Trace: {ex.StackTrace}";
             if (ex.InnerException != null)
             {
                 content += "\n ==== INNER EXCEPTION ====";
             }
             ex = ex.InnerException;
         }
         TextLog.AppendText(content + "\n");
     }
     catch
     {
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 输出日志
 /// </summary>
 /// <param name="str"></param>
 public void Log(string str)
 {
     if (TextLog.Text.Length >= 20000)
     {
         TextLog.Text = "";
     }
     TextLog.AppendText(DateTime.Now.ToString("HH:mm:ss ") + str + "\r\n\r\n");
 }
Ejemplo n.º 4
0
        private void ftpc_FileUploadCompleted(object sender, FTPCom.FTPEventArgs e)
        {
            string msg = "Transfered " + e.TotalBytes.ToString() + " bytes in " + ((float)e.TimeElapsed / 1000).ToString() + " seconds" + CRLF;

            TextLog.SelectionColor = Color.Black;
            TextLog.AppendText(msg);
            ftpc.Dir();
        }
Ejemplo n.º 5
0
 private void AddLog(string msg)
 {
     Invoke(new Action(() =>
     {
         TextLog.AppendText("[" + DateTime.Now.ToString("HH:mm:ss") + "]" + msg);
         TextLog.AppendText(Environment.NewLine);
         TextLog.ScrollToCaret();
     }));
 }
Ejemplo n.º 6
0
        private void Log(string message)
        {
            if (TextLog.InvokeRequired)
            {
                TextLog.Invoke(new Action(() => Log(message)));
                return;
            }

            TextLog.AppendText(message + Environment.NewLine);
        }
Ejemplo n.º 7
0
 private void ftpc_FTPCommand(object sender, FTPCom.FTPEventArgs e)
 {
     TextLog.SelectionColor = Color.Blue;
     if (e.Message != string.Empty)
     {
         TextLog.AppendText(e.Message);
     }
     TextLog.AppendText("\n");
     TextLog.SelectionStart = TextLog.TextLength;
     TextLog.ScrollToCaret();
 }
Ejemplo n.º 8
0
        //Button Uses

        /// <summary>
        /// Restores a player's health a limited amount of times
        /// </summary>
        /// <param name="player"></param>
        public void PotionUse(Player player)
        {
            potionlimit += 1;
            if (potionlimit < 3)
            {
                player.Heal(100 - player.Health);
                UpdateUI();
            }
            else
            {
                PotionButton.Enabled = false;
            }
            TextLog.AppendText("Player has healed and now has used " + (potionlimit) + " potions. \n");
        }
Ejemplo n.º 9
0
        //线程方法
        private void ExcuteMethod(IBaseLucene BL)
        {
            List <string> adds;
            List <string> updates;
            List <string> error;

            while (Thread.CurrentThread.IsAlive)
            {
                _wc.Start();//计时
                BL.Execute(Thread.CurrentThread.Name, out adds, out updates, out error);
                _wc.Stop();

                TextLog.AppendText(this.textBox1, string.Format("{3}: 新增成功{0},更行{1},删除{2} 耗时:{4}ms \r\n", adds.Count, updates.Count, error.Count, Thread.CurrentThread.Name, _wc.ElapsedMilliseconds));

                _wc.Reset();
                Thread.Sleep(1000 * 5);
            }
        }
Ejemplo n.º 10
0
        private void FileProcess_Click(object sender, EventArgs e)
        {
            string path = @"" + FilePath.Text;
            //Instances of lines of the file, and the class that will get the data

            ProcessFile   processFile;
            FileRW        lines = new FileRW();
            StringBuilder sb    = new StringBuilder();
            string        targetPath;

            try
            {
                //Read
                processFile = new ProcessFile(lines.ReadFile(path));
                sb.AppendLine("Arquivo Lido com suscesso!");
                TextLog.AppendText(sb.ToString());
                //Process
                processFile.CreateConciliation(processFile.Spf);
                sb.AppendLine("Arquivo processado com sucesso!");
                TextLog.Clear();
                TextLog.AppendText(sb.ToString());
                //Write
                targetPath = lines.WriteFile(path, processFile.Conciliations);
                sb.AppendLine("Arquivo gravado com sucesso!");
                sb.AppendLine("Processo Finalizado!");
                TextLog.Clear();
                TextLog.AppendText(sb.ToString());
                //OpenFolder
                Process prc = new Process();
                prc.StartInfo.FileName = targetPath;
                prc.Start();
                path = Path.GetDirectoryName(targetPath);
                prc.StartInfo.WorkingDirectory = path;
                prc.StartInfo.FileName         = path;
                prc.Start();
            }
            catch (IOException ex)
            {
                sb.AppendLine("An error occurred!!");
                sb.AppendLine(ex.Message);
                TextLog.Clear();
                TextLog.AppendText(sb.ToString());
            }
        }
Ejemplo n.º 11
0
        private void ftpc_DirCompleted(object sender, FTPCom.FTPEventArgs e)
        {
            int    i       = 0;
            int    idimage = 0;
            string msg;

            msg = "Transfered " + e.TotalBytes.ToString() + " bytes in " + ((float)e.TimeElapsed / 1000).ToString() + " seconds" + CRLF;
            TextLog.SelectionColor = Color.Black;
            TextLog.AppendText(msg);

            ServerView.BeginUpdate();
            ServerView.Items.Clear();
            ImgListServerSmall.Images.Clear();

            ListViewItem lvItem = new ListViewItem("..");

            ServerView.Items.Add(lvItem);

            for (i = 0; i < ftpc.FileCount; i++)
            {
                if (ftpc.IsFolder(i))
                {
                    string[] items = new String[2];
                    items[0] = ftpc.GetFileName(i);
                    items[1] = ftpc.GetFileSize(i).ToString();
                    ImgListServerSmall.Images.Add(m_IconFolder);
                    ServerView.Items.Add(new ListViewItem(items, idimage++));
                }
            }
            for (i = 0; i < ftpc.FileCount; i++)
            {
                if (!ftpc.IsFolder(i))
                {
                    string[] items = new String[2];
                    items[0] = ftpc.GetFileName(i);
                    items[1] = ftpc.GetFileSize(i).ToString();
                    ImgListServerSmall.Images.Add(ExtractIcon.GetIcon(items[0], false));
                    ServerView.Items.Add(new ListViewItem(items, idimage++));
                }
            }
            ServerView.EndUpdate();
            this.Cursor = Cursors.Default;
        }
Ejemplo n.º 12
0
        //Other buttons

        /// <summary>
        /// Loads data from saved xml document
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LoadButton_Click(object sender, EventArgs e)
        {
            Debug.WriteLine("Loading previous save...");
            //Reloads how many potions have been used and reallows the ability to attack
            potionlimit = DataManager <int> .Deserialize("PotionUse");

            gm.CurrentPlayer = DataManager <Player> .Deserialize("CurrentPlayer");

            gm.CurrentEnemy = DataManager <Player> .Deserialize("CurrentEnemy");

            EnableButtons();
            UpdateUI();


            TextLog.AppendText("Previous Save Loaded... \n");
            Debug.WriteLine("Previous Save Loaded");
            TextLog.SelectionStart = TextLog.Text.Length;
            TextLog.ScrollToCaret();
        }
Ejemplo n.º 13
0
        public void WriteLog(object sender, LogEventArgs e)
        {
            if (!ServerRunning)
            {
                return;
            }

            if (TextLog.InvokeRequired)
            {
                var d = new DelegateWriteLog(WriteLog);
                TextLog.Invoke(d, sender, e);
            }
            else
            {
                TextLog.SelectionStart  = TextLog.TextLength;
                TextLog.SelectionLength = 0;
                TextLog.SelectionColor  = e.Color;
                TextLog.AppendText($"{DateTime.Now}: {e.Text}{Environment.NewLine}");
                TextLog.ScrollToCaret();
            }
        }
Ejemplo n.º 14
0
 public void Log(string text)
 {
     TextLog.AppendText(text);
     TextLog.AppendText("\n");
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Enables the ability to add a message on the rich text document anywhere in the project
 /// </summary>
 /// <param name="message"></param>
 public void UpdateLog(string message)
 {
     TextLog.AppendText("\n" + message);
 }