Beispiel #1
0
        public TPIReader(IServiceContainer ctx, SpanStream stream) : base(stream)
        {
            this.ctx = ctx;

            Header = Read <TPIHeader>();
            if (Header.HeaderSize != Marshal.SizeOf <TPIHeader>())
            {
                throw new InvalidDataException();
            }

            if (!Enum.IsDefined(typeof(TPIVersion), Header.Version))
            {
                throw new InvalidDataException();
            }


#if false
            if (Header.Version != TPIVersion.V80)
            {
                throw new NotImplementedException($"TPI Version {Header.Version} not supported yet");
            }
#endif

            lazyLeafContainers = LazyFactory.CreateLazy(ReadTypes);
        }
Beispiel #2
0
        private static TPIHeader ImportJGOld(JGHeaderOld oldHeader)
        {
            TPIHeader hdr = new TPIHeader()
            {
                MinTypeIndex = oldHeader.MinTi,
                MaxTypeIndex = oldHeader.MaxTi,
                GpRecSize    = oldHeader.GpRecSize
            };

            return(hdr);
        }
Beispiel #3
0
        public TPIReader(IServiceContainer ctx, SpanStream stream) : base(stream)
        {
            this.ctx = ctx;

            PDBFile pdb = ctx.GetService <PDBFile>();

            if (pdb.Type == PDBType.Old)
            {
                this.TypeReader = new ReadTypeDelegate(ReadTypeOld);
                JGHeaderOld oldHdr = ctx.GetService <JGHeaderOld>();
                Header = ImportJGOld(oldHdr);
            }
            else
            {
                Header = Read <TPIHeader>();
                if (Header.HeaderSize != Marshal.SizeOf <TPIHeader>())
                {
                    throw new InvalidDataException();
                }

                if (!Enum.IsDefined(typeof(TPIVersion), Header.Version))
                {
                    throw new InvalidDataException();
                }
                this.TypeReader = new ReadTypeDelegate(ReadType);
            }


#if false
            if (Header.Version != TPIVersion.V80)
            {
                throw new NotImplementedException($"TPI Version {Header.Version} not supported yet");
            }
#endif

            lazyLeafContainers = LazyFactory.CreateLazy(ReadTypes);
        }