static void Main(string[] args) { DBGLOG = ""; SIGN_BINARY = false; CRASH_REPORTER = true; IGNORE_EXCEPTIONS = false; VERIFY_CHECKSUM = true; BALLOONS = true; ASK_DFC = true; Program.args = args; foreach (string str in args) { if (str == "sign") { SIGN_BINARY = true; } if (str == "exceptions") { CRASH_REPORTER = false; } if (str == "unsigned") { VERIFY_CHECKSUM = false; } if (str == "no_dfc") { ASK_DFC = false; } } if (CRASH_REPORTER) { AppDomain.CurrentDomain.UnhandledException += (ueSender, ueArgs) => { if (IGNORE_EXCEPTIONS) { return; } new UI_Exception(ueArgs.ExceptionObject as Exception, 1); }; Application.ThreadException += (ueSender, ueArgs) => { if (IGNORE_EXCEPTIONS) { return; } new UI_Exception(ueArgs.Exception, 2); }; Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); } if (!debug) { AppDomain.CurrentDomain.AssemblyResolve += (sender, dargs) => { // workaround for win7 custom themes if (dargs.Name.Contains("PresentationFramework")) { return(null); } // vs2019 if (dargs.Name.StartsWith("Loopstream.XmlSerializers")) { return(null); } String resourceName = "Loopstream.lib." + dargs.Name.Substring(0, dargs.Name.IndexOf(", ")) + ".dll"; using (var stream = Assembly.GetExecutingAssembly(). GetManifestResourceStream(resourceName)) { if (stream == null) { return(null); } Byte[] assemblyData = new Byte[stream.Length]; stream.Read(assemblyData, 0, assemblyData.Length); return(Assembly.Load(assemblyData)); } }; } if (!debug) { IconExtractor ie = new IconExtractor(Application.ExecutablePath); icon = ie.GetIcon(0); ie.Dispose(); } else { icon = new System.Drawing.Icon(@"..\..\res\loopstream.ico"); } tools = System.Windows.Forms.Application.ExecutablePath; tools = tools.Substring(tools.Replace('\\', '/').LastIndexOf('/') + 1); tools = tools.Split('.')[0]; tools += "Tools\\"; System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.AboveNormal; Logger.init(); Skinner.init(); rnd = new Random(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Home()); }
static void Main(string[] args) { DBGLOG = ""; SIGN_BINARY = false; CRASH_REPORTER = true; VERIFY_CHECKSUM = true; Program.args = args; foreach (string str in args) { if (str == "sign") SIGN_BINARY = true; if (str == "exceptions") CRASH_REPORTER = false; if (str == "unsigned") VERIFY_CHECKSUM = false; } if (CRASH_REPORTER) { AppDomain.CurrentDomain.UnhandledException += (ueSender, ueArgs) => new UI_Exception(ueArgs.ExceptionObject as Exception, 1).ShowDialog(); Application.ThreadException += (ueSender, ueArgs) => new UI_Exception(ueArgs.Exception, 2).ShowDialog(); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); } if (!debug) { AppDomain.CurrentDomain.AssemblyResolve += (sender, dargs) => { // workaround for win7 custom themes if (dargs.Name.Contains("PresentationFramework")) return null; String resourceName = "Loopstream.lib." + dargs.Name.Substring(0, dargs.Name.IndexOf(", ")) + ".dll"; using (var stream = Assembly.GetExecutingAssembly(). GetManifestResourceStream(resourceName)) { if (stream == null) return null; Byte[] assemblyData = new Byte[stream.Length]; stream.Read(assemblyData, 0, assemblyData.Length); return Assembly.Load(assemblyData); } }; } if (!debug) { IconExtractor ie = new IconExtractor(Application.ExecutablePath); icon = ie.GetIcon(0); ie.Dispose(); } else icon = new System.Drawing.Icon(@"..\..\res\loopstream.ico"); tools = System.Windows.Forms.Application.ExecutablePath; tools = tools.Substring(tools.Replace('\\', '/').LastIndexOf('/') + 1); tools = tools.Split('.')[0]; tools += "Tools\\"; System.Diagnostics.Process.GetCurrentProcess().PriorityClass = System.Diagnostics.ProcessPriorityClass.AboveNormal; Logger.init(); Skinner.init(); rnd = new Random(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Home()); }