コード例 #1
0
ファイル: ExporterBson.cs プロジェクト: 675492062/behaviac
        private void ExportProperties(BsonSerializer file, Attachments.Attachment a) {
            DesignerPropertyInfo propertyEffector = new DesignerPropertyInfo();
            file.WriteStartElement("properties");
            IList<DesignerPropertyInfo> properties = a.GetDesignerProperties(true);
            foreach(DesignerPropertyInfo p in properties) {
                // we skip properties which are not marked to be exported
                if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport))
                { continue; }

                object v = p.Property.GetValue(a, null);
                bool bExport = !Plugin.IsExportArray(v);

                if (bExport) {
                    if (p.Property.Name == "Effectors") {
                        propertyEffector = p;

                    } else {
                        WriteProperty(file, p, a);
                    }
                }
            }

            file.WriteEndElement();

            if (propertyEffector.Property != null) {
                List<TransitionEffector> listV = (List<TransitionEffector>)propertyEffector.Property.GetValue(a, null);

                if (listV != null) {
                    file.WriteStartElement("attachments");
                    foreach(TransitionEffector te in listV) {
                        file.WriteStartElement("attachment");
                        file.WriteStartElement("properties");
                        IList<DesignerPropertyInfo> effectorProperties = te.GetDesignerProperties();
                        foreach(DesignerPropertyInfo p in effectorProperties) {
                            // we skip properties which are not marked to be exported
                            if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport))
                            { continue; }

                            WriteProperty(file, p, te);
                        }

                        file.WriteEndElement();
                        file.WriteEndElement();
                    }

                    file.WriteEndElement();
                }
            }
        }
コード例 #2
0
ファイル: ExporterBson.cs プロジェクト: KeyleXiao/behaviac
        private void ExportProperties(BsonSerializer file, Attachments.Attachment a)
        {
            file.WriteStartElement("properties");
            IList<DesignerPropertyInfo> properties = a.GetDesignerProperties();
            foreach (DesignerPropertyInfo p in properties)
            {
                // we skip properties which are not marked to be exported
                if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport))
                    continue;

                WriteProperty(file, p, a);
            }
            file.WriteEndElement();
        }
コード例 #3
0
ファイル: ExporterXml.cs プロジェクト: haolly/behaviac
        private void ExportProperties(XmlWriter file, Attachments.Attachment a) {
            DesignerPropertyInfo propertyEffector = new DesignerPropertyInfo();
            IList<DesignerPropertyInfo> properties = a.GetDesignerProperties(true);
            foreach(DesignerPropertyInfo p in properties) {
                // we skip properties which are not marked to be exported
                if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport))
                { continue; }

                object v = p.Property.GetValue(a, null);
                bool bExport = !Plugin.IsExportArray(v);

                if (bExport) {
                    if (p.Property.Name == "Effectors") {
                        propertyEffector = p;

                    } else {
                        // create the code which assigns the value to the node's property
                        //file.Write(string.Format("{0}\t{1}.{2} = {3};\r\n", indent, nodeName, properties[p].Property.Name, properties[p].GetExportValue(node)));
                        string propValue = p.GetExportValue(a);

                        if (propValue != string.Empty && propValue != "\"\"") {
                            file.WriteStartElement("property");
                            file.WriteAttributeString(p.Property.Name, propValue);
                            file.WriteEndElement();
                        }
                    }
                }
            }

            if (propertyEffector.Property != null) {
                List<TransitionEffector> listV = (List<TransitionEffector>)propertyEffector.Property.GetValue(a, null);

                if (listV != null) {
                    foreach(TransitionEffector te in listV) {
                        IList<DesignerPropertyInfo> effectorProperties = te.GetDesignerProperties();
                        file.WriteStartElement("attachment");

                        foreach(DesignerPropertyInfo p in effectorProperties) {
                            // we skip properties which are not marked to be exported
                            if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport))
                            { continue; }

                            string propValue = p.GetExportValue(te);

                            if (propValue != string.Empty && propValue != "\"\"") {
                                file.WriteStartElement("property");
                                file.WriteAttributeString(p.Property.Name, propValue);
                                file.WriteEndElement();
                            }
                        }

                        file.WriteEndElement();
                    }
                }
            }
        }
コード例 #4
0
ファイル: ExporterXml.cs プロジェクト: KeyleXiao/behaviac
        private void ExportProperties(XmlWriter file, Attachments.Attachment a)
        {
            IList<DesignerPropertyInfo> properties = a.GetDesignerProperties();
            foreach (DesignerPropertyInfo p in properties)
            {
                // we skip properties which are not marked to be exported
                if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport))
                    continue;

                // create the code which assigns the value to the node's property
                //file.Write(string.Format("{0}\t{1}.{2} = {3};\r\n", indent, nodeName, properties[p].Property.Name, properties[p].GetExportValue(node)));
                file.WriteStartElement("property");
                file.WriteAttributeString(p.Property.Name, p.GetExportValue(a));
                file.WriteEndElement();
            }
        }