commit 543cf5a67f27f388b1113eff88f37c57335a50f5 Author: aj Date: Mon May 16 22:36:23 2016 -0400 First commit. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4008304 --- /dev/null +++ b/.gitignore @@ -0,0 +1,29 @@ + +#ignore thumbnails created by windows +Thumbs.db +#Ignore files build by Visual Studio +*.obj +*.exe +*.pdb +*.user +*.aps +*.pch +*.vspscc +*_i.c +*_p.c +*.ncb +*.suo +*.tlb +*.tlh +*.bak +*.cache +*.ilk +*.log +[Bb]in +[Dd]ebug*/ +*.lib +*.sbr +obj/ +[Rr]elease*/ +_ReSharper*/ +[Tt]est[Rr]esult* diff --git a/ListFiles.sln b/ListFiles.sln new file mode 100644 index 0000000..a026aef --- /dev/null +++ b/ListFiles.sln @@ -0,0 +1,20 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C# Express 2010 +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 + 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 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/ListFiles/Form1.Designer.cs b/ListFiles/Form1.Designer.cs new file mode 100644 index 0000000..0caebae --- /dev/null +++ b/ListFiles/Form1.Designer.cs @@ -0,0 +1,176 @@ +namespace ListFiles +{ + partial class Form1 + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.label1 = new System.Windows.Forms.Label(); + this.directoryBox = new System.Windows.Forms.TextBox(); + this.browseButton = new System.Windows.Forms.Button(); + this.showFileExtensionsBox = new System.Windows.Forms.CheckBox(); + this.showFullPathsBox = new System.Windows.Forms.CheckBox(); + this.searchPatternBox = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); + this.filesBox = new System.Windows.Forms.RichTextBox(); + this.tableLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.tableLayoutPanel1.AutoSize = true; + this.tableLayoutPanel1.ColumnCount = 3; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.directoryBox, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.browseButton, 2, 0); + this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12); + 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.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.Name = "label1"; + this.label1.Size = new System.Drawing.Size(55, 13); + 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.Name = "directoryBox"; + this.directoryBox.Size = new System.Drawing.Size(480, 20); + 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.Name = "browseButton"; + this.browseButton.Size = new System.Drawing.Size(80, 23); + this.browseButton.TabIndex = 2; + this.browseButton.Text = "Browse..."; + this.browseButton.UseVisualStyleBackColor = true; + this.browseButton.Click += new System.EventHandler(this.browseButton_Click); + // + // showFileExtensionsBox + // + this.showFileExtensionsBox.AutoSize = true; + this.showFileExtensionsBox.Location = new System.Drawing.Point(148, 70); + 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.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.Name = "showFullPathsBox"; + this.showFullPathsBox.Size = new System.Drawing.Size(102, 17); + this.showFullPathsBox.TabIndex = 1; + 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.Name = "searchPatternBox"; + this.searchPatternBox.Size = new System.Drawing.Size(100, 20); + this.searchPatternBox.TabIndex = 3; + 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.Name = "label2"; + this.label2.Size = new System.Drawing.Size(84, 13); + this.label2.TabIndex = 4; + this.label2.Text = "Search Pattern :"; + // + // 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.Name = "filesBox"; + this.filesBox.Size = new System.Drawing.Size(633, 400); + this.filesBox.TabIndex = 5; + 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.Controls.Add(this.filesBox); + this.Controls.Add(this.label2); + this.Controls.Add(this.searchPatternBox); + this.Controls.Add(this.showFullPathsBox); + this.Controls.Add(this.showFileExtensionsBox); + this.Controls.Add(this.tableLayoutPanel1); + this.Name = "Form1"; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "ListFiles"; + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.TextBox directoryBox; + private System.Windows.Forms.Button browseButton; + private System.Windows.Forms.CheckBox showFileExtensionsBox; + private System.Windows.Forms.CheckBox showFullPathsBox; + private System.Windows.Forms.TextBox searchPatternBox; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.RichTextBox filesBox; + } +} + diff --git a/ListFiles/Form1.cs b/ListFiles/Form1.cs new file mode 100644 index 0000000..eea7bc4 --- /dev/null +++ b/ListFiles/Form1.cs @@ -0,0 +1,93 @@ +using System; +using System.Timers; +using System.Windows.Forms; +using Timer = System.Timers.Timer; +using System.IO; + +namespace ListFiles +{ + public partial class Form1 : Form + { + private Timer updateTimer; + + public Form1() + { + InitializeComponent(); + + updateTimer = new Timer(); + updateTimer.AutoReset = false; + updateTimer.Interval = 200; + updateTimer.SynchronizingObject = this; + updateTimer.Elapsed += new ElapsedEventHandler(updateTimer_Elapsed); + } + + private string SearchPattern + { + get { return string.IsNullOrEmpty(searchPatternBox.Text) ? "*" : searchPatternBox.Text; } + } + + private void updateTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) + { + UpdateList(); + } + + private void browseButton_Click(object sender, EventArgs e) + { + var dlg = new FolderBrowserDialog(); + + if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) + { + directoryBox.Text = dlg.SelectedPath; + } + } + + private void directoryBox_TextChanged(object sender, EventArgs e) + { + updateTimer.Stop(); + updateTimer.Start(); + } + + private void UpdateList() + { + filesBox.Clear(); + + var dir = directoryBox.Text; + + if (!Directory.Exists(dir)) + return; + Directory.GetFi + var files = Directory.GetFiles(dir, SearchPattern); + var showExt = showFileExtensionsBox.Checked; + var showPath = showFullPathsBox.Checked; + + foreach (var file in files) + { + var ext = Path.GetExtension(file); + var name = Path.GetFileNameWithoutExtension(file); + + var path = showPath ? Path.Combine(dir, name) : name; + + if (showExt) + path += ext; + + filesBox.AppendText(path + Environment.NewLine); + } + } + + private void showFullPathsBox_CheckedChanged(object sender, EventArgs e) + { + UpdateList(); + } + + private void showFileExtensionsBox_CheckedChanged(object sender, EventArgs e) + { + UpdateList(); + } + + private void searchPatternBox_TextChanged(object sender, EventArgs e) + { + updateTimer.Stop(); + updateTimer.Start(); + } + } +} diff --git a/ListFiles/Form1.resx b/ListFiles/Form1.resx new file mode 100644 index 0000000..29dcb1b --- /dev/null +++ b/ListFiles/Form1.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ListFiles/ListFiles.csproj b/ListFiles/ListFiles.csproj new file mode 100644 index 0000000..73e9000 --- /dev/null +++ b/ListFiles/ListFiles.csproj @@ -0,0 +1,87 @@ + + + + Debug + x86 + 8.0.30703 + 2.0 + {81CC015E-7296-413E-AF57-B6A8CC94662A} + WinExe + Properties + ListFiles + ListFiles + v4.0 + Client + 512 + + + x86 + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + x86 + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + Form + + + Form1.cs + + + + + Form1.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + \ No newline at end of file diff --git a/ListFiles/Program.cs b/ListFiles/Program.cs new file mode 100644 index 0000000..04371d7 --- /dev/null +++ b/ListFiles/Program.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Windows.Forms; + +namespace ListFiles +{ + static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Form1()); + } + } +} diff --git a/ListFiles/Properties/AssemblyInfo.cs b/ListFiles/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2eb037e --- /dev/null +++ b/ListFiles/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("ListFiles")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Rogers Engineering & Manufacturing")] +[assembly: AssemblyProduct("ListFiles")] +[assembly: AssemblyCopyright("Copyright © Rogers Engineering & Manufacturing 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("a555825e-56da-4a06-9946-ddd2eb28f868")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/ListFiles/Properties/Resources.Designer.cs b/ListFiles/Properties/Resources.Designer.cs new file mode 100644 index 0000000..0763c28 --- /dev/null +++ b/ListFiles/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1022 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ListFiles.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ListFiles.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/ListFiles/Properties/Resources.resx b/ListFiles/Properties/Resources.resx new file mode 100644 index 0000000..ffecec8 --- /dev/null +++ b/ListFiles/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ListFiles/Properties/Settings.Designer.cs b/ListFiles/Properties/Settings.Designer.cs new file mode 100644 index 0000000..5a6a966 --- /dev/null +++ b/ListFiles/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.1022 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ListFiles.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/ListFiles/Properties/Settings.settings b/ListFiles/Properties/Settings.settings new file mode 100644 index 0000000..abf36c5 --- /dev/null +++ b/ListFiles/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + +