Exemple #1
0
        internal void ReadHeader()
        {
            if (!isStarted)
            {
                throw new InvalidOperationException("LoadStartが呼び出されていません");
            }
            long streamSize = reader.BaseStream.Length - seekOrigin;

            if (streamSize < 0x60)
            {
                throw new HspDecoderException("AxData", "ファイルヘッダーが見つかりません");
            }
            try
            {
                header = AxHeader.FromBinaryReader(reader);
            }
            catch (SystemException e)
            {
                throw new HspDecoderException("AxHeader", "ヘッダー解析中に想定外のエラー", e);
            }
            return;
        }
Exemple #2
0
        static internal AxHeader FromBinaryReader(BinaryReader reader)
        {
            long     seekOrigin = reader.BaseStream.Position;
            AxHeader header     = new AxHeader();

            try
            {
                header.fileType = new string(reader.ReadChars(4));
                for (int i = 1; i < 21; i++)
                {
                    header.data[i] = reader.ReadUInt32();
                }
                header.data[21] = reader.ReadUInt16();
                header.data[22] = reader.ReadUInt16();
                header.data[23] = reader.ReadUInt32();
                header.data[24] = reader.ReadUInt32();
            }
            catch (Exception e)
            {
                throw new HspDecoderException("AxHeader", "ファイル形式が違います", e);
            }
            header.checkHeader(reader.BaseStream.Length - seekOrigin);
            return(header);
        }