public void XmlImportTest1() { var actual = new FeedConfigItemList(); var serializer = new XmlSerializer(actual.GetType()); var sr = new StringReader(Properties.Resources.XmlImportTest1); var xmlr = XmlReader.Create(sr); if (serializer.CanDeserialize(xmlr)) { actual = (FeedConfigItemList)serializer.Deserialize(xmlr); } xmlr.Close(); sr.Close(); Assert.AreEqual(16, actual.Items.Count); }
private void LoadFeedSettings() { Log.Debug("Loading Feed Settings"); try { var xmlr = XmlReader.Create(new StringReader(Properties.Settings.Default.FeedConfigItems)); if (serializer.CanDeserialize(xmlr)) { FeedConfigItems = (FeedConfigItemList)serializer.Deserialize(xmlr); } xmlr.Close(); } catch (XmlException ex) { Log.Error("XmlException thrown when Loading the feed settings", ex); FeedConfigItems = new FeedConfigItemList(); } catch (InvalidOperationException ex) { Log.Error("InvalidOperationException thrown when Loading the feed settings", ex); FeedConfigItems = new FeedConfigItemList(); } catch (Exception ex) { Log.Error("Exception thrown when Loading the feed settings", ex); throw; } }
internal void LoadFeedConfig(XmlReader xmlr) { Log.Debug("Loading the FeedConfig"); try { FeedConfigItems = (FeedConfigItemList)serializer.Deserialize(xmlr); SaveFeedSettings(); ReloadFeedConfigItems(true); } catch (Exception ex) { Log.Error("Exception thrown when trying to load the FeedConfig", ex); throw; } }