public void ExecuteTask(UpdaterContext context) { var octgnDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "OCTGN"); var octgnInstallPath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).Parent; var octgnUpdatePath = Path.Combine(octgnDataPath, "update.zip"); context.FireLog("Octgn install path : {0}",octgnInstallPath); context.FireLog("Octgn update file : {0}",octgnUpdatePath); context.FireLog(""); if(!context.FileSystem.File.Exists(octgnUpdatePath)) { context.FireLog("No update found."); return; } context.FireLog("Update exists. Unpacking."); using (var zip = ZipFile.Read(octgnUpdatePath)) { foreach( var p in zip ) { var unPath = Path.Combine(octgnInstallPath.FullName, p.FileName); context.FireLog("Extracting[{0}]: {1}",p.FileName,unPath); p.Extract(octgnInstallPath.FullName,ExtractExistingFileAction.OverwriteSilently); } } context.FireLog("Deleting update file."); context.FileSystem.File.Delete(octgnUpdatePath); }
public void ExecuteTask(UpdaterContext context) { var octgnDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "OCTGN"); var octgnInstallPath = Directory.GetParent(Assembly.GetExecutingAssembly().Location).Parent; var octgnUpdatePath = Path.Combine(octgnDataPath, "update.zip"); context.FireLog("Octgn install path : {0}", octgnInstallPath); context.FireLog("Octgn update file : {0}", octgnUpdatePath); context.FireLog(""); if (!context.FileSystem.File.Exists(octgnUpdatePath)) { context.FireLog("No update found."); return; } context.FireLog("Update exists. Unpacking."); using (var zip = ZipFile.Read(octgnUpdatePath)) { foreach (var p in zip) { var unPath = Path.Combine(octgnInstallPath.FullName, p.FileName); context.FireLog("Extracting[{0}]: {1}", p.FileName, unPath); p.Extract(octgnInstallPath.FullName, ExtractExistingFileAction.OverwriteSilently); } } context.FireLog("Deleting update file."); context.FileSystem.File.Delete(octgnUpdatePath); }
public void ExecuteTask(UpdaterContext context) { context.FireLog("Shutting down all instances of OCTGN..."); for (int i = 0; i < 120; i++) { var proc = Process.GetProcessesByName("OCTGN").FirstOrDefault(); if (proc == null) { context.FireLog("All instances of OCTGN shut down."); return; } proc.Kill(); Thread.Sleep(1000); } throw new ApplicationException("Can't shutdown OCTGN. Please kill it manually."); }
public void ExecuteTask(UpdaterContext context) { context.FireLog("Shutting down all instances of OCTGN..."); for (int i = 0; i < 120;i++ ) { var proc = Process.GetProcessesByName("OCTGN").FirstOrDefault(); if (proc == null) { context.FireLog("All instances of OCTGN shut down."); return; } proc.Kill(); Thread.Sleep(1000); } throw new ApplicationException("Can't shutdown OCTGN. Please kill it manually."); }
public RunCommand(UpdaterContext context) : base(Constants.Commands.RUN, context) { }
public Command(string name, UpdaterContext context) { Name = name; Context = context; }
public PatternCommand(string pattern, UpdaterContext context) : base(Constants.Commands.PATTERN, context) { this.Pattern = pattern; }
public ResetCommand(UpdaterContext context) : base(Constants.Commands.RESET, context) { }
public ReplaceUsingCommand(string old, string @new, UpdaterContext context) : base(Constants.Commands.REPLACE, context) { OldNamespace = old; NewNamespace = @new; }
public override void TaskComplete(UpdaterContext context, ITask task) { }
public override void TaskRunnerComplete(UpdaterContext context) { context.FireLog("Update Runner Complete."); }
public RecursiveCommand(UpdaterContext context) : base(Constants.Commands.RECURSIVE, context) { }
public StatusCommand(UpdaterContext context) : base(Constants.Commands.STATUS, context) { }
public AddUsingCommand(string @namespace, UpdaterContext context) : base(Constants.Commands.ADD, context) { this.Namespace = @namespace; }
public override void TaskFailed(UpdaterContext context, ITask task, Exception exception) { FailedUpdate = true; context.FireLog("Error: {0}", exception.Message); }
public SetDirCommand(string directory, UpdaterContext context) : base(Constants.Commands.SETDIR, context) { this.TargetDirectory = directory; }
public override void TaskFailed(UpdaterContext context, ITask task, Exception exception) { FailedUpdate = true; context.FireLog("Error: {0}",exception.Message); }