| 39 | } |
| 40 | |
| 41 | int main(string[] args) |
| 42 | { |
| 43 | try { |
| 44 | opt = new StartupOption(args); |
| 45 | } catch (Exception ex) { |
| 46 | using (var logger = new SetupLogLogger(true, "OptionParsing") { Level = LogLevel.Info }) { |
| 47 | SquirrelLocator.CurrentMutable.Register(() => logger, typeof(Squirrel.SimpleSplat.ILogger)); |
| 48 | logger.Write($"Failed to parse command line options. {ex.Message}", LogLevel.Error); |
| 49 | } |
| 50 | throw; |
| 51 | } |
| 52 | |
| 53 | // NB: Trying to delete the app directory while we have Setup.log |
| 54 | // open will actually crash the uninstaller |
| 55 | bool isUninstalling = opt.updateAction == UpdateAction.Uninstall; |
| 56 | |
| 57 | using (var logger = new SetupLogLogger(isUninstalling, opt.updateAction.ToString()) {Level = LogLevel.Info}) { |
| 58 | SquirrelLocator.CurrentMutable.Register(() => logger, typeof (SimpleSplat.ILogger)); |
| 59 | |
| 60 | try { |
| 61 | return executeCommandLine(args); |
| 62 | } catch (Exception ex) { |
| 63 | logger.Write("Finished with unhandled exception: " + ex, LogLevel.Fatal); |
| 64 | throw; |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | int executeCommandLine(string[] args) |
| 70 | { |