示例#1
0
        private void write(RssWriter writer)
        {
            try
            {
                if (channels.Count == 0)
                {
                    throw new InvalidOperationException("Feed must contain at least one channel.");
                }

                writer.Version = rssVersion;

                writer.Modules = modules;

                foreach (RssChannel channel in channels)
                {
                    if (channel.Items.Count == 0)
                    {
                        throw new InvalidOperationException("Channel must contain at least one item.");
                    }

                    writer.Write(channel);
                }
            }
            finally
            {
                if (writer != null)
                {
                    writer.Close();
                }
            }
        }