static void Main(string[] args) { try { Environment.SetEnvironmentVariable("CBLOADER", Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)); FileManager fm = new FileManager(); StartupFlags sf = new StartupFlags(); sf.LoadFromConfig(fm); // Don't require the config file. (Especially before checking we're in the right directory) if (!sf.ParseCmdArgs(args, fm)) { return; } Log.Info(String.Format("CBLoader version {0}", Version)); CheckWorkingDirectory(); fm.AddCustomFolder("custom"); if (sf.CheckForUpdates && sf.UpdateFirst) { fm.DoUpdates(sf.ForcedReload); } if (!sf.Mergelater) { fm.ExtractAndMerge(sf.ForcedReload); } if (sf.LoadExec) { if (sf.PatchFile) { ProcessManager.StartProcessAndPatchFile(); } else { ProcessManager.StartProcessAndPatchMemory(); } } if (sf.Mergelater) { fm.ExtractAndMerge(sf.ForcedReload); } Utils.CheckIfUserAssoc(); // And here's the better alternated to DCUpdater. if (sf.CheckForUpdates && fm.DoUpdates(sf.ForcedReload)) { Log.Info("Character Builder has already been launched.\n The following merges are not a bug, and not slowing down the loading of CB."); fm.ExtractAndMerge(sf.ForcedReload); } if (sf.CheckForUpdates) // App Updates { Utils.CheckForNewVersion(Version); } } catch (Exception e) { Log.Error(String.Empty, e); } if (Log.ErrorLogged) { Log.Info("Errors Encountered While Loading. Would you like to open the log file? (y/n)"); if (Console.ReadKey().Key == ConsoleKey.Y) { Process p = new Process(); p.StartInfo = new ProcessStartInfo("notepad.exe", Log.LogFile); p.Start(); } } }
static void Main(string[] args) { try { Environment.SetEnvironmentVariable("CBLOADER", Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location)); FileManager fm = new FileManager(); StartupFlags sf = new StartupFlags(); sf.LoadFromConfig(fm); // Don't require the config file. (Especially before checking we're in the right directory) if (!sf.ParseCmdArgs(args, fm)) { return; } Log.Info(String.Format("CBLoader version {0}", Version)); CheckWorkingDirectory(); fm.AddCustomFolder("custom"); if (sf.CheckForUpdates && sf.UpdateFirst) { fm.DoUpdates(sf.ForcedReload); } if (!sf.Mergelater) { fm.ExtractAndMerge(sf.ForcedReload); } if (sf.LoadExec) { if (sf.PatchFile) { ProcessManager.StartProcessAndPatchFile(); } else { ProcessManager.StartProcessAndPatchMemory(); } } if (sf.Mergelater) { fm.ExtractAndMerge(sf.ForcedReload); } Utils.CheckIfUserAssoc(); // And here's the better alternated to DCUpdater. if (sf.CheckForUpdates && fm.DoUpdates(sf.ForcedReload)) { Log.Info("Character Builder has already been launched.\n The following merges are not a bug, and not slowing down the loading of CB."); fm.ExtractAndMerge(sf.ForcedReload); } /* * // From Jeff: this is kinda creepy to have. We'll leave it for now though. * // Stephen: My only issue is the fact that it pops up as an additional cmd window for a quarter of a second. I'll find a better way of doing it. * // I've now made a better way of doing it. (See FileManager.CheckMetaData). This should now be Obsolete, and therefore removable. * // Checks for updates. http://www.donationcoder.com/Software/Mouser/Updater/help/index.html for details. * if (File.Exists("dcuhelper.exe")) * { * // Eventually I want to keep CBLoader up to date with it; for now, leave it there for the sole * // purpose of sharing my homebrew with my players. The useful thing about DCUpdater is that it can handle multiple update files with no extra effort, just put them into the folder. * ProcessStartInfo dcuhelper = new ProcessStartInfo("dcuhelper.exe", "-ri \"CBLoader\" \".\" \".\" -shownew -check -nothingexit"); * dcuhelper.WindowStyle = ProcessWindowStyle.Minimized; * Process.Start(dcuhelper); * } */ } catch (Exception e) { Log.Error(String.Empty, e); } if (Log.ErrorLogged) { Log.Info("Errors Encountered While Loading. Would you like to open the log file? (y/n)"); if (Console.ReadKey().Key == ConsoleKey.Y) { Process p = new Process(); p.StartInfo = new ProcessStartInfo("notepad.exe", Log.LogFile); p.Start(); } } }