Beispiel #1
0
        public void Save()
        {
            List <SavedDiets> temp = new List <SavedDiets>(LoadData.NameDiet.Count);

            foreach (string key in LoadData.NameDiet.Keys)
            {
                temp.Add(new SavedDiets(key, LoadData.NameDiet[key].ToString()));
            }
            var xml = ServiceXml.GenericSerialize(temp);

            LoadData.SaveFile(xml);
        }
Beispiel #2
0
        public void Read()
        {
            string file = LoadData.LoadFile();

            if (file == null)
            {
                LoadData.WriteToScreen("Nie ma żadnych zapisanych pozycji!");
                return;
            }
            List <SavedDiets> temp = ServiceXml.GenericDeserialize <List <SavedDiets> >(file);

            foreach (SavedDiets sd in temp)
            {
                LoadData.NameDiet.TryAdd(sd.HorseName, sd.Diet);
            }
        }
Beispiel #3
0
        static LoadData()
        {
            core = ServiceXml.GenericDeserialize <Question>(ReadFile("db.xml", "UTF-8"));

            path1 = ServiceXml.GenericDeserialize <Question>(ReadFile("ogiery.xml", "UTF-8"));

            path2 = ServiceXml.GenericDeserialize <Question>(ReadFile("klacze zrebne i karmiace.xml", "UTF-8"));

            path3 = ServiceXml.GenericDeserialize <Question>(ReadFile("robocze.xml", "UTF-8"));

            NameDiet = new Dictionary <string, string>();

            IdButton = new Dictionary <int, Button>();

            FilePath = new Dictionary <string, Question>()
            {
                { "path1", path1 },
                { "path2", path2 },
                { "path3", path3 }
            };
        }