예제 #1
0
        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);
        }
예제 #2
0
 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;
 }
예제 #3
0
 public Game(string game, string filename)
 {
     _gameName = game;
     _filename = filename;
     timeLog   = TimeLogFactory.loadLog(filename);
 }