예제 #1
0
        /// <summary>
        /// 書き出しを終了する。
        /// </summary>
        /// <returns>何も無ければ1を返す</returns>
        public int End()
        {
            if (m_vChankBlockStack.Count > 1)
            {
                throw new FormatException(string.Format("BlockEnd()を %d つ呼び忘れたところがあります。", m_vChankBlockStack.Count - 1));
            }
            else if (m_lastState == LAST_NOTHING)
            {
                throw new FormatException("Start()を呼ぶ前に終了しようとしました。");
            }
            else if (m_lastState == LAST_BLOCK_START)
            {
                throw new FormatException("BlockStart()の後に終了しないでください。");
            }
            else if (m_lastState == LAST_WRITE)
            {
                throw new FormatException("Write()の後に終了しないでください。");
            }
            if (m_RAFile != null)
            {
                // ヘッダ部分にデータサイズを再書き込みする
                m_RAFile.Seek(0);
                m_header.Write(m_RAFile);
                // 初回チャンク
                this.BlockChankStackPop();

                m_RAFile.Close();
                m_RAFile = null;
            }
            return(1);
        }
예제 #2
0
 /// <summary>
 /// 書き出しを終了する。
 /// </summary>
 public void End()
 {
     if (m_file != null)
     {
         m_file.Close();
         m_file = null;
     }
 }