Exemplo n.º 1
0
        private void AddNewsEntry(SteamKit2.KeyValue news)
        {
            News entry = new News();

            entry.title.Text = news["title"].AsString();

            DateTime reference = new DateTime(1970, 1, 1, 0, 0, 0, 0);
            DateTime time      = reference.AddSeconds(news["date"].AsInteger());

            entry.date.Content = time.ToString("yyyy") == DateTime.Now.Year.ToString() ? time.ToString("dd. MMM") : time.ToString("dd. MMM yyyy");

            entry.AddLink(news["url"].AsString());
            entry.content.Children.Add(new BBCodePanel(news["contents"].AsString()));
            this.news.Children.Add(entry);
        }
        public static bool ContainsKeyOrValue(this IEnumerable <SteamKit2.KeyValue> keyValues, string keyOrValue, out SteamKit2.KeyValue keyValue)
        {
            var kv = keyValues.FirstOrDefault(x => x.Name == keyOrValue || x.Value == keyOrValue);

            if (kv == null)
            {
                keyValue = SteamKit2.KeyValue.Invalid;
                return(false);
            }
            else
            {
                keyValue = kv;
                return(true);
            }
        }