private void fileBtn_Click(object sender, EventArgs e) { DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK) { currentFile = openFileDialog.FileName; selectedFile.Text = currentFile; currentFileInfo = new FileInfo(currentFile); if (MessageBox.Show("Are you sure you want to analyse this file: " + currentFile + ". Pressing yes will start the Analysis process.", "Log Analysis", MessageBoxButtons.YesNo) == DialogResult.Yes) { AnalysisWindow aw = new AnalysisWindow(); aw.InitializeAnalysis(currentFileInfo, currentFile); aw.CacheSelector(this); aw.Show(); this.Hide(); } } }
private void selButton_Click(object sender, EventArgs e) { DialogResult result = browseFolder.ShowDialog(); if (result == DialogResult.OK) { currentFolder = browseFolder.SelectedPath; selectedFolderText.Text = currentFolder; //get all files DirectoryInfo d = new DirectoryInfo(currentFolder); //Assuming Test is your Folder FileInfo[] Files = d.GetFiles("*.txt"); //Getting Text files allFiles = new List <FileInfo>(); foreach (FileInfo file in Files) { allFiles.Add(file); } if (allFiles.Count == 0) { MessageBox.Show("Error, cannot find any .txt files in specified folder"); return; } //do a dialog if (MessageBox.Show("There are a total of " + allFiles.Count.ToString() + " log files to be decrypted, are you sure? Pressing yes will start the Analysis process.", "Log Analysis", MessageBoxButtons.YesNo) == DialogResult.Yes) { AnalysisWindow aw = new AnalysisWindow(); this.Hide(); aw.Show(); aw.CacheSelector(this); aw.InitializeAnalysis(allFiles.ToArray(), currentFolder); } //writing out some comments } }