private void WriteToIndex(OnDiscAdress Adresspattern) { lock (DatabaseIndexFile) { // seek to the end... DatabaseIndexFile.Seek(DatabaseIndexFile.Length, SeekOrigin.Begin); // re-use the writer _writer.ResetBuffer(); // serialize the index... byte[] ToWrite = Adresspattern.SerializeAligned(ref _writer); DatabaseIndexFile.Write(ToWrite, 0, ToWrite.Length); if (FlushOnWrite) { DatabaseIndexFile.Flush(); } } }