Example #1
0
        /// <summary>
        /// Generates the code.
        /// </summary>
        /// <param name="rssDefinition">The RSS definition.</param>
        /// <param name="outputLanguage">The output language.</param>
        /// <param name="namespaceName">Name of the namespace.</param>
        /// <param name="classNamePrefix">The class name prefix.</param>
        /// <param name="outputCode">The output code.</param>
        /// <param name="useBaseClass">if set to <c>true</c> [use base class].</param>
        public static void GenerateCode(
            RssDocumentBase rssDefinition,
            string outputLanguage,
            string namespaceName,
            string classNamePrefix,
            TextWriter outputCode,
            bool useBaseClass)
        {
            if (rssDefinition == null)
            {
                throw new ArgumentNullException("rssDefinition");
            }

            if (string.IsNullOrEmpty(outputLanguage))
            {
                throw new ArgumentException(string.Format(Resources.RssToolkit.Culture, Resources.RssToolkit.ArgmentException, "outputLanguage"));
            }

            if (namespaceName == null)
            {
                throw new ArgumentNullException("namespaceName");
            }

            if (string.IsNullOrEmpty(classNamePrefix))
            {
                throw new ArgumentException(string.Format(Resources.RssToolkit.Culture, Resources.RssToolkit.ArgmentException, "classNamePrefix"));
            }

            if (outputCode == null)
            {
                throw new ArgumentNullException("outputCode");
            }

            GenerateCode(rssDefinition.ToXml(DocumentType.Rss), rssDefinition.Url, outputLanguage, namespaceName, classNamePrefix, outputCode, useBaseClass);
        }
        /// <summary>
        /// Generates the code.
        /// </summary>
        /// <param name="rssDefinition">The RSS definition.</param>
        /// <param name="outputLanguage">The output language.</param>
        /// <param name="namespaceName">Name of the namespace.</param>
        /// <param name="classNamePrefix">The class name prefix.</param>
        /// <param name="outputCode">The output code.</param>
        /// <param name="useBaseClass">if set to <c>true</c> [use base class].</param>
        public static void GenerateCode(
            RssDocumentBase rssDefinition,
            string outputLanguage, 
            string namespaceName, 
            string classNamePrefix,
            TextWriter outputCode, 
            bool useBaseClass)
        {
            if (rssDefinition == null)
            {
                throw new ArgumentNullException("rssDefinition");
            }

            if (string.IsNullOrEmpty(outputLanguage))
            {
                throw new ArgumentException(string.Format(Resources.RssToolkit.Culture, Resources.RssToolkit.ArgmentException, "outputLanguage"));
            }

            if (namespaceName == null)
            {
                throw new ArgumentNullException("namespaceName");
            }

            if (string.IsNullOrEmpty(classNamePrefix))
            {
                throw new ArgumentException(string.Format(Resources.RssToolkit.Culture, Resources.RssToolkit.ArgmentException, "classNamePrefix"));
            }

            if (outputCode == null)
            {
                throw new ArgumentNullException("outputCode");
            }

            GenerateCode(rssDefinition.ToXml(DocumentType.Rss), rssDefinition.Url, outputLanguage, namespaceName, classNamePrefix, outputCode, useBaseClass);
        }