Beispiel #1
0
        //select directory
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (folderBrowserDialog1.ShowDialog().Equals(DialogResult.OK))
                {
                    selectedDirectory.Text = folderBrowserDialog1.SelectedPath;
                }

                logFiles = new LogFileService().GetLogFiles(new List <string> {
                    selectedDirectory.Text
                });
                archives = new LogFileService().GetZipFiles(new List <string> {
                    selectedDirectory.Text
                });
                listView1.Items.Clear();
                listView2.Items.Clear();
                listView1.Items.AddRange(logFiles.Select(x =>
                {
                    var item = new ListViewItem(x.Name);
                    item.Tag = x.FileLocation;
                    return(item);
                }).ToArray());
                listView2.Items.AddRange(archives.Select(x => new ListViewItem(x)).ToArray());
                totalLogsLabel.Text = new LogFileService().CountFiles(new List <string> {
                    selectedDirectory.Text
                }).ToString();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #2
0
 //file search with size button
 private void button3_Click(object sender, EventArgs e)
 {
     try
     {
         logFiles = new LogFileService().SearchFilesBySize(long.Parse(fromSizeSearch.Text),
                                                           long.Parse(toSizeSearch.Text), new List <string> {
             selectedDirectory.Text
         });
         listView1.Items.Clear();
         listView1.Items.AddRange(logFiles.Select(x =>
         {
             var item = new ListViewItem(x.Name);
             item.Tag = x.FileLocation;
             return(item);
         }).ToArray());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #3
0
 //file search with date button
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         logFiles = new LogFileService().SearchFilesByTime(dateTimePicker1.Value, dateTimePicker2.Value,
                                                           new List <string> {
             selectedDirectory.Text
         });
         listView1.Items.Clear();
         listView1.Items.AddRange(logFiles.Select(x =>
         {
             var item = new ListViewItem(x.Name);
             item.Tag = x.FileLocation;
             return(item);
         }).ToArray());
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #4
0
        //select directory
        private void button1_Click(object sender, EventArgs e)
        {
            if (folderBrowserDialog1.ShowDialog().Equals(DialogResult.OK))
            {
                selectedDirectory.Text = folderBrowserDialog1.SelectedPath;
            }

            logFiles = new LogFileService().GetLogFiles(new List <string> {
                selectedDirectory.Text
            });
            archives = new LogFileService().GetZipFiles(new List <string> {
                selectedDirectory.Text
            });
            listView1.Items.AddRange(logFiles.Select(x =>
            {
                var item = new ListViewItem(x.Name);
                item.Tag = x.FileLocation;
                return(item);
            }).ToArray());

            listView2.Items.AddRange(archives.Select(x => new ListViewItem(x)).ToArray());
            listViewSourceChanged();
        }