CheckSignature() public method

public CheckSignature ( string expected ) : void
expected string
return void
Ejemplo n.º 1
0
        protected T GetRecord <T>(
            CreateRecordCallback <T> creationCallback,
            bool ignoreUnknown)
            where T : VssRecord
        {
            var recordHeader = new RecordHeader();

            recordHeader.Read(reader);

            var recordReader = reader.Extract(recordHeader.Length);

            // comment records always seem to have a zero CRC
            if (recordHeader.Signature != CommentRecord.SIGNATURE)
            {
                recordHeader.CheckCrc();
            }

            var record = creationCallback(recordHeader, recordReader);

            if (record != null)
            {
                // double-check that the object signature matches the file
                recordHeader.CheckSignature(record.Signature);
                record.Read(recordReader, recordHeader);
            }
            else if (!ignoreUnknown)
            {
                throw new UnrecognizedRecordException(recordHeader,
                                                      string.Format("Unrecognized record signature {0} in item file",
                                                                    recordHeader.Signature));
            }
            return(record);
        }
Ejemplo n.º 2
0
        public void ReadRecord(VssRecord record)
        {
            try
            {
                var recordHeader = new RecordHeader();
                recordHeader.Read(reader);

                var recordReader = reader.Extract(recordHeader.Length);

                // comment records always seem to have a zero CRC
                if (recordHeader.Signature != CommentRecord.SIGNATURE)
                {
                    recordHeader.CheckCrc();
                }

                recordHeader.CheckSignature(record.Signature);

                record.Read(recordReader, recordHeader);
            }
            catch (EndOfBufferException e)
            {
                throw new RecordTruncatedException(e.Message);
            }
        }