/*
         * BackupWork
         */
        public void BackupWork(CI asRef)
        {
            SaveFilesHandlers sfh = new SaveFilesHandlers();

            // SaveMode is:  OVERWRITE    APPEND   ABORT
            SaveMode s = SaveMode.OVERWRITE;

            saveFileCnt = FileSaveCnt(KSPUtil.ApplicationRootPath + "saves/" + HighLogic.SaveFolder) + 1;
            string saveFileName = CI.AddInfo(CI.configuration.savePrefix, saveFileCnt, asRef.isSceneReady(), asRef.isSpecialScene(), asRef.isPreCrash());

            string str = GamePersistence.SaveGame(saveFileName, HighLogic.SaveFolder, s);

            Log.Info("String: " + str);

            sfh.deleteOldestSaveFile(KSPUtil.ApplicationRootPath + "saves/" + HighLogic.SaveFolder, CI.configuration.numToRotate, saveFileCnt, saveFileName);

            Log.Info("backup thread terminated");
        }
예제 #2
0
        public void Start()
        {
            Instance = this;
            //DontDestroyOnLoad (this);
            configuration = new Configuration();
            configuration.Load();
#if (DEBUG)
            Log.SetLevel(Log.LEVEL.INFO);
#else
            Log.SetLevel(configuration.logLevel);
#endif

            if (this.gui == null)
            {
                this.gui = this.gameObject.AddComponent <MainMenuGui> ();
                //gui.UpdateToolbarStock ();
                gui.thisCI = this;
                gui.SetVisible(false);
            }
        }
 /*
  * startBackup
  */
 public void startBackup(CI asRef)
 {
     asRef.backupThread = new Thread(() => BackupWork(asRef));
     asRef.backupThread.Start();
 }