Esempio n. 1
0
        public UserTemplate(SporeServerUser author, SporeServerAsset[] assets)
        {
            // <feed />
            //
            var document = AtomFeedBuilder.CreateDocument("feed");

            // <id />
            AtomFeedBuilder.AddCustomElement(document, "id", $"tag:spore.com,2006:user/{author.Id}");
            // <title />
            AtomFeedBuilder.AddCustomElement(document, "title", $"{author.UserName}");
            // <updated />
            // TODO
            AtomFeedBuilder.AddCustomElement(document, "updated", $"{XmlConvert.ToString(DateTime.Now, XmlDateTimeSerializationMode.Utc)}");
            // <author />
            AtomFeedBuilder.AddAuthorElement(document, $"{author.UserName}", $"{author.Id}");
            // <subcount />
            // TODO?
            AtomFeedBuilder.AddCustomElement(document, "subcount", "0");
            // <link />
            AtomFeedBuilder.AddLinkElement(document, "self", $"https://pollinator.spore.com/pollinator/atom/user/{author.Id}", null, null);

            // add assets to feed
            SporeAtomFeedHelper.AddAssetsToFeed(document, assets);

            // save xml
            _xml = document.OuterXml;
        }
Esempio n. 2
0
        public AggregatorTemplate(SporeServerAggregator aggregator, int subscriberCount)
        {
            // <feed />
            //
            var document = AtomFeedBuilder.CreateDocument("feed");

            // <id />
            AtomFeedBuilder.AddCustomElement(document, "id", $"tag:spore.com,2006:aggregator/{aggregator.AggregatorId}");
            // <title />
            AtomFeedBuilder.AddCustomElement(document, "title", $"{aggregator.Name}");
            // <updated />
            AtomFeedBuilder.AddCustomElement(document, "updated", $"{XmlConvert.ToString(aggregator.Timestamp, XmlDateTimeSerializationMode.Utc)}");
            // <subtitle />
            AtomFeedBuilder.AddCustomElement(document, "subtitle", $"{aggregator.Description}");
            // <author />
            AtomFeedBuilder.AddAuthorElement(document, $"{aggregator.Author.UserName}", $"{aggregator.Author.Id}");
            // <subcount />
            AtomFeedBuilder.AddCustomElement(document, "subcount", $"{subscriberCount}");
            // <link />
            AtomFeedBuilder.AddLinkElement(document, "self", $"https://www.spore.com/pollinator/atom/aggregator/{aggregator.AggregatorId}", null, null);

            // add assets to feed
            SporeAtomFeedHelper.AddAssetsToFeed(document, aggregator.Assets.ToArray());

            // save xml
            _xml = document.OuterXml;
        }