Пример #1
0
        public override bool Deserialize()
        {
            MemberProperties = new List<ME3DefaultProperty>();
            var current = new ME3DefaultProperty(Data, PCC);

            while (current.Deserialize())
            {
                MemberProperties.Add(current);
                current = new ME3DefaultProperty(Data, PCC);
            }
            return true;
        }
Пример #2
0
        public override bool Deserialize()
        {
            MemberProperties = new List <ME3DefaultProperty>();
            var current = new ME3DefaultProperty(Data, PCC);

            while (current.Deserialize())
            {
                MemberProperties.Add(current);
                current = new ME3DefaultProperty(Data, PCC);
            }
            return(true);
        }
Пример #3
0
        public Expression ConvertPropertyValue(ME3DefaultProperty prop)
        {
            switch (prop.Type)
            {
            case PropertyType.BoolProperty:
                return(new BooleanLiteral((prop.Value as BoolPropertyValue).Value, null, null));

            case PropertyType.ByteProperty:
                if (prop.Value is EnumPropertyValue)     // TODO:
                {
                    var enumRef = prop.Value as EnumPropertyValue;
                    var enumStr = enumRef.EnumName + "." + enumRef.EnumValue;
                    return(new SymbolReference(null, null, null, enumStr));
                }
                else
                {
                    return(new IntegerLiteral((prop.Value as BytePropertyValue).Value, null, null));
                }

            case PropertyType.IntProperty:
                return(new IntegerLiteral((prop.Value as IntPropertyValue).Value, null, null));

            case PropertyType.FloatProperty:
                return(new FloatLiteral((prop.Value as FloatPropertyValue).Value, null, null));

            case PropertyType.StrProperty:
                return(new StringLiteral((prop.Value as StrPropertyValue).Value, null, null));

            case PropertyType.StringRefProperty:
                return(new IntegerLiteral((prop.Value as StringRefPropertyValue).Value, null, null));    // TODO

            case PropertyType.NameProperty:
                return(new NameLiteral((prop.Value as NamePropertyValue).Name, null, null));

            case PropertyType.ObjectProperty:
                var objRef = prop.Value as ObjectPropertyValue;
                if (objRef.Index == 0)
                {
                    return(new SymbolReference(null, null, null, "None"));
                }
                var objEntry = objRef.PCC.GetObjectEntry(objRef.Index);     // TODO: maybe qualifying like this is unnecessary?
                var outer    = objEntry.GetOuterTreeString();
                var objStr   = objEntry.ClassName + "'" + (outer != "" ? (outer + ".") : outer) + objEntry.ObjectName + "'";
                return(new SymbolReference(null, null, null, objStr));

            case PropertyType.DelegateProperty:
                return(new SymbolReference(null, null, null, (prop.Value as DelegatePropertyValue).DelegateValue));    // TODO: verify

            case PropertyType.StructProperty:
                return(new SymbolReference(null, null, null, "UNSUPPORTED:" + prop.Type));

            case PropertyType.ArrayProperty:
                return(new SymbolReference(null, null, null, "UNSUPPORTED:" + prop.Type));

            case PropertyType.InterfaceProperty:
                return(new SymbolReference(null, null, null, PCC.GetObjectEntry((prop.Value as InterfacePropertyValue).Index).ObjectName));    // TODO: verify

            default:
                return(new SymbolReference(null, null, null, "UNSUPPORTED:" + prop.Type));
            }
        }