public LoadGameDialog(SaveWatcher saveWatcher, SaveGameCollection saveGameCollection, ScreenshotManager screenshotManager, int instanceID)
        {
            _saveWatcher        = saveWatcher;
            _saveGameCollection = saveGameCollection;
            _screenshotManager  = screenshotManager;
            _instanceID         = instanceID;

            _windowRect = new Rect((Screen.width - WIDTH) / 2, (Screen.height - HEIGHT) / 2, WIDTH, HEIGHT);
        }
Exemplo n.º 2
0
        public void Start()
        {
            try
            {
                _saveWatcher = new SaveWatcher();

                _screenshotManager  = new ScreenshotManager(_saveWatcher);
                _saveGameCollection = new SaveGameCollection(_saveWatcher);

                _loadGameDialog = new LoadGameDialog(_saveWatcher, _saveGameCollection, _screenshotManager, GetInstanceID());
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
        }
Exemplo n.º 3
0
        public void Start()
        {
            try
            {
                fetch        = this;
                _saveWatcher = new SaveWatcher();

                _screenshotManager  = new ScreenshotManager(_saveWatcher);
                _saveGameCollection = new SaveGameCollection(_saveWatcher);

                _loadGameDialog = new LoadGameDialog(_saveWatcher, _saveGameCollection, _screenshotManager, GetInstanceID());
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
            if (!ToolbarControl.LoadImageFromFile(ref clearBtn, "GameData/" + InstallChecker.FOLDERNAME + "/PluginData/clear-30"))
            {
                Log.Error("Error loading clear-30 image");
            }
        }
Exemplo n.º 4
0
        static internal void ManageSaves()
        {
            double fileAgeLimit = HighLogic.CurrentGame.Parameters.CustomParams <BLSG2>().fileAge;

            if (HighLogic.CurrentGame.Parameters.CustomParams <BLSG2>().hourUnit)
            {
                fileAgeLimit *= 60;
            }
            if (HighLogic.CurrentGame.Parameters.CustomParams <BLSG2>().dayUnit)
            {
                fileAgeLimit *= 1440;
            }

            Log.Info("ManageSaves, fileAgeLimit: " + fileAgeLimit);

            _saveGameCollection = new SaveGameCollection(null);

            foreach (SaveGameInfo save in _saveGameCollection.Saves)
            {
                if (AgeInMinutes(save.SaveFile.LastWriteTime) > fileAgeLimit)
                {
                    if (HighLogic.CurrentGame.Parameters.CustomParams <BLSG2>().archiveSaves)
                    {
                        MoveSaveToArchive(save);
                    }
                    if (HighLogic.CurrentGame.Parameters.CustomParams <BLSG2>().deleteSaves)
                    {
                        DeleteSaveGame("", save);
                    }
                }
            }
            if (HighLogic.CurrentGame.Parameters.CustomParams <BLSG2>().archiveSaves)
            {
                Main.fetch.RefreshSaves();
            }
        }