Esempio n. 1
0
        private void ExportProperties(Node n, int indent)
        {
            IList <DesignerPropertyInfo> properties = n.GetDesignerProperties();

            bool isCustomAction = ExportCustomAction(n, indent);

            foreach (DesignerPropertyInfo p in properties)
            {
                if (p.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoExport))
                {
                    continue;
                }

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

                if (bExport)
                {
                    string propValue = p.GetExportValue(n);
                    string name      = p.Property.Name;

                    if (propValue != string.Empty && propValue != "\"\"")
                    {
                        if (!ExportTypeMap.ContainsKey(name))
                        {
                            _err(String.Format("not support property!!! name:{0} value:{0}", name, propValue));
                        }
                        else if (ExportTypeMap[name] == PropertyType.Method)
                        {
                            if (isCustomAction)
                            {
                                continue;
                            }

                            ExportMethod(name, propValue, indent);
                        }
                        else if (ExportTypeMap[name] == PropertyType.Property)
                        {
                            ExportProperty(name, propValue, indent);
                        }
                        else
                        {
                            AddContent(String.Format("{0} = {1},", trans_name(name), trans_property(propValue)), indent);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void ExportProperties(Attachments.Attachment a, int indent)
        {
            //DesignerPropertyInfo propertyEffector = new DesignerPropertyInfo();
            IList <DesignerPropertyInfo> properties = a.GetDesignerProperties(true);

            foreach (DesignerPropertyInfo p in properties)
            {
                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")
                    {
                        string propValue = p.GetExportValue(a);
                        string name      = p.Property.Name;

                        if (propValue != string.Empty && propValue != "\"\"")
                        {
                            if (!ExportTypeMap.ContainsKey(name))
                            {
                                _err(String.Format("not support property!!! name:{0} value:{0}", name, propValue));
                            }
                            else if (ExportTypeMap[name] == PropertyType.Method)
                            {
                                ExportMethod(name, propValue, indent);
                            }
                            else if (ExportTypeMap[name] == PropertyType.Property)
                            {
                                ExportProperty(name, propValue, indent);
                            }
                            else
                            {
                                AddContent(String.Format("{0} = {1},", p.Property.Name, _quota(propValue)), indent);
                            }
                        }
                    }
                }
            }
        }