コード例 #1
0
    public bool ReadHeader(string path)
    {
        string fSign = "";  //file signature

        byte[] buffer = new byte[3];

        FileStream fsReader = new FileStream(path, FileMode.Open);

        fsReader.Read(buffer, 0, buffer.Length);

        if (Encoding.UTF8.GetString(buffer, 0, 3) != "QSH")
        {
            fsReader.Close();
            fsReader.Dispose();

            return(false);
        }

        fSign = GetData(fsReader, 0, ':');

        int    hLen   = 0;
        string strLen = GetData(fsReader, fSign.Length + 1, '.');

        hLen = int.Parse(strLen);

        int offset = fSign.Length + strLen.Length + 2;

        buffer = new byte[hLen];

        fsReader.Position = offset;
        fsReader.Read(buffer, 0, hLen);
        blk.ReadBlock(buffer);

        fsReader.Close();
        fsReader.Dispose();

        return(true);
    }