public void GetFiles1_All() { FilesOperator filesOperator = new FilesOperator(directory); string[] filesFromMask = filesOperator.GetFiles(false, false); Assert.IsTrue(CollectionUtil<string>.HaveSameElements(new List<string>(files), new List<string>(filesFromMask))); }
public void GetFiles2_OneFile_LowercaseExtension() { FilesOperator filesOperator = new FilesOperator(directory, "*.txt"); string[] filesFromMask = filesOperator.GetFiles(false, false); List<string> expectedFiles = new List<string>(); expectedFiles.Add("Text File.txt"); Assert.IsTrue(CollectionUtil<string>.HaveSameElements(expectedFiles, new List<string>(filesFromMask))); }
private void FilesForm_Load(object sender, EventArgs e) { // Files filesOperator = new FilesOperator(); dataGridViewFiles.DataSource = filesOperator.FilesData; dataGridViewFiles.AllowUserToAddRows = false; dataGridViewFiles.AllowUserToResizeRows = false; dataGridViewFiles.RowHeadersVisible = false; dataGridViewFiles.Columns[(int)FilesColumns.Selected].HeaderText = ""; dataGridViewFiles.Columns[(int)FilesColumns.Selected].ReadOnly = false; dataGridViewFiles.Columns[(int)FilesColumns.Selected].Width = 25; dataGridViewFiles.Columns[(int)FilesColumns.Selected].Resizable = DataGridViewTriState.False; dataGridViewFiles.Columns[(int)FilesColumns.Selected].SortMode = DataGridViewColumnSortMode.Automatic; dataGridViewFiles.Columns[(int)FilesColumns.CurrentFileName].ReadOnly = true; dataGridViewFiles.Columns[(int)FilesColumns.CurrentFileName].Width = 200; dataGridViewFiles.Columns[(int)FilesColumns.NewFileName].ReadOnly = false; dataGridViewFiles.Columns[(int)FilesColumns.NewFileName].Width = 200; dataGridViewFiles.Columns[(int)FilesColumns.Masked].Visible = false; dataGridViewFiles.Columns[(int)FilesColumns.CurrentDirectory].Visible = false; dataGridViewFiles.Columns[(int)FilesColumns.NewDirectory].Visible = false; #if DEBUG filesOperator.CurrentDirectory = @"C:\Users\Public\Shared\Documents\Posts"; filesOperator.CommandAgent.Commands.Add(new CommandInsertByPosition(0, BeginningEnd.Beginning, "test")); filesOperator.CommandAgent.Commands.Add(new CommandInsertByPosition(3, BeginningEnd.Beginning, "X")); #else files.CurrentDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop); #endif // Files Mask comboBoxMask.Items.Add(new DropDownItem("All Files", true, "*.*")); comboBoxMask.Items.Add(new DropDownItem("All Images", false, "*.jpg", ".jpeg", "*.png", "*.tif", "*.tiff", "*.gif", "*.bmp")); comboBoxMask.Items.Add(new DropDownItem("jpegs", false, "*.jpg", ".jpeg")); comboBoxMask.Items.Add(new DropDownItem("png", false, "*.png")); comboBoxMask.SelectedIndex = 0; RefreshDirectory(); // Commands listBoxCommands.DataSource = filesOperator.CommandAgent.Commands; listBoxCommands.ClearSelected(); filesOperator.CommandAgent.PropertyChanged += new PropertyChangedEventHandler(this.Commands_ListChanged); }