/// <inheritdoc />
        public void StoreDecision(DecisionModel decision)
        {
            this.RemoveAllOccurences(decision);

            string titre = decision.EstSupprimée ? RemovedIndicator + decision.Titre : decision.Titre;
            var    item  = new RssItem
            {
                title       = titre,
                pubDate     = decision.Date.ToString("ddd, dd MMM yyyy HH:mm:ss"),
                description = decision.Description,
                link        = decision.Lien?.ToString(),
                guid        = new Guid {
                    isPermaLink = false, Value = decision.GetHashCode().ToString()
                }
            };

            foreach (Domaine decisionDomaine in decision.Domaines)
            {
                RssChannel channel = this.OpenOrCreateChannelForDomaine(decisionDomaine);
                channel.Add(item);

                var rss = new Rss {
                    channel = new [] { channel }
                };
                var serializer = new XmlSerializer(typeof(Rss));

                IFile file = this._feedsStorageDirectory.CreateOrReturn(FileNameForDomaine(decisionDomaine));

                using (StreamWriter writer = file.CreateWriter())
                    serializer.Serialize(writer, rss);
            }
        }
Beispiel #2
0
        public static void WriteAll(this IFile self, params string[] text)
        {
            Contract.RequiresNotNull(self, "self");

            using (var writer = self.CreateWriter())
            {
                foreach (var line in text)
                {
                    writer.WriteLine(line);
                }
            }
        }