Base class for item VSS header records.
Inheritance: VssRecord
Exemplo n.º 1
0
        public ItemFile(string filename, Encoding encoding)
            : base(filename, encoding)
        {
            try
            {
                var fileSig = reader.ReadString(0x20);
                if (fileSig != "SourceSafe@Microsoft")
                {
                    throw new BadHeaderException("Incorrect file signature");
                }

                var fileType    = (ItemType)reader.ReadInt16();
                var fileVersion = reader.ReadInt16();
                if (fileVersion != 6)
                {
                    throw new BadHeaderException("Incorrect file version");
                }

                reader.Skip(16); // reserved; always 0

                if (fileType == ItemType.Project)
                {
                    Header = new ProjectHeaderRecord();
                }
                else
                {
                    Header = new FileHeaderRecord();
                }

                ReadRecord(Header);
                if (Header.ItemType != fileType)
                {
                    throw new BadHeaderException("Header record type mismatch");
                }
            }
            catch (EndOfBufferException e)
            {
                throw new BadHeaderException("Truncated header", e);
            }
        }
Exemplo n.º 2
0
        public ItemFile(string filename, Encoding encoding)
            : base(filename, encoding)
        {
            try
            {
                var fileSig = reader.ReadString(0x20);
                if (fileSig != "SourceSafe@Microsoft")
                {
                    throw new BadHeaderException("Incorrect file signature");
                }

                var fileType = (ItemType)reader.ReadInt16();
                var fileVersion = reader.ReadInt16();
                if (fileVersion != 6)
                {
                    throw new BadHeaderException("Incorrect file version");
                }

                reader.Skip(16); // reserved; always 0

                if (fileType == ItemType.Project)
                {
                    header = new ProjectHeaderRecord();
                }
                else
                {
                    header = new FileHeaderRecord();
                }

                ReadRecord(header);
                if (header.ItemType != fileType)
                {
                    throw new BadHeaderException("Header record type mismatch");
                }
            }
            catch (EndOfBufferException e)
            {
                throw new BadHeaderException("Truncated header", e);
            }
        }