private void btnMultipleFile_Click(object sender, EventArgs e) { try { var files = Directory.GetFiles(Application.StartupPath + @"\\LogDataFiles").FirstOrDefault(); if (files != null) { File.Delete(files); } // this.Height = buttonAnalyze.Top + buttonAnalyze.Height + 50; advancedDataGridView1.DataSource = null; FilePath.Clear(); txtFilePath.Clear(); isMultipleFileSelected = true; btnSubmit.Enabled = true; buttonAnalyze.Enabled = false; OpenFileDialog openFileDialog = new OpenFileDialog { Title = "Browse a Log File", CheckFileExists = true, CheckPathExists = true, DefaultExt = "log", Filter = "Log files (*.log)|*.log", FilterIndex = 2, RestoreDirectory = true, ReadOnlyChecked = true, ShowReadOnly = true, Multiselect = true }; if (openFileDialog.ShowDialog() == DialogResult.OK) { FileManager.TotalNoofFiles = openFileDialog.FileNames.Count(); foreach (string file in openFileDialog.FileNames) { FileStream fs = new FileStream(file, FileMode.Open, FileAccess.Read); // int SizeofFile = (int)Math.Ceiling((double)fs.Length); if (FileManager.GetFileSize(file) > 300) { if (MessageBox.Show("Selected file is more than 300 mb. Plesae split it into Chunks", "Chunks Required!!", MessageBoxButtons.OKCancel) == DialogResult.OK) { FileName = file; var splitForm = new frmSplitFile(); this.Hide(); splitForm.Show(); } else { return; } } FilePath.Add(file); txtFilePath.Text += Path.GetFileName(file) + Environment.NewLine; } Size size = TextRenderer.MeasureText(txtFilePath.Text, txtFilePath.Font); txtFilePath.Height = size.Height + 20; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnFileSplitter_Click(object sender, EventArgs e) { var splitForm = new frmSplitFile(); splitForm.Show(); }