Ejemplo n.º 1
0
        private void LoadFile()
        {
            this.fileLock.WaitOne();

            Log.Debug("Deserializing history file.");

            this._currentHistory = Serialize.DeserializeXmlFromDisk(Path.Combine(AssemblyInfo.DirectoryConfigFiles, FILENAME), typeof(HistoryByFavorite)) as HistoryByFavorite;

            this.fileLock.ReleaseMutex();
        }
Ejemplo n.º 2
0
        private void TryToRecoverHistoryFile()
        {
            try
            {
                this.fileLock.WaitOne();
                this.fileWatcher.StopObservation();

                if (File.Exists(Path.Combine(AssemblyInfo.DirectoryConfigFiles, FILENAME)))
                {
                    File.Delete(Path.Combine(AssemblyInfo.DirectoryConfigFiles, FILENAME));
                }

                this._currentHistory = new HistoryByFavorite();
            }
            catch (Exception ex1)
            {
                Log.Error("Try to recover History file failed.", ex1);
            }
            finally
            {
                this.fileLock.ReleaseMutex();
                this.fileWatcher.StartObservation();
            }
        }