コード例 #1
0
        public static void SaveConfiguration()
        {
            var config = new Config()
            {
                SourceImages = SourceImages.FindAll(item => item.IsTileSource),
                TileRules    = GetRules()
            };
            var content = new JavaScriptSerializer().Serialize(config);

            Helper.SaveFile(@"assets\config", content);
        }
コード例 #2
0
        public static void LoadConfiguration()
        {
            string content = Helper.LoadFile(@"assets\config");
            var    config  = new JavaScriptSerializer().Deserialize <Config>(content);

            SourceImages.RemoveAll(item => item.IsTileSource);
            SourceImages.AddRange(config.SourceImages);
            foreach (var r in config.TileRules)
            {
                AddRule(r);
            }

            SourceImages.FindAll(item => item.IsTileSource).ForEach(item => item.Load());
        }