public Game CheckIn(bool emergency) { lockerSettings settings = SettingsSystem.GetSettings(true); //alert the user of its death if (!emergency) { proc.WaitForExit((int)settings.checkInWait.TotalMilliseconds); } while (!proc.HasExited) { proc.Kill(); proc.WaitForExit(10000); } if (!timeLog.detectedLogError() || usingDetailedTime) { timeLog.endSession(proc.ExitTime); } else if (timeLog.detectedLogError()) { timeLog.addNewSession(proc.StartTime, proc.ExitTime); } else { //forget this session } locker.removeFile(unlock); TimeLogFactory.saveLog(timeLog); settings = SettingsSystem.GetSettings(); settings.lastTry = DateTime.Now; checkedout = false; SettingsSystem.Sync(); return(this); }
public CheckedOutGame(Game game, ProcessStartInfo info, string unlocked) { this._gameName = game.GameName; this._filename = game.FileName; timeLog = TimeLogFactory.loadLog(_filename); timeLog.getTotalTime(); proc = Process.Start(info); unlock = unlocked; oldGame = game; if (proc.StartTime != null) { timeLog.startNewSession(proc.StartTime); usingDetailedTime = true; } else { timeLog.startNewSession(DateTime.Now); usingDetailedTime = false; } checkedout = true; }
public Game(string game, string filename) { _gameName = game; _filename = filename; timeLog = TimeLogFactory.loadLog(filename); }