コード例 #1
0
ファイル: ME3ScriptStruct.cs プロジェクト: Mgamerz/ME3Libs
        public bool DeserializeMemberProperties()
        {
            MemberDefaultProperties = new List<ME3DefaultProperty>();
            var current = new ME3DefaultProperty(Data, PCC);

            while (current.Deserialize())
            {
                MemberDefaultProperties.Add(current);
                current = new ME3DefaultProperty(Data, PCC);
            }

            return true;
        }
コード例 #2
0
        public bool DeserializeMemberProperties()
        {
            MemberDefaultProperties = new List <ME3DefaultProperty>();
            var current = new ME3DefaultProperty(Data, PCC);

            while (current.Deserialize())
            {
                MemberDefaultProperties.Add(current);
                current = new ME3DefaultProperty(Data, PCC);
            }

            return(true);
        }
コード例 #3
0
ファイル: ME3ObjectConverter.cs プロジェクト: Mgamerz/ME3Libs
        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);

            }
        }