Esempio n. 1
0
        internal static void RemoveFactory(Factory factory)
        {
            DataSaver <byte[]> .Remove("factory" + factory.Id);

            SavedData.Factories.RemoveAll(x => x.Id == factory.Id);
            Update();
        }
Esempio n. 2
0
        static Database()
        {
            TempData  = new TempData();
            SavedData = DataSaver <SavedData> .Load("SavedData");

            if (SavedData == null)
            {
                SavedData = new SavedData();
            }
        }
Esempio n. 3
0
        private async static void downloadImage(string url, string name)
        {
            var client = new WebClient();
            var stream = await client.OpenReadTaskAsync(new Uri(url, UriKind.Absolute));

            var bytes = ReadFully(stream);

            DataSaver <byte[]> .Remove(name);

            DataSaver <byte[]> .Save(name, bytes);

            Update();
        }
Esempio n. 4
0
        internal static ImageSource GetFactoryImage(Factory factory)
        {
            if (factory != null)
            {
                string name  = "factory" + factory.Id;
                var    bytes = DataSaver <byte[]> .Load(name);

                if (bytes == null)
                {
                    return(null);
                }
                var imgSource = new BitmapImage();
                imgSource.SetSource(new MemoryStream(bytes));
                return(imgSource);
            }
            return(null);
        }
Esempio n. 5
0
 public static void Update()
 {
     DataSaver <SavedData> .Save("SavedData", SavedData);
 }