diff --git a/BTDToolbox/Console.cs b/BTDToolbox/Console.cs index a041bcc..2b580ab 100644 --- a/BTDToolbox/Console.cs +++ b/BTDToolbox/Console.cs @@ -145,20 +145,27 @@ public void CreateLogFile() } public void WriteToLogFile(string text) { - string logFile = Environment.CurrentDirectory + "\\ConsoleLog.txt"; - string logText = File.ReadAllText(logFile); + try + { + string logFile = Environment.CurrentDirectory + "\\ConsoleLog.txt"; + string logText = File.ReadAllText(logFile); - if(logText.Length > 0) - logText += "\n"; - logText += text; + if (logText.Length > 0) + logText += "\n"; + logText += text; - try + try + { + StreamWriter stream = new StreamWriter(logFile); + stream.Write(logText); + stream.Close(); + } + catch { }; + }catch(IOException) { - StreamWriter stream = new StreamWriter(logFile); - stream.Write(logText); - stream.Close(); + ConsoleHandler.append("couldn't save the console log"); } - catch { }; + } private void Sizer_MouseUp(object sender, MouseEventArgs e)