diff --git a/README.md b/README.md index af1d04e..d838699 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Features Screenshots ----------- -![Screenshot 1](https://raw.github.com/leetNightshade/leetNightshade.github.io/master/FileWatcher/Screenshots/2013-12-22%2013_15_41-FileWatcher.png) +![Screenshot 1](https://git.leetnightshade.com/leetnightshade/git.leetnightshade.com/raw/branch/master/FileWatcher/Screenshots/2013-12-22%2013_15_41-FileWatcher.png) Examples for use ----------- diff --git a/bin/FileWatcher.exe b/bin/FileWatcher.exe index 1e5a1ed..ba56282 100644 Binary files a/bin/FileWatcher.exe and b/bin/FileWatcher.exe differ diff --git a/code/build/FileWatcher.csproj b/code/build/FileWatcher.csproj index b930b04..9a5fb67 100644 --- a/code/build/FileWatcher.csproj +++ b/code/build/FileWatcher.csproj @@ -173,7 +173,6 @@ ScriptManager.cs - SettingsSingleFileGenerator Settings.Designer.cs diff --git a/code/build/packages.config b/code/build/packages.config deleted file mode 100644 index 88a3709..0000000 --- a/code/build/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/code/libs/.gitkeep b/code/libs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/code/src/FileGroupTab.cs b/code/src/FileGroupTab.cs index 3645681..206e311 100644 --- a/code/src/FileGroupTab.cs +++ b/code/src/FileGroupTab.cs @@ -463,6 +463,10 @@ namespace FileWatcher { return; } + catch (DirectoryNotFoundException) + { + return; + } if (m_Timer.Enabled == false || Settings.restartDelayCB.Checked) { @@ -562,18 +566,18 @@ namespace FileWatcher m_TickCounter.Enabled = false; - Form1.Instance.notifyIcon1.ShowBalloonTip(1000, "Script Running", "Running '" + ScriptPath + "'", ToolTipIcon.Info); + //Form1.Instance.notifyIcon1.ShowBalloonTip(500, "Script Running", "Running '" + ScriptPath + "'", ToolTipIcon.Info); //scriptWorker.RunWorkerAsync(m_UpdatedFiles); - // run script in separate thread - Func, bool> updated = pyScope.GetVariable, bool>>("process_updated_files"); - try { - var updateFiles = m_UpdatedFiles; + var updateFiles = m_UpdatedFiles.ToList(); m_UpdatedFiles.Clear(); + // run script in separate thread + Func, bool> updated = pyScope.GetVariable, bool>>("process_updated_files"); + updated(updateFiles); Logger.Log("Just finished running '" + ScriptPath + "'"); @@ -602,6 +606,11 @@ namespace FileWatcher { Logger.Log("Directory not found exception in '" + ScriptPath + "':" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.TargetSite); } + else if (ex is System.IO.IOException) + { + Logger.Log("IOException in '" + ScriptPath + "':" + ex.Message + Environment.NewLine + ex.StackTrace + Environment.NewLine + ex.TargetSite); + Logger.Log("Your script had an IO exception, you should alter your script to catch individual file errors so you can try to process them all even when an exception happens. You may also want to alter your file IO in case you can get around this error."); + } else { Logger.Log("Error running '" + ScriptPath + "':" + ex.Message + Environment.NewLine + ex.StackTrace); diff --git a/code/src/NewFileGroup.cs b/code/src/NewFileGroup.cs index 4d3591b..53d6fbc 100644 --- a/code/src/NewFileGroup.cs +++ b/code/src/NewFileGroup.cs @@ -43,7 +43,10 @@ namespace FileWatcher private void createButton_Click(object sender, EventArgs e) { Directory.CreateDirectory(Path.GetDirectoryName(textBox3.Text)); - using (var fileStream = File.Open(textBox3.Text, FileMode.OpenOrCreate, FileAccess.ReadWrite)); + using (var fileStream = File.Open(textBox3.Text, FileMode.OpenOrCreate, FileAccess.ReadWrite)) + { + // don't do anything, just create the file. + }; } private void textBox3_KeyPress(object sender, KeyPressEventArgs e) diff --git a/code/src/Preferences.cs b/code/src/Preferences.cs index b57aa1f..84fc176 100644 --- a/code/src/Preferences.cs +++ b/code/src/Preferences.cs @@ -137,6 +137,8 @@ namespace FileWatcher } } + defaultPrograms.RemoveAll(str => !programs.ContainsKey(str) || !File.Exists(programs[str].Path)); + UnboundBindingList = new BindingList(defaultPrograms); foreach (string str in programs.Keys) { @@ -210,8 +212,12 @@ namespace FileWatcher { if (listBox1.SelectedValue != null) { - string path = programs[(string)listBox1.SelectedValue].Path; - textBox1.Text = path; + string selectedValue = (string)listBox1.SelectedValue; + if (programs.ContainsKey(selectedValue)) + { + string path = programs[(string)listBox1.SelectedValue].Path; + textBox1.Text = path; + } } } diff --git a/code/src/TimerPlus.cs b/code/src/TimerPlus.cs index fe56b2f..a2f4d2c 100644 --- a/code/src/TimerPlus.cs +++ b/code/src/TimerPlus.cs @@ -26,14 +26,14 @@ namespace FileWatcher { } - public void Start() + public new void Start() { m_Running = true; m_Start = DateTime.Now; base.Start(); } - public void Stop() + public new void Stop() { m_End = DateTime.Now; m_Running = false;