protected virtual void SaveSettings(FileStream fileStream, Stream settingsStream) { #if DEBUG if (settingsStream == null) throw new ArgumentNullException("segmentSeed"); #endif lock (_syncRoot) { try { settingsStream.Position = 0; fileStream.Position = 0; settingsStream.WriteAllTo(fileStream, (int)settingsStream.Length); var position = fileStream.Position; fileStream.Flush(); } catch (IOException ioEx) { Trace.TraceError(String.Format(_ioError, "", ioEx)); throw; } catch (SystemException sysEx) { Trace.TraceError(sysEx.ToString()); throw; } } }