Beispiel #1
0
        private void ReadHeader(BinaryReaderEx input)
        {
            int       curOffset = 0;
            FileEntry pboEntry;

            do
            {
                pboEntry = new FileEntry(input)
                {
                    StartOffset = curOffset
                };

                curOffset += pboEntry.DataSize;

                if (pboEntry.IsVersion)
                {
                    string name;
                    string value;
                    do
                    {
                        name = input.ReadAsciiz();
                        if (name == "")
                        {
                            break;
                        }
                        Properties.AddLast(name);

                        value = input.ReadAsciiz();
                        Properties.AddLast(value);

                        if (name == "prefix")
                        {
                            Prefix = value;
                        }
                    }while (name != "");

                    if (Properties.Count % 2 != 0)
                    {
                        throw new Exception("metaData count is not even.");
                    }
                }
                else if (pboEntry.FileName != "")
                {
                    FileEntries.AddLast(pboEntry);
                }
            }while (pboEntry.FileName != "" || FileEntries.Count == 0);

            DataOffset = (int)input.Position;

            if (Prefix == null)
            {
                Prefix = Path.GetFileNameWithoutExtension(PBOFilePath);
            }
        }