From 9b7625f2aeeeab4a40ff6a3818e175b79eaa4c5a Mon Sep 17 00:00:00 2001 From: 1987kostya Date: Sun, 27 Dec 2020 10:31:59 +0600 Subject: [PATCH] Removed custom error logging, because it may cause bugs for some users --- CTFAK/GUI/MainForm.cs | 8 +++++++- CTFAK/MMFParser/EXE/ChunkList.cs | 2 +- CTFAK/Program.cs | 22 +++++++++++++++++----- CTFAK/Utils/Logger.cs | 4 ++-- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/CTFAK/GUI/MainForm.cs b/CTFAK/GUI/MainForm.cs index be367a1..aae5713 100644 --- a/CTFAK/GUI/MainForm.cs +++ b/CTFAK/GUI/MainForm.cs @@ -125,7 +125,13 @@ namespace DotNetCTFDumper.GUI private void openFileDialog1_FileOk(object sender, CancelEventArgs e) { var worker = new BackgroundWorker(); - worker.DoWork += (workSender, workE) => StartReading(); + worker.DoWork += (workSender, workE) => + { + if(File.Exists(openFileDialog1.FileName)) StartReading(); + else throw new NotImplementedException("File not found"); + + + }; worker.RunWorkerCompleted += (workSender, workE) => { diff --git a/CTFAK/MMFParser/EXE/ChunkList.cs b/CTFAK/MMFParser/EXE/ChunkList.cs index a392b85..ce75efc 100644 --- a/CTFAK/MMFParser/EXE/ChunkList.cs +++ b/CTFAK/MMFParser/EXE/ChunkList.cs @@ -250,7 +250,7 @@ namespace DotNetCTFDumper.MMFParser.EXE } - if (loader != null) loader.Read(); + loader?.Read(); return loader; } diff --git a/CTFAK/Program.cs b/CTFAK/Program.cs index 80566fb..b4cf371 100644 --- a/CTFAK/Program.cs +++ b/CTFAK/Program.cs @@ -32,8 +32,20 @@ namespace DotNetCTFDumper var dumpSounds = true; AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) => { - var error = new ErrorLogBox(eventArgs.Exception); - Application.Run(error); + Logger.Log("ERROR: "); + Logger.Log(eventArgs.Exception.ToString()); + /*ErrorLogBox error = null; + try + { + error = new ErrorLogBox(eventArgs.Exception); + } + finally + { + Application.Run(error); + }*/ + + + }; Settings.UseGUI = true; @@ -42,7 +54,7 @@ namespace DotNetCTFDumper { MyForm = new MainForm(Color.FromName(args[0])); } - else + else if(args.Length==0) { MyForm = new MainForm(Color.FromArgb(223, 114, 38)); } @@ -52,7 +64,7 @@ namespace DotNetCTFDumper - if (args.Length > 0 && (args[0] == "-h" || args[0] == "-help")) + /*if (args.Length > 0 && (args[0] == "-h" || args[0] == "-help")) { Logger.Log("DotNetCTFDumper: 0.0.5", true, ConsoleColor.Green); Logger.Log("Lauch Args:", true, ConsoleColor.Green); @@ -68,7 +80,7 @@ namespace DotNetCTFDumper Environment.Exit(0); } - if (args.Length > 1) ReadFile(path, verbose, dumpImages, dumpSounds); + if (args.Length > 1) ReadFile(path, verbose, dumpImages, dumpSounds);*/ } public static void ReadFile(string path, bool verbose = false, bool dumpImages = false, bool dumpSounds = true) diff --git a/CTFAK/Utils/Logger.cs b/CTFAK/Utils/Logger.cs index a740a94..bbc1575 100644 --- a/CTFAK/Utils/Logger.cs +++ b/CTFAK/Utils/Logger.cs @@ -12,8 +12,8 @@ namespace DotNetCTFDumper.Utils { if (_writer == null) { - File.Delete("Dump.log"); - _writer = new StreamWriter("Dump.log", true); + File.Delete("NewLog.log"); + _writer = new StreamWriter("NewLog.log", true); _writer.AutoFlush = true; }