public static Banners LoadBanners(string data) { try { XmlSerializer serializer = new XmlSerializer(typeof(Banners)); //,xRoot); Banners banners = (Banners)serializer.Deserialize((new StringReader(data))); return(banners); }catch (Exception ex) { Moscrif.IDE.Tool.Logger.Error(ex.Message); Console.WriteLine(ex.Message); return(new Banners()); } }
public static Banners OpenBannerCache() { string bannerCachePath = System.IO.Path.Combine(MainClass.Paths.BannerCache, "banners.xml"); if (File.Exists(bannerCachePath)) { using (FileStream fs = File.OpenRead(bannerCachePath)) { XmlSerializer serializer = new XmlSerializer(typeof(Banners)); Banners banners = (Banners)serializer.Deserialize(fs); banners.IsCache = true; return(banners); } } return(new Banners()); }