public void Write(string filePath, ThreadHeader header, ResSetCollection resCollection) { Stream stream = StreamCreator.CreateWriter(filePath, useGzip, true); header.UseGzip = useGzip; try { ThreadFormatter formatter = new X2chThreadFormatter(); string textData = formatter.Format(resCollection); byte[] byteData = TwinDll.DefaultEncoding.GetBytes(textData); stream.Write(byteData, 0, byteData.Length); } finally { if (stream != null) { stream.Close(); } } // インデックスファイルを作成 string indexPath = GetIndexPath(filePath); ThreadIndexer.Write(indexPath, header); }