public static AnnouncementInfo FromString(string input) { AnnouncementInfo newInfo = new AnnouncementInfo(); if (string.IsNullOrEmpty(input)) { newInfo.IsValid = false; } else { UpdateFile updateFile = new UpdateFile(input); newInfo.Name = updateFile.GetString("Name"); newInfo.Address = updateFile.GetUri("URL"); newInfo.IsValid = true; } return(newInfo); }
private void GetAnnouncementInfo() { Uri announcementFileUri = new Uri(Convert.ToString(Settings.Default.AnnouncementAddress)); DownloadStringCompletedEventArgs e = DownloadString(announcementFileUri); if (!e.Cancelled && e.Error == null) { _currentAnnouncementInfo = AnnouncementInfo.FromString(e.Result); if (!string.IsNullOrEmpty(_currentAnnouncementInfo.Name)) { Settings.Default.LastAnnouncement = _currentAnnouncementInfo.Name; } } GetAnnouncementInfoCompletedEventEvent?.Invoke(this, e); }