/// <summary> /// Updates the file with all changes the write buffer contains. /// </summary> public void ApplyChanges() { if (this._readOnly) { throw new Exception("FileWorker_ReadCompleted is in read-only mode."); } if (!HasChanges()) { return; } IDictionaryEnumerator en = _writes.GetEnumerator(); while (en.MoveNext()) { long index = (long)en.Key; byte value = (byte)en.Value; if (_fileStream.Position != index) { _fileStream.Position = index; } _fileStream.Write(new byte[] { value }, 0, 1); } _writes.Clear(); }
public void Collections_Clear() { var item1 = CreateItem1(); var item2 = CreateItem2(); WriteCollection.Add(item1); WriteCollection.Add(item2); WriteCollection.Clear(); ReadCollection.AssertEmpty(); }
/// <summary> /// Updates the file with all changes the write buffer contains. /// </summary> public void ApplyChanges() { if (!HasChanges()) { return; } IDictionaryEnumerator en = _writes.GetEnumerator(); while (en.MoveNext()) { long index = (long)en.Key; byte value = (byte)en.Value; if (_fileStream.Position != index) { _fileStream.Position = index; } _fileStream.Write(new byte[] { value }, 0, 1); } _writes.Clear(); }
/// <summary> /// Updates the file with all changes the write buffer contains. /// </summary> public void ApplyChanges() { if (!HasChanges) { return; } var enumerator = bytes.GetEnumerator(); while (enumerator.MoveNext()) { long index = (long)enumerator.Key; byte value = (byte)enumerator.Value; if (fileStream.Position != index) { fileStream.Position = index; } fileStream.Write(new byte[] { value }, 0, 1); } bytes.Clear(); }
/// <summary> /// Updates the file with all changes the write buffer contains. /// </summary> public void ApplyChanges() { if (_readOnly) { throw new FieldAccessException("File is in read-only mode."); } if (!HasChanges()) { return; } var en = _writes.GetEnumerator(); while (en.MoveNext()) { var index = (long)en.Key; var value = (byte)en.Value; _fileStream.Position = index; _fileStream.Write(new[] { value }, 0, 1); } _writes.Clear(); }
/// <summary> /// Updates the file with all changes the write buffer contains. /// </summary> public void ApplyChanges() { if (!HasChanges()) { return; } var en = _writes.GetEnumerator(); while (en.MoveNext()) { var index = (long)en.Key; var value = (byte)en.Value; _fileStream.Position = index; _fileStream.Write(new[] { value }, 0, 1); } _writes.Clear(); }