Exemple #1
0
        public override bool Connect(IDomain domain, IArea rootArea, IArea currentArea, IObject currentObject)
        {
            IResource          Resource          = TextResource;
            IObject            Object            = TextObject;
            IObjectProperty    ObjectProperty    = TextObjectProperty;
            IDeclarationSource ObjectPropertyKey = TextKey;
            bool IsConnected = TextProperty.ConnectToResourceOrObject(domain, currentArea, currentObject, ref Resource, ref Object, ref ObjectProperty, ref ObjectPropertyKey);

            if (!(ObjectProperty is IObjectPropertyInteger) &&
                !(ObjectProperty is IObjectPropertyString) &&
                !(ObjectProperty is IObjectPropertyReadonlyString) &&
                !(ObjectProperty is IObjectPropertyEnum) &&
                !(ObjectProperty is IObjectPropertyStringDictionary))
            {
                throw new ParsingException(133, Source.Source, $"Invalid type for property '{Source.Name}'.");
            }

            TextResource       = Resource;
            TextObject         = Object;
            TextObjectProperty = ObjectProperty;
            TextKey            = ObjectPropertyKey;

            TextObjectProperty?.SetIsRead();

            return(IsConnected);
        }
Exemple #2
0
        private IObjectPropertyCollection ParseObjectProperties(IParsingSourceStream sourceStream, ref string line)
        {
            IObjectPropertyCollection ObjectPropertyList = new ObjectPropertyCollection();

            string HeaderLine = sourceStream.Line;

            if (HeaderLine != "properties")
            {
                throw new ParsingException(95, sourceStream, "'properties' expected.");
            }

            while (!sourceStream.EndOfStream)
            {
                sourceStream.ReadLine();
                if (string.IsNullOrEmpty(sourceStream.Line))
                {
                    break;
                }

                IObjectProperty NewProperty = ParseProperty(sourceStream);

                foreach (IObjectProperty ObjectProperty in ObjectPropertyList)
                {
                    if (ObjectProperty.NameSource.Name == NewProperty.NameSource.Name)
                    {
                        throw new ParsingException(96, sourceStream, $"Object already contains a property called '{NewProperty.NameSource.Name}'.");
                    }
                }

                ObjectPropertyList.Add(NewProperty);
            }

            return(ObjectPropertyList);
        }
Exemple #3
0
 public GeneratorObjectProperty(IObjectProperty property, IGeneratorObject obj)
 {
     NameSource = property.NameSource;
     CSharpName = property.CSharpName;
     IsRead     = property.IsRead;
     IsWrite    = property.IsWrite;
     Object     = obj;
 }
Exemple #4
0
            public static QueryParameter From(IObjectProperty property)
            {
                var name         = property.TypeProperty.Name;
                var value        = property.Value;
                var stringValue  = value.ToString();
                var encodedValue = HttpUtility.UrlEncode(stringValue);

                return(new QueryParameter(name, encodedValue));
            }
Exemple #5
0
        private void ConnectContent(IDomain domain, IArea currentArea, IObject currentObject, ref bool IsConnected)
        {
            IResource          Resource          = ContentResource;
            IObject            Object            = ContentObject;
            IObjectProperty    ObjectProperty    = ContentObjectProperty;
            IDeclarationSource ObjectPropertyKey = ContentKey;

            IsConnected          |= ContentProperty.ConnectToResourceOrObject(domain, currentArea, currentObject, ref Resource, ref Object, ref ObjectProperty, ref ObjectPropertyKey);
            ContentResource       = Resource;
            ContentObject         = Object;
            ContentObjectProperty = ObjectProperty;
            ContentKey            = ObjectPropertyKey;

            ContentObjectProperty?.SetIsRead();
        }
Exemple #6
0
        public bool Connect(IDomain domain, IDynamic currentDynamic, IObject currentObject)
        {
            IObject            Object            = ValueObject;
            IObjectProperty    ObjectProperty    = ValueObjectProperty;
            IDeclarationSource ObjectPropertyKey = ValueKey;
            bool IsConnected = ValueProperty.ConnectToObjectOnly(domain, null, currentObject, ref Object, ref ObjectProperty, ref ObjectPropertyKey);

            ValueObject         = Object;
            ValueObjectProperty = ObjectProperty;
            ValueKey            = ObjectPropertyKey;

            ValueObjectProperty?.SetIsRead();

            return(IsConnected);
        }
Exemple #7
0
        public static IGeneratorObjectProperty Convert(IObjectProperty property, IGeneratorObject obj)
        {
            IGeneratorObjectProperty Result;

            if (property is IObjectPropertyInteger AsObjectPropertyInteger)
            {
                Result = new GeneratorObjectPropertyInteger(AsObjectPropertyInteger, obj);
            }
            else if (property is IObjectPropertyBoolean AsObjectPropertyBoolean)
            {
                Result = new GeneratorObjectPropertyBoolean(AsObjectPropertyBoolean, obj);
            }
            else if (property is IObjectPropertyString AsObjectPropertyString)
            {
                Result = new GeneratorObjectPropertyString(AsObjectPropertyString, obj);
            }
            else if (property is IObjectPropertyReadonlyString AsObjectPropertyReadonlyString)
            {
                Result = new GeneratorObjectPropertyReadonlyString(AsObjectPropertyReadonlyString, obj);
            }
            else if (property is IObjectPropertyStringDictionary AsObjectPropertyStringDictionary)
            {
                Result = new GeneratorObjectPropertyStringDictionary(AsObjectPropertyStringDictionary, obj);
            }
            else if (property is IObjectPropertyStringList AsObjectPropertyStringList)
            {
                Result = new GeneratorObjectPropertyStringList(AsObjectPropertyStringList, obj);
            }
            else if (property is IObjectPropertyEnum AsObjectPropertyEnum)
            {
                Result = new GeneratorObjectPropertyEnum(AsObjectPropertyEnum, obj);
            }
            else if (property is IObjectPropertyItem AsObjectPropertyItem)
            {
                Result = new GeneratorObjectPropertyItem(AsObjectPropertyItem, obj);
            }
            else if (property is IObjectPropertyItemList AsObjectPropertyItemList)
            {
                Result = new GeneratorObjectPropertyItemList(AsObjectPropertyItemList, obj);
            }
            else
            {
                throw new InvalidOperationException();
            }

            GeneratorObjectPropertyMap.Add(property, Result);
            return(Result);
        }
        private void AnalyseGeometryBlendShape(StreamReader reader, ref IObjectProperty data)
        {
            string line = "";
            int indent = 1;

            while (!(line = reader.ReadLine()).Contains('}') && indent > 0)
            {
                if (line.Contains('{'))
                    indent++;
                else if (line.Contains('}'))
                    indent--;

                if (line.Contains(ANSKFbxFileKeywords.ObjectPropertyIndexes))
                {
                    ((GeometryProperty<BlendShapePropertyType>)data).Indicies.AddRange(CollectIntList(reader, GrabElementNumber(line)));
                    indent--;
                }
                else if (line.Contains(ANSKFbxFileKeywords.ObjectPropertyVertices))
                {
                    ((GeometryProperty<BlendShapePropertyType>)data).Verticies.AddRange(CollectVector3List(reader, GrabElementNumber(line)));
                    indent--;
                }
                else if (line.Contains(ANSKFbxFileKeywords.ObjectPropertyNormals))
                {
                    ((GeometryProperty<BlendShapePropertyType>)data).Normals.AddRange(CollectVector3List(reader, GrabElementNumber(line)));
                    indent--;
                }
            }
        }
Exemple #9
0
 public void Visit(IObjectProperty mapping)
 {
     Increment("object");
 }
Exemple #10
0
 public virtual void Visit(IObjectProperty property)
 {
 }
        private void ScanProperties(StreamReader reader, ref IObjectProperty data)
        {
            string line;
            string pName = "", pType = ""; string[] extra;

            while ((line = reader.ReadLine()).Contains(ANSKFbxFileKeywords.ObjectPropertyStart))
            {
                pName = ""; pType = "";

                ScanPropertyLine(line, out pName, out pType, out extra);

                switch (pName)
                {
                    case ANSKFbxFileKeywords.PropertiesLocalTranslation:
                        ((LimbNodeProperty<LimbNodeJointType>)data).PropertyType.Translation = PropertyExtraToVector3(extra);
                        break;
                    case ANSKFbxFileKeywords.PropertiesLocalRotation:
                        ((LimbNodeProperty<LimbNodeJointType>)data).PropertyType.Rotation = PropertyExtraToVector3(extra);
                        break;
                }
            }
        }
        private void ScanTypeFlags(string line, ref IObjectProperty data)
        {
            string[] types = line.Split('"');

            if (types[1] == "Skeleton")
                ((LimbNodeProperty<LimbNodeNodeAttributeType>)data).PropertyType.IsSkeletonType = true;
        }
        private void AnalyseGeometryMesh(StreamReader reader, ref IObjectProperty data)
        {
            string line = "";
            int indent = 1;

            while ((line = reader.ReadLine()) != "\t}")// && indent > 0)
            {
                if (line.Contains('{'))
                    indent++;
                else if (line.Contains('}'))
                    indent--;

                if (line.Contains(ANSKFbxFileKeywords.ObjectPropertyVertices))
                {
                    ((GeometryProperty<MeshPropertyType>)data).Verticies.AddRange(CollectVector3List(reader, GrabElementNumber(line)));
                    indent--;
                }
                else if (line.Contains(ANSKFbxFileKeywords.MeshPropertyPolygonVertexIndex))
                {
                    ((GeometryProperty<MeshPropertyType>)data).PropertyType.PolygonVertexIndex.AddRange(CollectIntList(reader, GrabElementNumber(line)));
                    indent--;
                }
                else if (line.Contains(ANSKFbxFileKeywords.ObjectPropertyEdges))
                {
                    ((GeometryProperty<MeshPropertyType>)data).PropertyType.Edges.AddRange(CollectIntList(reader, GrabElementNumber(line)));
                    indent--;
                }
                else if (line.Contains(ANSKFbxFileKeywords.ObjectPropertyNormals))
                {
                    ((GeometryProperty<MeshPropertyType>)data).Normals.AddRange(CollectVector3List(reader, GrabElementNumber(line)));
                    indent--;
                }
                else if (line.Contains(ANSKFbxFileKeywords.MeshPropertyUV))
                {
                    ((GeometryProperty<MeshPropertyType>)data).PropertyType.Uvs.AddRange(CollectVector2List(reader, GrabElementNumber(line)));
                    indent--;
                }
                else if (line.Contains(ANSKFbxFileKeywords.MeshPropertyUVIndex))
                {
                    ((GeometryProperty<MeshPropertyType>)data).PropertyType.UvIndex.AddRange(CollectIntList(reader, GrabElementNumber(line)));
                    indent--;
                }
            }
        }
 private void AnalyseLimbNodeProperties(StreamReader reader, ref IObjectProperty data)
 {
     string line = "";
 }
        private void AnalyseGeometryLimbNode(StreamReader reader, ref IObjectProperty data)
        {
            string line = "";
            int indent = 1;

            while ((line = reader.ReadLine()) != "\t}")
            {
                if (line.Contains('{'))
                    indent++;
                else if (line.Contains('}'))
                    indent--;

                if (data.GetType() == typeof(LimbNodeProperty<LimbNodeNodeAttributeType>))
                {
                    if (line.Contains(ANSKFbxFileKeywords.PropertiesTypeFlagsHeading))
                        ScanTypeFlags(line, ref data);
                }
                else if (data.GetType() == typeof(LimbNodeProperty<LimbNodeJointType>))
                {
                    if (line.Contains(ANSKFbxFileKeywords.LimbNodePropertiesHeading))
                        ScanProperties(reader, ref data);
                }
            }
        }
		public virtual void Visit(IObjectProperty property) { }
Exemple #17
0
        public bool ConnectToObjectOnly(IDomain domain, IArea currentArea, IObject currentObject, ref IObject obj, ref IObjectProperty objectProperty, ref IDeclarationSource objectPropertyKey)
        {
            bool IsConnected = false;

            if ((ObjectSource != null || ObjectPropertySource != null) && (obj == null || objectProperty == null))
            {
                ConnectToObject(domain, currentArea, ObjectSource, ObjectPropertySource, ObjectPropertyKey, ref obj);

                foreach (IObjectProperty Property in obj.Properties)
                {
                    if (Property.NameSource.Name == ObjectPropertySource.Name)
                    {
                        if (Property is IObjectPropertyStringDictionary AsObjectPropertyStringDictionary)
                        {
                            if (ObjectPropertyKey == null)
                            {
                                throw new ParsingException(143, ObjectPropertySource.Source, $"'{obj.Name}.{ObjectPropertySource.Name}' must be used with a key.");
                            }
                        }
                        else
                        {
                            if (ObjectPropertyKey != null)
                            {
                                throw new ParsingException(144, ObjectPropertySource.Source, $"'{obj.Name}.{ObjectPropertySource.Name}' cannot be used with a key.");
                            }
                        }

                        objectProperty    = Property;
                        objectPropertyKey = ObjectPropertyKey;
                        break;
                    }
                }

                if (objectProperty == null)
                {
                    throw new ParsingException(141, ObjectPropertySource.Source, $"Unknown property '{ObjectPropertySource.Name}' in object '{obj.Name}'.");
                }

                IsConnected = true;
            }

            return(IsConnected);
        }
		public virtual void Visit(IObjectProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttribute attribute)
		{
		}
 public override void Visit(IObjectProperty property) => AddAlias(property);
Exemple #20
0
 public virtual void Visit(IObjectProperty type, PropertyInfo propertyInfo, ElasticsearchPropertyAttributeBase attribute)
 {
 }
        private void AnalyseGeometryDeformer(StreamReader reader, ref IObjectProperty data)
        {
            string line = "";
            int indent = 1;

            while ((line = reader.ReadLine()) != "\t}")
            {
                if (line.Contains('{'))
                    indent++;
                else if (line.Contains('}'))
                    indent--;

                if (line.Contains(ANSKFbxFileKeywords.ObjectPropertyIndexes))
                {
                    ((DeformerProperty<JointPropertyType>)data).Indicies.AddRange(CollectIntList(reader, GrabElementNumber(line)));
                    indent--;
                }
                else if (line.Contains(ANSKFbxFileKeywords.ObjectPropertyWeights))
                {
                    ((DeformerProperty<JointPropertyType>)data).PropertyType.Weights.AddRange(CollectFloatList(reader, GrabElementNumber(line)));
                    indent--;
                }
            }
        }