Skip to content

Commit

Permalink
V1.0.1 - Small first use fixes & Error log writing
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefangansevles committed Apr 7, 2019
1 parent 0c69460 commit 14a10ae
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 12 deletions.
18 changes: 17 additions & 1 deletion Business Logic Layer/BLIO.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Data_Access_Layer;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Expand All @@ -10,9 +11,24 @@ namespace Business_Logic_Layer
{
public class BLIO
{
/// <summary>
/// Writes an error to the errorlog.txt
/// </summary>
/// <param name="ex">The occured exception</param>
/// <param name="message">A short message i.e "Error while loading reminders"</param>
/// <param name="showErrorPopup">true to pop up an additional windows form to show the user that an error has occured</param>
public static void WriteError(Exception ex, string message)
{

//The bunifu framework makes a better looking ui, but it also throws annoying null reference exceptions when disposing an form/usercontrol
//that has an bunifu control in it(like a button), while there shouldn't be an exception.
if ((ex is System.Runtime.InteropServices.ExternalException) && ex.Source == "System.Drawing" && ex.Message.Contains("GDI+"))
return;

using (FileStream fs = new FileStream(IOVariables.errorLog, FileMode.Append))
using (StreamWriter sw = new StreamWriter(fs))
{
sw.WriteLine("[" + DateTime.Now + "] - " + message + "\r\n" + ex.ToString() + "\r\n\r\n");
}
}
public static void CreateDatabaseIfNotExist()
{
Expand Down
2 changes: 1 addition & 1 deletion ClipboardWatcher2.0/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public MainForm()
_clipboardViewerNext = SetClipboardViewer(this.Handle); // Adds our form to the chain
AppDomain.CurrentDomain.SetData("DataDirectory", IOVariables.databaseFile);

Directory.CreateDirectory(IOVariables.rootFolder);
Directory.CreateDirectory(IOVariables.clipboardWatcherLocalFolder);
BLIO.CreateDatabaseIfNotExist();

//Create folders if they dont exist
Expand Down
7 changes: 1 addition & 6 deletions ClipboardWatcher2.0/IOVariables.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,7 @@ private IOVariables() { } // No reason to make an instance of this class
/// <summary>
/// Contains the startup folder path.
/// </summary>
public static readonly string startupFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup);

/// <summary>
/// Contains the path to the root folder of RemindMe
/// </summary>
public static readonly string rootFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\ClipboardWatcher\";
public static readonly string startupFolderPath = Environment.GetFolderPath(Environment.SpecialFolder.Startup);

/// <summary>
/// Returns the version of ClipboardWatcher. Read from the assembly
Expand Down
1 change: 0 additions & 1 deletion ClipboardWatcher2.0/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs ar
//All uncaught exceptions will go here instead. We will replace the default windows popup with our own custom one and filter out what kind of exception is being thrown
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{

ErrorPrompt p = new ErrorPrompt(e.Exception); p.Show();

if (e.Exception is SettingsException)
Expand Down
4 changes: 2 additions & 2 deletions ClipboardWatcher2.0/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// 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")]
[assembly: AssemblyVersion("1.0.1")]
[assembly: AssemblyFileVersion("1.0.1")]
3 changes: 2 additions & 1 deletion ClipboardWatcher2.0/Version history.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
(7-4-2019) V1.0.0 - Initial release of re-written ClipboardWatcher
(7-4-2019) V1.0.0 - Initial release of re-written ClipboardWatcher
(7-4-2019) V1.0.1 - Small first use fixes & Error log writing
Binary file modified SetupClipboardWatcher.msi
Binary file not shown.

0 comments on commit 14a10ae

Please sign in to comment.