private void RenderOptions(Entry entry)
        {
            string className = Utils.UppercaseFirst(entry.Name) + @"Options";

            string content =
            @"using System;
            using System.Runtime.CompilerServices;

            namespace jQueryApi.UI {{
            [Imported]
            [IgnoreNamespace]
            [ScriptName(""Object"")]
            public sealed class {0} {{
            public {0}() {{ }}
            public {0}(params object[] nameValuePairs) {{ }}

            {1}
            {2}
            }}
            }}";
            StringBuilder eventsContent = new StringBuilder();

            foreach (Event @event in entry.Events.AsQueryable().OrderBy(e => e.Name)) {
                if ([email protected]("function")) {
                    if (!string.IsNullOrEmpty(@event.Description)) {
                        eventsContent.Append(@"        /// <summary>
            /// " + Utils.FormatXmlComment(@event.Description) + @"
            /// </summary>");
                    }

                    string eventType;

                    if (string.IsNullOrEmpty(@event.Type)) {
                        eventType = "jQueryEventHandler";
                    } else {
                        eventType = Utils.UppercaseFirst(@event.Type.Replace(@event.Name.ToLower(), Utils.UppercaseFirst(@event.Name))) + @"EventHandler";
                    }

                    eventsContent.AppendLine(@"
            [IntrinsicProperty]
            public " + eventType + " " + Utils.UppercaseFirst(@event.Name) + " { get { return null; } set { } }");
                }
            }

            StringBuilder optionsContent = new StringBuilder();

            foreach (var option in entry.Options.AsQueryable()
                                           .OrderBy(o => o.Name)
                                           .GroupBy(o => o.Name)) {
                if (!string.IsNullOrEmpty(option.Min(o => o.Description))) {
                    optionsContent.Append(@"        /// <summary>
            /// " + Utils.FormatXmlComment(option.Min(o => o.Description)) + @"
            /// </summary>");
                }

                optionsContent.AppendLine(@"
            [IntrinsicProperty]
            public " + Utils.GetCSType(option.Min(o => o.Type)) + @" " + Utils.UppercaseFirst(option.Key) + @" { get { return " + Utils.GetDefaultValue(option.Min(o => o.Type)) + @"; } set { } }");
            }

            Utils.CreateFile(DestinationPath, Utils.UppercaseFirst(entry.Name), className
                , string.Format(content, className, eventsContent.ToString(), optionsContent.ToString()));
        }
        private void RenderOptionEnum(Entry entry)
        {
            if (entry.Options.Count == 0) {
                return;
            }

            string className = Utils.UppercaseFirst(entry.Name) + @"Option";

            string content =
            @"using System.Runtime.CompilerServices;

            namespace jQueryApi.UI {{
            [Imported]
            [IgnoreNamespace]
            [NamedValues]
            public enum {0} {{{1}
            }}

            }}";
            StringBuilder enumValues = new StringBuilder();

            foreach (var option in entry.Options.AsQueryable()
                                           .OrderBy(o => o.Name)
                                           .GroupBy(o => o.Name)) {
                enumValues.AppendLine();
                enumValues.AppendLine("        /// <summary>");
                enumValues.AppendLine("        /// " + Utils.FormatXmlComment(option.Min(o => o.Description)));
                enumValues.AppendLine("        /// </summary>");
                enumValues.Append("        " + Utils.UppercaseFirst(option.Key) + ",");
            }

            Utils.CreateFile(DestinationPath, Utils.UppercaseFirst(entry.Name), className
                , string.Format(content, className, enumValues.ToString().Trim(',')));
        }
        private void RenderObject(Entry entry)
        {
            string className = Utils.UppercaseFirst(entry.Name) + @"Object";

            string content =
            @"using System.Runtime.CompilerServices;

            namespace jQueryApi.UI {{
            /// <summary>
            /// {1}
            /// </summary>
            /// <remarks>
            /// {2}
            /// </remarks>
            /// <example>
            /// {3}
            /// </example>
            [Imported]
            [IgnoreNamespace]
            public sealed class {0} : jQueryObject {{{4}{5}{6}
            }}
            }}";

            string overload1 =
            @"

            [ScriptName(""{0}"")]
            public extern {1}Object {1}();";

            string overload2 =
            @"

            [ScriptName(""{0}"")]
            public extern {1}Object {1}({1}Options options);";

            string overload3 =
            @"

            [ScriptName(""{0}"")]
            public extern object {1}({1}Method method, params object[] options);";

            string example = @"{0}
            /// <code>
            /// {1}
            /// </code>
            /// <code>
            /// {2}
            /// </code>";

            string formatedContent
                = string.Format(content
                                , className
                                , Utils.FormatXmlComment(entry.Description)
                                , Utils.FormatXmlComment(entry.LongDescription)
                                , (entry.Example != null) ? string.Format(example, Utils.FormatXmlComment(entry.Example.Description), Utils.FormatXmlComment(entry.Example.Code), Utils.FormatXmlComment(entry.Example.Html)) : string.Empty
                                , string.Format(overload1, entry.Name, Utils.UppercaseFirst(entry.Name))
                                , (entry.Options.Count > 0) ? string.Format(overload2, entry.Name, Utils.UppercaseFirst(entry.Name)) : string.Empty
                                , (entry.Methods.Count > 0) ? string.Format(overload3, entry.Name, Utils.UppercaseFirst(entry.Name)) : string.Empty);

            Utils.CreateFile(DestinationPath, Utils.UppercaseFirst(entry.Name), className, formatedContent);
        }
        private void RenderEvents(Entry entry)
        {
            if (entry.Events.Count == 0) {
                return;
            }

            string content =
            @"using System.Runtime.CompilerServices;

            namespace jQueryApi.UI {{
            [Imported]
            [IgnoreNamespace]
            [ScriptName(""Object"")]
            public sealed class {0} {{
            {1}
            }}
            }}";
            string property = @"
            [IntrinsicProperty]
            public {1} {0} {{ get {{ return {2}; }} set {{ }} }}";

            string className;

            foreach (var @event in entry.Events.AsQueryable()
                                          .OrderBy(e => e.Name)) {
                if (@event.Type.StartsWith("function")) continue;
                if (string.IsNullOrEmpty(@event.Type)) continue;

                string eventType = @event.Type.Replace(@event.Name.ToLower(), Utils.UppercaseFirst(@event.Name));

                foreach (Argument arg in @event.Arguments) {
                    if (arg.Name != "ui") continue;

                    className = Utils.UppercaseFirst(eventType) + "Event";

                    StringBuilder properties = new StringBuilder();

                    foreach (Property prop in arg.Properties.OrderBy(p => p.Name)) {
                        properties.Append(string.Format(property, Utils.UppercaseFirst(prop.Name), Utils.GetCSType(prop.Type), Utils.GetDefaultValue(prop.Type)));
                    }

                    RenderEventHandler(Utils.UppercaseFirst(entry.Name), eventType);

                    Utils.CreateFile(DestinationPath, Utils.UppercaseFirst(entry.Name)
                                    , className
                                    , string.Format(content, className, properties.ToString()));
                }
            }
        }
        private void RenderEntry(Entry entry)
        {
            if (entry == null) {
                return;
            }

            RenderObject(entry);
            RenderOptions(entry);
            RenderEvents(entry);

            RenderOptionEnum(entry);
            RenderEventsEnum(entry);
            RenderMethodEnum(entry);
        }
        private Entry ParseEntry(XmlNode xmlEntry)
        {
            if (xmlEntry == null) {
                return null;
            }

            Entry entry = new Entry();

            entry.Name = GetAttributeStringValue(xmlEntry, "name");
            entry.Namespace = GetAttributeStringValue(xmlEntry, "namespace");
            entry.Type = GetAttributeStringValue(xmlEntry, "type");
            entry.WidgetNamespace = GetAttributeStringValue(xmlEntry, "widgetnamespace");

            entry.Description = GetNodeInnerXml(xmlEntry, "desc");
            entry.LongDescription = GetNodeInnerXml(xmlEntry, "longdesc");
            entry.Created = GetNodeInnerXml(xmlEntry, "created");
            entry.Signatures = ParseSignatures(GetNodeList(xmlEntry, "signature"));

            entry.Options = ParseOptions(GetNodeList(xmlEntry, "//options//option"));
            entry.Events = ParseEvents(GetNodeList(xmlEntry, "//events//event"));
            entry.Methods = ParseMethods(GetNodeList(xmlEntry, "//methods//method"));

            XmlNode xmlExample = xmlEntry.SelectSingleNode("//example");
            if (xmlExample != null) {
                entry.Example = ParseExample(xmlExample);
            }

            XmlNode xmlCategory = xmlEntry.SelectSingleNode("//category");
            if (xmlCategory != null) {
                entry.Category = ParseCategory(xmlCategory);
            }

            return entry;
        }