diff --git a/ListFiles.sln b/ListFiles.sln index a026aef..f601ff4 100644 --- a/ListFiles.sln +++ b/ListFiles.sln @@ -1,18 +1,20 @@  -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C# Express 2010 +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 14 +VisualStudioVersion = 14.0.25420.1 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ListFiles", "ListFiles\ListFiles.csproj", "{81CC015E-7296-413E-AF57-B6A8CC94662A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x86 = Debug|x86 - Release|x86 = Release|x86 + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {81CC015E-7296-413E-AF57-B6A8CC94662A}.Debug|x86.ActiveCfg = Debug|x86 - {81CC015E-7296-413E-AF57-B6A8CC94662A}.Debug|x86.Build.0 = Debug|x86 - {81CC015E-7296-413E-AF57-B6A8CC94662A}.Release|x86.ActiveCfg = Release|x86 - {81CC015E-7296-413E-AF57-B6A8CC94662A}.Release|x86.Build.0 = Release|x86 + {81CC015E-7296-413E-AF57-B6A8CC94662A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {81CC015E-7296-413E-AF57-B6A8CC94662A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {81CC015E-7296-413E-AF57-B6A8CC94662A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {81CC015E-7296-413E-AF57-B6A8CC94662A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ListFiles/Form1.Designer.cs b/ListFiles/Form1.Designer.cs index 0caebae..488bfe5 100644 --- a/ListFiles/Form1.Designer.cs +++ b/ListFiles/Form1.Designer.cs @@ -36,6 +36,9 @@ this.showFullPathsBox = new System.Windows.Forms.CheckBox(); this.searchPatternBox = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); + this.checkBox1 = new System.Windows.Forms.CheckBox(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.linkLabel1 = new System.Windows.Forms.LinkLabel(); this.filesBox = new System.Windows.Forms.RichTextBox(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); @@ -56,34 +59,34 @@ this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(633, 29); + this.tableLayoutPanel1.Size = new System.Drawing.Size(710, 39); this.tableLayoutPanel1.TabIndex = 0; // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(3, 8); + this.label1.Location = new System.Drawing.Point(3, 11); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(55, 13); + this.label1.Size = new System.Drawing.Size(68, 17); this.label1.TabIndex = 0; this.label1.Text = "Directory :"; // // directoryBox // this.directoryBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.directoryBox.Location = new System.Drawing.Point(64, 4); + this.directoryBox.Location = new System.Drawing.Point(77, 7); this.directoryBox.Name = "directoryBox"; - this.directoryBox.Size = new System.Drawing.Size(480, 20); + this.directoryBox.Size = new System.Drawing.Size(524, 25); this.directoryBox.TabIndex = 1; this.directoryBox.TextChanged += new System.EventHandler(this.directoryBox_TextChanged); // // browseButton // this.browseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.browseButton.Location = new System.Drawing.Point(550, 3); + this.browseButton.Location = new System.Drawing.Point(607, 4); this.browseButton.Name = "browseButton"; - this.browseButton.Size = new System.Drawing.Size(80, 23); + this.browseButton.Size = new System.Drawing.Size(100, 30); this.browseButton.TabIndex = 2; this.browseButton.Text = "Browse..."; this.browseButton.UseVisualStyleBackColor = true; @@ -92,64 +95,104 @@ // showFileExtensionsBox // this.showFileExtensionsBox.AutoSize = true; - this.showFileExtensionsBox.Location = new System.Drawing.Point(148, 70); + this.showFileExtensionsBox.Location = new System.Drawing.Point(143, 59); this.showFileExtensionsBox.Name = "showFileExtensionsBox"; - this.showFileExtensionsBox.Size = new System.Drawing.Size(126, 17); - this.showFileExtensionsBox.TabIndex = 1; - this.showFileExtensionsBox.Text = "Show File Extensions"; + this.showFileExtensionsBox.Size = new System.Drawing.Size(144, 21); + this.showFileExtensionsBox.TabIndex = 2; + this.showFileExtensionsBox.Text = "Show file extensions"; this.showFileExtensionsBox.UseVisualStyleBackColor = true; this.showFileExtensionsBox.CheckedChanged += new System.EventHandler(this.showFileExtensionsBox_CheckedChanged); // // showFullPathsBox // this.showFullPathsBox.AutoSize = true; - this.showFullPathsBox.Location = new System.Drawing.Point(12, 70); + this.showFullPathsBox.Location = new System.Drawing.Point(12, 59); this.showFullPathsBox.Name = "showFullPathsBox"; - this.showFullPathsBox.Size = new System.Drawing.Size(102, 17); + this.showFullPathsBox.Size = new System.Drawing.Size(115, 21); this.showFullPathsBox.TabIndex = 1; - this.showFullPathsBox.Text = "Show Full Paths"; + this.showFullPathsBox.Text = "Show full paths"; this.showFullPathsBox.UseVisualStyleBackColor = true; this.showFullPathsBox.CheckedChanged += new System.EventHandler(this.showFullPathsBox_CheckedChanged); // // searchPatternBox // - this.searchPatternBox.Location = new System.Drawing.Point(401, 67); + this.searchPatternBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.searchPatternBox.Location = new System.Drawing.Point(416, 57); this.searchPatternBox.Name = "searchPatternBox"; - this.searchPatternBox.Size = new System.Drawing.Size(100, 20); - this.searchPatternBox.TabIndex = 3; + this.searchPatternBox.Size = new System.Drawing.Size(306, 25); + this.searchPatternBox.TabIndex = 6; this.searchPatternBox.TextChanged += new System.EventHandler(this.searchPatternBox_TextChanged); // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(311, 71); + this.label2.Location = new System.Drawing.Point(311, 60); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(84, 13); - this.label2.TabIndex = 4; + this.label2.Size = new System.Drawing.Size(99, 17); + this.label2.TabIndex = 5; this.label2.Text = "Search Pattern :"; // + // checkBox1 + // + this.checkBox1.AutoSize = true; + this.checkBox1.Checked = true; + this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBox1.Location = new System.Drawing.Point(12, 86); + this.checkBox1.Name = "checkBox1"; + this.checkBox1.Size = new System.Drawing.Size(85, 21); + this.checkBox1.TabIndex = 3; + this.checkBox1.Text = "Show files"; + this.checkBox1.UseVisualStyleBackColor = true; + this.checkBox1.CheckedChanged += new System.EventHandler(this.showFullPathsBox_CheckedChanged); + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Location = new System.Drawing.Point(143, 86); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(124, 21); + this.checkBox2.TabIndex = 4; + this.checkBox2.Text = "Show directories"; + this.checkBox2.UseVisualStyleBackColor = true; + this.checkBox2.CheckedChanged += new System.EventHandler(this.showFullPathsBox_CheckedChanged); + // + // linkLabel1 + // + this.linkLabel1.AutoSize = true; + this.linkLabel1.Location = new System.Drawing.Point(650, 90); + this.linkLabel1.Name = "linkLabel1"; + this.linkLabel1.Size = new System.Drawing.Size(72, 17); + this.linkLabel1.TabIndex = 7; + this.linkLabel1.TabStop = true; + this.linkLabel1.Text = "Refresh list"; + this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked); + // // filesBox // this.filesBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.filesBox.Location = new System.Drawing.Point(12, 93); + this.filesBox.Location = new System.Drawing.Point(12, 113); this.filesBox.Name = "filesBox"; - this.filesBox.Size = new System.Drawing.Size(633, 400); - this.filesBox.TabIndex = 5; + this.filesBox.Size = new System.Drawing.Size(710, 441); + this.filesBox.TabIndex = 8; this.filesBox.Text = ""; // // Form1 // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(657, 505); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.ClientSize = new System.Drawing.Size(734, 566); this.Controls.Add(this.filesBox); + this.Controls.Add(this.linkLabel1); this.Controls.Add(this.label2); this.Controls.Add(this.searchPatternBox); + this.Controls.Add(this.checkBox2); + this.Controls.Add(this.checkBox1); this.Controls.Add(this.showFullPathsBox); this.Controls.Add(this.showFileExtensionsBox); this.Controls.Add(this.tableLayoutPanel1); + this.Font = new System.Drawing.Font("Segoe UI", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "ListFiles"; @@ -170,6 +213,9 @@ private System.Windows.Forms.CheckBox showFullPathsBox; private System.Windows.Forms.TextBox searchPatternBox; private System.Windows.Forms.Label label2; + private System.Windows.Forms.CheckBox checkBox1; + private System.Windows.Forms.CheckBox checkBox2; + private System.Windows.Forms.LinkLabel linkLabel1; private System.Windows.Forms.RichTextBox filesBox; } } diff --git a/ListFiles/Form1.cs b/ListFiles/Form1.cs index eea7bc4..f1ff8d6 100644 --- a/ListFiles/Form1.cs +++ b/ListFiles/Form1.cs @@ -3,6 +3,7 @@ using System.Timers; using System.Windows.Forms; using Timer = System.Timers.Timer; using System.IO; +using System.Collections.Generic; namespace ListFiles { @@ -55,8 +56,25 @@ namespace ListFiles if (!Directory.Exists(dir)) return; - Directory.GetFi - var files = Directory.GetFiles(dir, SearchPattern); + + var list = new List(); + + if (checkBox1.Checked) + list.AddRange(GetFileList(dir)); + + if (checkBox2.Checked) + list.AddRange(GetDirectoryList(dir)); + + list.Sort(); + + foreach (var path in list) + filesBox.AppendText(path + Environment.NewLine); + } + + private List GetFileList(string searchPath) + { + var list = new List(); + var files = Directory.GetFiles(searchPath, SearchPattern); var showExt = showFileExtensionsBox.Checked; var showPath = showFullPathsBox.Checked; @@ -65,13 +83,36 @@ namespace ListFiles var ext = Path.GetExtension(file); var name = Path.GetFileNameWithoutExtension(file); - var path = showPath ? Path.Combine(dir, name) : name; + var path = showPath ? Path.Combine(searchPath, name) : name; if (showExt) path += ext; - filesBox.AppendText(path + Environment.NewLine); + list.Add(path); } + + return list; + } + + private List GetDirectoryList(string searchPath) + { + var list = new List(); + var showPath = showFullPathsBox.Checked; + + if (showPath) + { + list.AddRange(Directory.GetDirectories(searchPath)); + } + else + { + foreach (var dir in Directory.GetDirectories(searchPath)) + { + var name = Path.GetFileNameWithoutExtension(dir); + list.Add(name); + } + } + + return list; } private void showFullPathsBox_CheckedChanged(object sender, EventArgs e) @@ -89,5 +130,10 @@ namespace ListFiles updateTimer.Stop(); updateTimer.Start(); } + + private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + UpdateList(); + } } } diff --git a/ListFiles/ListFiles.csproj b/ListFiles/ListFiles.csproj index 73e9000..b9ac460 100644 --- a/ListFiles/ListFiles.csproj +++ b/ListFiles/ListFiles.csproj @@ -13,6 +13,23 @@ v4.0 Client 512 + false + \\SERVER4\Data\Software\ListFiles\ + true + Unc + true + Background + 7 + Days + false + false + true + Rogers Engineering + 2 + 2.0.0.%2a + false + true + true x86 @@ -33,6 +50,42 @@ prompt 4 + + true + bin\Debug\ + DEBUG;TRACE + full + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + bin\Release\ + TRACE + true + pdbonly + AnyCPU + prompt + MinimumRecommendedRules.ruleset + + + FE39E3AAE22D662C6E86BA34AA85E4E6CEBF01EC + + + ListFiles_TemporaryKey.pfx + + + true + + + LocalIntranet + + + Properties\app.manifest + + + true + @@ -66,6 +119,8 @@ True Resources.resx + + SettingsSingleFileGenerator Settings.Designer.cs @@ -76,6 +131,23 @@ True + + + False + Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 4.5 + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file