private void AddModifier(LevelModifierType type, string data) { var modifier = modifierFactory.Create(type); if (modifier != null) { modifiers.Add(modifier); modifier.SetData(data); } }
/// <summary> /// <para>Конструктор. Возвращает экземпляр <see cref="T:GZipTest.GZipModifier"/></para> /// <para>Принимает:</para> <para><paramref name="gZipStreamCommand"></paramref> - /// режим работы <see cref="T:System.IO.Compression.GZipStream"/> /// (<paramref name="gZipStreamCommand"></paramref>)</para> /// <para>полное имя (<paramref name="fileToReadPath"></paramref>) читаемого файла</para> /// <para>полное имя (<paramref name="fileToWritePath"></paramref>) записываемого файла</para> /// </summary> #region constructor public GZipModifier(CompressionMode gZipStreamCommand, string fileToReadPath, string fileToWritePath) { threadsNumber = Environment.ProcessorCount; threadPool = new Thread[threadsNumber]; this.gZipStreamCommand = gZipStreamCommand; this.fileToReadPath = fileToReadPath; this.fileToWritePath = fileToWritePath; args = new string[] { gZipStreamCommand.ToString(), fileToReadPath, fileToWritePath }; fileModifier = ModifierFactory.Create(gZipStreamCommand); readQueue = new LimitedSizeBlocksQueue(threadsNumber); writeBuffer = new ConcurrentDictionary <int, Block>(); countdown = new CountdownEvent(threadsNumber + 1); canAddBlockToBuffer = true; allBlocksWriten = false; blocksReaded = 0; }