예제 #1
0
        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());
            }
        }
예제 #2
0
        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());
        }