LSLib.Granny.GR2.GR2Reader.Seek C# (CSharp) Method

Seek() private method

private Seek ( Section section, UInt32 offset ) : void
section Section
offset System.UInt32
return void
        internal void Seek(Section section, UInt32 offset)
        {
            Debug.Assert(offset <= section.Header.uncompressedSize);
            Stream.Position = section.Header.offsetInFile + offset;
        }
    }

Same methods

GR2Reader::Seek ( RelocatableReference reference ) : void
GR2Reader::Seek ( SectionReference reference ) : void
GR2Reader::Seek ( UInt32 section, UInt32 offset ) : void

Usage Example

Ejemplo n.º 1
0
        public StructDefinition Resolve(GR2Reader gr2)
        {
            Debug.Assert(IsValid);
            // Type definitions use a 2-level cache
            // First we'll check the reference itself, if it has a cached ref to the resolved type
            // If it has, we have nothing to do

            // If the struct wasn't resolved yet, try the type definition cache
            // When a type definition is read from the GR2 file, it is stored here using its definition address as a key
            if (Type == null)
            {
                gr2.Types.TryGetValue(this, out Type);
            }

            if (Type == null)
            {
                // We haven't seen this type before, read its definition from the file and cache it
#if DEBUG_GR2_SERIALIZATION
                System.Console.WriteLine(String.Format(" ===== Struct definition at {0:X8} ===== ", Offset));
#endif
                var originalPos = gr2.Stream.Position;
                gr2.Seek(this);
                Type = gr2.ReadStructDefinition();
                gr2.Stream.Seek(originalPos, SeekOrigin.Begin);
                gr2.Types[this] = Type;
            }

            return(Type);
        }
All Usage Examples Of LSLib.Granny.GR2.GR2Reader::Seek