Exemple #1
0
        private void InitializeStreams()
        {
            if (fileStream is null)
            {
                if (!File.Exists(LgpPath))
                {
                    throw new Exception($"Cannot find lgp file by path {LgpPath}");
                }

                _lgpFileWatcher = new FileSystemWatcher(Path.GetDirectoryName(LgpPath), "*.lgp")
                {
                    NotifyFilter = NotifyFilters.CreationTime | NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.Attributes
                };
                _lgpFileWatcher.Deleted            += LgpFileWatcher_Deleted;
                _lgpFileWatcher.EnableRaisingEvents = true;

                fileStream     = new FileStream(LgpPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
                bracketsReader = new BracketsListReader(fileStream);
            }
        }