Alexandria.Engines.Unreal.Core.Statement.Load C# (CSharp) Method

Load() public static method

public static Load ( Package package, System reader, int &unpackedCodeOffset, long end ) : Statement
package Package
reader System
unpackedCodeOffset int
end long
return Statement
        public static Statement Load(Package package, System.IO.BinaryReader reader, ref int unpackedCodeOffset, long end)
        {
            var opcode = (Opcode)reader.ReadByte();
            int prepopCounter = 0;

            while (opcode == Opcode.Pop) {
                prepopCounter++;
                unpackedCodeOffset++;
                opcode = (Opcode)reader.ReadByte();
            }

            var statement = CreateStatement(opcode);

            statement.PrepopCounter = prepopCounter;
            statement.UnpackedCodeOffset = unpackedCodeOffset;
            statement.Package = package;
            statement.Load(reader, end);
            unpackedCodeOffset += statement.PartialUnpackedCodeSize;
            return statement;
        }

Usage Example

Ejemplo n.º 1
0
            public override object Read(object target, Package package, System.IO.BinaryReader reader, long end)
            {
                int offset = 0, total = reader.ReadInt32();
                List <Statement> list = null;

                while (offset < total)
                {
                    if (list == null)
                    {
                        list = new List <Statement>();
                    }
                    var statement = Statement.Load(package, reader, ref offset, end);
                    list.Add(statement);
                }

                /*List<string> result = new List<string>(list != null ? list.Count : 0);
                 * if(list != null) {
                 *      foreach(var item in list)
                 *              result.Add(item.UnpackedCodeOffset + ": " + item.ToString());
                 * }*/

                if (offset != total)
                {
                    throw new Exception("Didn't read exactly right");
                }
                return(list);
            }