Ejemplo n.º 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string latestpath = FindLatestLog(logPath, logExt);

            if (string.IsNullOrEmpty(latestpath))
            {
                ShowNoLogError();
                return;
            }
            List <string> paths = new List <string>(FindAllLogs(logPath, logExt));

            if (paths.Count == 0)
            {
                ShowNoLogError();
                return;
            }

            if (cmbSources.SelectedIndex == 2)
            {
                parser = new LogParser(paths, true, cmbMatchMode.SelectedIndex == 1, (chkOneHitPerPlayer.Checked ? true : false));
            }
            else
            {
                parser = new LogParser(latestpath, ((cmbSources.SelectedIndex > 0) ? true : false), cmbMatchMode.SelectedIndex == 1, (chkOneHitPerPlayer.Checked ? true : false));
            }

            if (chkLoadOnUpdate.Checked)
            {
                List <Player> Players = parser.GetPlayers();
                if (chkSingleTable.Checked)
                {
                    this.lstFiltered.SetObjects(Players);
                }
                else
                {
                    this.lstPlayers.SetObjects(Players);
                }


                lblPlayers.Text = Players.Count + " players found.";
            }

            if ((chkRemove.Checked))
            {
                foreach (string _path in paths)
                {
                    if (chkLogDeletionKeepLatest.Checked && _path == latestpath)
                    {
                        continue;
                    }
                    if (chkMoveLogs.Checked)
                    {
                        File.Move(_path, txtLogMovePath.Text + "\\" + Path.GetFileName(_path));
                    }
                    else
                    {
                        File.Delete(_path);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            string latestpath = FindLatestLog(logPath, logExt);
            if (string.IsNullOrEmpty(latestpath))
            {
                ShowNoLogError();
                return;
            }
            List<string> paths = new List<string>(FindAllLogs(logPath, logExt));
            if (paths.Count == 0)
            {
                ShowNoLogError();
                return;
            }

            if (cmbSources.SelectedIndex == 2)
                parser = new LogParser(paths, true, cmbMatchMode.SelectedIndex == 1,  (chkOneHitPerPlayer.Checked ? true : false));
            else
                parser = new LogParser(latestpath, ((cmbSources.SelectedIndex > 0) ? true : false), cmbMatchMode.SelectedIndex == 1, (chkOneHitPerPlayer.Checked ? true : false));

            if (chkLoadOnUpdate.Checked)
            {
                List<Player> Players = parser.GetPlayers();
                if (chkSingleTable.Checked)
                {
                    this.lstFiltered.SetObjects(Players);
                }
                else
                    this.lstPlayers.SetObjects(Players);

                lblPlayers.Text = Players.Count + " players found.";
            }

            if ((chkRemove.Checked))
            {
                foreach (string _path in paths)
                {
                    if(chkLogDeletionKeepLatest.Checked&&_path==latestpath)
                        continue;
                    if (chkMoveLogs.Checked)
                        File.Move(_path, txtLogMovePath.Text + "\\" + Path.GetFileName(_path));
                    else
                        File.Delete(_path);
                }
            }
        }