Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="StatusWatcher"/> class
        /// with the given player journal folder path.
        /// </summary>
        /// <param name="journalFolder">The path to the player journal folder.</param>
        public StatusWatcher(JournalFolder journalFolder)
        {
            JournalFolder.AssertValid(journalFolder);

            _statusFile       = journalFolder.Status;
            _watcher          = new EliteFileSystemWatcher(journalFolder.FullName, journalFolder.Status.Name);
            _watcher.Changed += StatusWatcher_Changed;
        }
Ejemplo n.º 2
0
        public void DoesNotThrowWhenDisposingTwice()
        {
            using var tf = new TestFolder();
            var fsw = new EliteFileSystemWatcher(tf.Name);

#pragma warning disable IDISP016, IDISP017
            fsw.Dispose();
            fsw.Dispose();
#pragma warning restore IDISP016, IDISP017
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="GraphicsConfigWatcher"/> class
        /// with the given game installation folder and game options folder paths.
        /// </summary>
        /// <param name="gameInstallFolder">The path to the game installation folder.</param>
        /// <param name="gameOptionsFolder">The path to the game options folder.</param>
        public GraphicsConfigWatcher(GameInstallFolder gameInstallFolder, GameOptionsFolder gameOptionsFolder)
        {
            GameInstallFolder.AssertValid(gameInstallFolder);
            GameOptionsFolder.AssertValid(gameOptionsFolder);

            _mainFile             = gameInstallFolder.GraphicsConfiguration;
            _mainWatcher          = new EliteFileSystemWatcher(_mainFile);
            _mainWatcher.Changed += GraphicsConfig_Changed;

            _overrideFile             = gameOptionsFolder.GraphicsConfigurationOverride;
            _overrideWatcher          = new EliteFileSystemWatcher(_overrideFile);
            _overrideWatcher.Changed += GraphicsConfig_Changed;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BindingsWatcher"/> class
        /// with the given game installation folder and game options folder paths.
        /// </summary>
        /// <param name="gameInstallFolder">The path to the game installation folder.</param>
        /// <param name="gameOptionsFolder">The path to the game options folder.</param>
        public BindingsWatcher(GameInstallFolder gameInstallFolder, GameOptionsFolder gameOptionsFolder)
        {
            _gameInstallFolder = GameInstallFolder.AssertValid(gameInstallFolder);
            _gameOptionsFolder = GameOptionsFolder.AssertValid(gameOptionsFolder);

            var customBindingsPath = gameOptionsFolder.Bindings.FullName;

            _startPresetWatcher          = new EliteFileSystemWatcher(customBindingsPath, gameOptionsFolder.BindingsStartPreset.Name);
            _startPresetWatcher.Changed += Bindings_Changed;

            _customBindsWatcher          = new EliteFileSystemWatcher(customBindingsPath);
            _customBindsWatcher.Changed += Bindings_Changed;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="JournalWatcher"/> class
        /// with the given player journal folder path.
        /// </summary>
        /// <param name="journalFolder">The path to the player journal folder.</param>
        public JournalWatcher(JournalFolder journalFolder)
        {
            _journalFolder = JournalFolder.AssertValid(journalFolder);

            _journalFilesWatcher          = new EliteFileSystemWatcher(journalFolder.FullName, JournalFolder.JournalFilesFilter);
            _journalFilesWatcher.Changed += JournalFilesWatcher_Changed;

            _journalReadTimer = new System.Timers.Timer
            {
                Interval  = 250,
                AutoReset = false,
                Enabled   = false,
            };

            _journalReadTimer.Elapsed += JournalReadTimer_Elapsed;
        }