private void Buy(int i)
        {
            GameFormController gfcntrl   = new GameFormController(glibr.Get(i), user, t1[i], t2[i], t3[i]);
            DialogResult       dlgResult = gfcntrl.Run(this);

            if (dlgResult == DialogResult.OK)
            {
                user.Glib.Add(glibr.Get(i));
                libr.Set(user);
                System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                File.WriteAllText(@"E:\Registration\Registration\Registration\DataBase.json", "");
                for (int j = 0; j < libr.size(); j++)
                {
                    string sJSON = oSerializer.Serialize(libr.getByIndex(j));
                    sJSON += "\n";
                    File.AppendAllText(@"E:\Registration\Registration\Registration\DataBase.json", sJSON);
                }
                initializeTabPage2();
            }
        }
Exemple #2
0
        private void ShopForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            string path = "..\\..\\IndieBase.json";

            File.WriteAllText(path, "");
            System.Web.Script.Serialization.JavaScriptSerializer oSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            for (int i = 0; i < indies.Count; i++)
            {
                string sJSON = oSerializer.Serialize(indies[i]);
                sJSON += "\n";
                File.AppendAllText(path, sJSON);
            }

            path = "..\\..\\DataBase.json";
            File.WriteAllText(path, "");
            for (int j = 0; j < libr.size(); j++)
            {
                string sJSON = oSerializer.Serialize(libr.getByIndex(j));
                sJSON += "\n";
                File.AppendAllText(path, sJSON);
            }
        }