Exemple #1
0
        public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
        {
            reader.ReadBytes(12);
            int super    = reader.ReadInt32();
            int children = reader.ReadInt32();

            reader.ReadBytes(12);
            int line       = reader.ReadInt32();
            int textPos    = reader.ReadInt32();
            int scriptSize = reader.ReadInt32();

            byte[] bytecode           = reader.ReadBytes(scriptSize);
            int    nativeIndex        = reader.ReadInt16();
            int    operatorPrecedence = reader.ReadByte();
            int    functionFlags      = reader.ReadInt32();

            if ((functionFlags & _flagSet.GetMask("Net")) != 0)
            {
                reader.ReadInt16();  // repOffset
            }
            int friendlyNameIndex = reader.ReadInt32();

            reader.ReadInt32();
            return(new UnFunction(export, package.Names[friendlyNameIndex].Name,
                                  new FlagValues(functionFlags, _flagSet), bytecode, nativeIndex, operatorPrecedence));
        }
 public UE3PropertyListInstanceReader(UnPackage package, BinaryReader reader, UnExport export, UnContainer owner)
 {
     _package = package;
     _reader = reader;
     _export = export;
     _owner = owner;
 }
Exemple #3
0
 public UE3PropertyListInstanceReader(UnPackage package, BinaryReader reader, UnExport export, UnContainer owner)
 {
     _package = package;
     _reader  = reader;
     _export  = export;
     _owner   = owner;
 }
 public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
 {
     reader.ReadBytes(20);
     int valueSize = reader.ReadInt32();
     string value = new string(reader.ReadChars(valueSize));
     return new UnConst(export, value.Trim('\0'));
 }
Exemple #5
0
        private bool ReadStructValues(UnExport scriptStruct, UnPropertyList result)
        {
            bool haveUnknownValues = false;
            var  structInstance    = (UnScriptStruct)scriptStruct.ReadInstance();

            if (structInstance.Super != null)
            {
                haveUnknownValues = ReadStructValues(structInstance.Super.Resolve(), result);
            }
            foreach (UnExport e in scriptStruct.Children.Reverse())
            {
                object value;
                if (haveUnknownValues)
                {
                    value = null;
                }
                else if (e.ClassName == "StrProperty")
                {
                    ReadProperty(result);
                    continue;
                }
                else
                {
                    value = ReadSingleValue(structInstance, e.ObjectName, e.ClassName);
                    if (value == null)
                    {
                        haveUnknownValues = true;
                    }
                }
                result.AddProperty(e.ObjectName, e.ClassName, value);
            }
            return(haveUnknownValues);
        }
Exemple #6
0
        public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
        {
            reader.ReadBytes(20);
            int textLength = reader.ReadInt32();

            return(new string(Encoding.Default.GetChars(reader.ReadBytes(textLength))));
        }
Exemple #7
0
        public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
        {
            reader.ReadBytes(20);
            int    valueSize = reader.ReadInt32();
            string value     = new string(reader.ReadChars(valueSize));

            return(new UnConst(export, value.Trim('\0')));
        }
 public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
 {
     int[] values = new int[11];
     for (int i = 0; i < 11; i++)
         values[i] = reader.ReadInt32();
     int flags = reader.ReadInt32();
     return new UnScriptStruct(export, flags, values [3]);
 }
        protected override UnClassProperty CreateProperty(UnExport export, int arraySize, FlagValues flags, int category, BinaryReader reader, short repOffset)
        {
            int typeId1 = reader.ReadInt32();

            reader.ReadInt32();
            var typeItem1 = export.Package.ResolveClassItem(typeId1);

            return(new UnDelegateClassProperty(export, arraySize, flags, category, typeItem1, repOffset));
        }
Exemple #10
0
        public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
        {
            int[] values = new int[11];
            for (int i = 0; i < 11; i++)
            {
                values[i] = reader.ReadInt32();
            }
            int flags = reader.ReadInt32();

            return(new UnScriptStruct(export, flags, values [3]));
        }
Exemple #11
0
        private static void DumpOutput(UnExport export, string outDir, string text)
        {
            var outPath = Path.Combine(outDir, export.ObjectName + ".uc");

            using (var fs = new FileStream(outPath, FileMode.Create))
            {
                using (var writer = new StreamWriter(fs, Encoding.UTF8))
                {
                    writer.Write(text);
                }
            }
        }
Exemple #12
0
 public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
 {
     reader.ReadBytes(20);
     int valueCount = reader.ReadInt32();
     var values = new List<string>();
     for(int i=0; i<valueCount; i++)
     {
         int index = (int) reader.ReadInt64();
         values.Add(export.Package.Names[index].Name);
     }
     return new UnEnum(export, values);
 }
Exemple #13
0
        public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
        {
            reader.ReadBytes(20);
            int valueCount = reader.ReadInt32();
            var values     = new List <string>();

            for (int i = 0; i < valueCount; i++)
            {
                int index = (int)reader.ReadInt64();
                values.Add(export.Package.Names[index].Name);
            }
            return(new UnEnum(export, values));
        }
 public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
 {
     reader.ReadBytes(40);
     int scriptSize = reader.ReadInt32();
     byte[] script = reader.ReadBytes(scriptSize);
     reader.ReadBytes(22);
     int methodCount = reader.ReadInt32();
     for(int i=0; i<methodCount; i++)
     {
         reader.ReadBytes(12);
     }
     return new UnState(export, script);
 }
Exemple #15
0
        public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
        {
            reader.ReadBytes(40);
            int scriptSize = reader.ReadInt32();

            byte[] script = reader.ReadBytes(scriptSize);
            reader.ReadBytes(22);
            int methodCount = reader.ReadInt32();

            for (int i = 0; i < methodCount; i++)
            {
                reader.ReadBytes(12);
            }
            return(new UnState(export, script));
        }
 public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
 {
     reader.ReadInt32();
     int superIndex = reader.ReadInt32();
     reader.ReadInt32();
     int scriptTextIndex = reader.ReadInt32();
     for (int i = 0; i < 4; i++)
         reader.ReadInt32();
     int scriptSize = reader.ReadInt32();
     var bytecode = reader.ReadBytes(scriptSize);
     for (int i = 0; i < 4; i++)
         reader.ReadInt32();
     reader.ReadInt16();
     reader.ReadInt32();
     int methodCount = reader.ReadInt32();
     for (int i = 0; i < methodCount * 3; i++)
         reader.ReadInt32();
     int flags = reader.ReadInt32();
     reader.ReadByte();
     int outerIndex = reader.ReadInt32();
     var outerInstance = package.ResolveClassItem(outerIndex);
     var configNameIndex = reader.ReadInt64();
     var config = package.Names[(int) configNameIndex].Name;
     int hideCategoriesCount = reader.ReadInt32();
     var hideCategories = new List<string>();
     for (int i = 0; i < hideCategoriesCount; i++)
     {
         var nameIndex = reader.ReadInt64();
         var name = package.Names[(int) nameIndex].Name;
         hideCategories.Add(name);
     }
     int c3 = reader.ReadInt32();
     for (int i = 0; i < c3 * 3; i++)
         reader.ReadInt32();
     var interfaceCount = reader.ReadInt32();
     var interfaces = new List<UnPackageItem>();
     for(int i=0; i<interfaceCount; i++)
     {
         var intfIndex = reader.ReadInt32();
         reader.ReadInt32();
         interfaces.Add(package.ResolveClassItem(intfIndex));
     }
     reader.ReadInt32();
     int defaultPropertiesIndex = reader.ReadInt32();
     UnExport defaultProperties = defaultPropertiesIndex == 0
         ? null : package.ResolveClassItem(defaultPropertiesIndex).Resolve();
     return new UnClass(export, superIndex, outerInstance, bytecode, new FlagValues(flags, _flagSet), defaultProperties, config, hideCategories, interfaces);
 }
Exemple #17
0
        public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
        {
            // 44 bytes
            reader.ReadBytes(16);
            int next      = reader.ReadInt32();
            int arraySize = reader.ReadInt32();
            int flags     = reader.ReadInt32();

            reader.ReadInt32();
            int category = (int)reader.ReadInt64();

            reader.ReadInt32();
            var repOffset = ((flags & _flagSet.GetMask("Net")) != 0) ? reader.ReadInt16() : (short)-1;

            return(CreateProperty(export, arraySize, new FlagValues(flags, _flagSet), category, reader, repOffset));
        }
 public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
 {
     reader.ReadBytes(12);
     int super = reader.ReadInt32();
     int children = reader.ReadInt32();
     reader.ReadBytes(12);
     int line = reader.ReadInt32();
     int textPos = reader.ReadInt32();
     int scriptSize = reader.ReadInt32();
     byte[] bytecode = reader.ReadBytes(scriptSize);
     int nativeIndex = reader.ReadInt16();
     int operatorPrecedence = reader.ReadByte();
     int functionFlags = reader.ReadInt32();
     if ((functionFlags & _flagSet.GetMask("Net")) != 0)
     {
         reader.ReadInt16();  // repOffset
     }
     int friendlyNameIndex = reader.ReadInt32();
     reader.ReadInt32();
     return new UnFunction(export, package.Names[friendlyNameIndex].Name,
         new FlagValues(functionFlags, _flagSet), bytecode, nativeIndex, operatorPrecedence);
 }
Exemple #19
0
        private UnPropertyList ReadStructProperty(UnContainer owner, string name)
        {
            var export = owner.FindMemberExport(name);

            if (export == null)
            {
                return(null);
            }
            var      declaration     = (UnTypedClassProperty)export.ReadInstance();
            var      typeDeclaration = declaration.Type;
            UnExport scriptStruct    = typeDeclaration.Resolve();
            var      structInstance  = (UnScriptStruct)scriptStruct.ReadInstance();

            if (structInstance.Native)
            {
                return(null);
            }

            var result = new UnPropertyList(null);

            ReadStructValues(scriptStruct, result);
            return(result);
        }
Exemple #20
0
 protected virtual UnClassProperty CreateProperty(UnExport export, int arraySize, FlagValues flags, int category, BinaryReader reader, short repOffset)
 {
     return(new UnClassProperty(export, arraySize, flags, category, repOffset));
 }
Exemple #21
0
 public UnPropertyList ReadPropertyList(UnPackage package, BinaryReader reader, UnExport export, UnClass owner)
 {
     return(new UE3PropertyListInstanceReader(package, reader, export, owner).Read());
 }
Exemple #22
0
        public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
        {
            reader.ReadInt32();
            int superIndex = reader.ReadInt32();

            reader.ReadInt32();
            int scriptTextIndex = reader.ReadInt32();

            for (int i = 0; i < 4; i++)
            {
                reader.ReadInt32();
            }
            int scriptSize = reader.ReadInt32();
            var bytecode   = reader.ReadBytes(scriptSize);

            for (int i = 0; i < 4; i++)
            {
                reader.ReadInt32();
            }
            reader.ReadInt16();
            reader.ReadInt32();
            int methodCount = reader.ReadInt32();

            for (int i = 0; i < methodCount * 3; i++)
            {
                reader.ReadInt32();
            }
            int flags = reader.ReadInt32();

            reader.ReadByte();
            int outerIndex          = reader.ReadInt32();
            var outerInstance       = package.ResolveClassItem(outerIndex);
            var configNameIndex     = reader.ReadInt64();
            var config              = package.Names[(int)configNameIndex].Name;
            int hideCategoriesCount = reader.ReadInt32();
            var hideCategories      = new List <string>();

            for (int i = 0; i < hideCategoriesCount; i++)
            {
                var nameIndex = reader.ReadInt64();
                var name      = package.Names[(int)nameIndex].Name;
                hideCategories.Add(name);
            }
            int c3 = reader.ReadInt32();

            for (int i = 0; i < c3 * 3; i++)
            {
                reader.ReadInt32();
            }
            var interfaceCount = reader.ReadInt32();
            var interfaces     = new List <UnPackageItem>();

            for (int i = 0; i < interfaceCount; i++)
            {
                var intfIndex = reader.ReadInt32();
                reader.ReadInt32();
                interfaces.Add(package.ResolveClassItem(intfIndex));
            }
            reader.ReadInt32();
            int      defaultPropertiesIndex = reader.ReadInt32();
            UnExport defaultProperties      = defaultPropertiesIndex == 0
                ? null : package.ResolveClassItem(defaultPropertiesIndex).Resolve();

            return(new UnClass(export, superIndex, outerInstance, bytecode, new FlagValues(flags, _flagSet), defaultProperties, config, hideCategories, interfaces));
        }
 private bool ReadStructValues(UnExport scriptStruct, UnPropertyList result)
 {
     bool haveUnknownValues = false;
     var structInstance = (UnScriptStruct) scriptStruct.ReadInstance();
     if (structInstance.Super != null)
     {
         haveUnknownValues = ReadStructValues(structInstance.Super.Resolve(), result);
     }
     foreach (UnExport e in scriptStruct.Children.Reverse())
     {
         object value;
         if (haveUnknownValues)
             value = null;
         else if (e.ClassName == "StrProperty")
         {
             ReadProperty(result);
             continue;
         }
         else
         {
             value = ReadSingleValue(structInstance, e.ObjectName, e.ClassName);
             if (value == null) haveUnknownValues = true;
         }
         result.AddProperty(e.ObjectName, e.ClassName, value);
     }
     return haveUnknownValues;
 }
 public UnPropertyList ReadPropertyList(UnPackage package, BinaryReader reader, UnExport export, UnClass owner)
 {
     return new UE3PropertyListInstanceReader(package, reader, export, owner).Read();
 }
 public object ReadInstance(UnPackage package, BinaryReader reader, UnExport export)
 {
     reader.ReadBytes(20);
     int textLength = reader.ReadInt32();
     return new string(Encoding.Default.GetChars(reader.ReadBytes(textLength)));
 }