Example #1
0
        public override void WriteXml(XmlWriter writer)
        {
            writer.WriteElementString(RedmineKeys.NAME, Name);
            writer.WriteElementString(RedmineKeys.IDENTIFIER, Identifier);
            writer.WriteElementString(RedmineKeys.DESCRIPTION, Description);
            writer.WriteElementString(RedmineKeys.INHERIT_MEMBERS, InheritMembers.ToString());
            writer.WriteElementString(RedmineKeys.IS_PUBLIC, IsPublic.ToString());
            writer.WriteIdOrEmpty(Parent, RedmineKeys.PARENT_ID);
            writer.WriteElementString(RedmineKeys.HOMEPAGE, HomePage);

            if (Trackers != null)
            {
                foreach (var item in Trackers)
                {
                    writer.WriteElementString(RedmineKeys.TRACKER_IDS, item.Id.ToString());
                }
            }

            if (EnabledModules != null)
            {
                foreach (var item in EnabledModules)
                {
                    writer.WriteElementString(RedmineKeys.ENABLED_MODULE_NAMES, item.Name);
                }
            }

            if (Id == 0)
            {
                return;
            }

            writer.WriteArray(CustomFields, RedmineKeys.CUSTOM_FIELDS);
        }
Example #2
0
 public override void WriteXml(XmlWriter writer)
 {
     writer.WriteElementString("name", Name);
     writer.WriteElementString("identifier", Identifier);
     writer.WriteElementString("description", Description);
     writer.WriteElementString("inherit_members", InheritMembers.ToString());
     writer.WriteElementString("is_public", IsPublic.ToString());
     writer.WriteIdIfNotNull(Parent, "parent_id");
     writer.WriteElementString("homepage", HomePage);
     if (!string.IsNullOrEmpty(EnabledModuleNames))
     {
         var tokens = EnabledModuleNames.Split(
             ",".ToCharArray(),
             StringSplitOptions.RemoveEmptyEntries);
         foreach (var token in tokens)
         {
             writer.WriteElementString("enabled_module_names", token);
         }
     }
     if (Id == 0)
     {
         return;
     }
     if (CustomFields != null)
     {
         writer.WriteStartElement("custom_fields");
         writer.WriteAttributeString("type", "array");
         foreach (var cf in CustomFields)
         {
             new XmlSerializer(cf.GetType()).Serialize(writer, cf);
         }
         writer.WriteEndElement();
     }
 }
Example #3
0
        /// <summary>
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteXml(XmlWriter writer)
        {
            writer.WriteElementString(RedmineKeys.NAME, Name);
            writer.WriteElementString(RedmineKeys.IDENTIFIER, Identifier);
            writer.WriteElementString(RedmineKeys.DESCRIPTION, Description);
            writer.WriteElementString(RedmineKeys.INHERIT_MEMBERS, InheritMembers.ToString().ToLowerInvariant());
            writer.WriteElementString(RedmineKeys.IS_PUBLIC, IsPublic.ToString().ToLowerInvariant());
            writer.WriteIdOrEmpty(Parent, RedmineKeys.PARENT_ID);
            writer.WriteElementString(RedmineKeys.HOMEPAGE, HomePage);

            var trackers = new List <IValue>();

            foreach (var tracker in Trackers)
            {
                trackers.Add(tracker as IValue);
            }
            var enabledModules = new List <IValue>();

            foreach (var enabledModule in EnabledModules)
            {
                enabledModules.Add(enabledModule as IValue);
            }

            writer.WriteListElements(trackers, RedmineKeys.TRACKER_IDS);
            writer.WriteListElements(enabledModules, RedmineKeys.ENABLED_MODULE_NAMES);

            if (Id == 0)
            {
                return;
            }

            writer.WriteArray(CustomFields, RedmineKeys.CUSTOM_FIELDS);
        }
Example #4
0
        /// <summary>
        /// </summary>
        /// <param name="writer"></param>
        public override void WriteXml(System.Xml.XmlWriter writer)
        {
            writer.WriteElementString(RedmineKeys.NAME, Name);
            writer.WriteElementString(RedmineKeys.IDENTIFIER, Identifier);
            writer.WriteElementString(RedmineKeys.DESCRIPTION, Description);
            writer.WriteElementString(RedmineKeys.INHERIT_MEMBERS, InheritMembers.ToString().ToLowerInvariant());
            writer.WriteElementString(RedmineKeys.IS_PUBLIC, IsPublic.ToString().ToLowerInvariant());
            writer.WriteIdOrEmpty(Parent, RedmineKeys.PARENT_ID);
            writer.WriteElementString(RedmineKeys.HOMEPAGE, HomePage);

            writer.WriteListElements(Trackers as System.Collections.Generic.List <IValue>, RedmineKeys.TRACKER_IDS);
            writer.WriteListElements(EnabledModules as System.Collections.Generic.List <IValue>, RedmineKeys.ENABLED_MODULE_NAMES);

            if (Id == 0)
            {
                return;
            }

            writer.WriteArray(CustomFields, RedmineKeys.CUSTOM_FIELDS);
        }
Example #5
0
        public override void WriteXml(XmlWriter writer)
        {
            writer.WriteElementString("name", Name);
            writer.WriteElementString("identifier", Identifier);
            writer.WriteElementString("description", Description);
            writer.WriteElementString("inherit_members", InheritMembers.ToString());
            writer.WriteElementString("is_public", IsPublic.ToString());
            writer.WriteIdIfNotNull(Parent, "parent_id");
            writer.WriteElementString("homepage", HomePage);

            if (EnabledModules != null)
            {
                var enabledModuleNames = "";
                foreach (var projectEnabledModule in EnabledModules)
                {
                    if (!string.IsNullOrEmpty(projectEnabledModule.Name))
                    {
                        enabledModuleNames += projectEnabledModule.Name;
                    }
                }

                writer.WriteElementString("enabled_module_names", enabledModuleNames);
            }

            if (Id == 0)
            {
                return;
            }

            if (CustomFields != null)
            {
                writer.WriteStartElement("custom_fields");
                writer.WriteAttributeString("type", "array");
                foreach (var cf in CustomFields)
                {
                    new XmlSerializer(cf.GetType()).Serialize(writer, cf);
                }
                writer.WriteEndElement();
            }
        }