Example #1
0
        private void MainForm_FormClosed(object sender, FormClosedEventArgs e)
        {
            var fs       = new FileStream("data2", FileMode.Create);
            var save     = Convert.ToBase64String(Encoding.UTF8.GetBytes(DataEncoder.Encode(user.Text + "\\" + password.Text + "\\" + equipMin.Text + "\\" + equipMax.Text + "\\" + fullEquip.Checked.ToString() + "\\" + questId.Text + "\\" + questPhase.Text + "\\" + resultTime.Text + "\\" + battleTimes.Text + "\\" + apBox.SelectedIndex.ToString() + "\\" + autoApple.Checked.ToString() + "\\" + autoSell.Checked.ToString())));
            var saveData = Encoding.UTF8.GetBytes(save);

            fs.Write(saveData, 0, saveData.Length);
            fs.Close();
            fs.Dispose();
        }
Example #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            func.SelectedIndex          = 0;
            stoneOrTicket.SelectedIndex = 0;
            if (File.Exists("data2"))
            {
                try
                {
                    var data = DataEncoder.Decode(FgoMain.convert_response(File.ReadAllText("data2"))).Split('\\');
                    user.Text         = data[0];
                    password.Text     = data[1];
                    equipMin.Text     = data[2];
                    equipMax.Text     = data[3];
                    fullEquip.Checked = bool.Parse(data[4]);
                    questId.Text      = data[5];
                    questPhase.Text   = data[6];
                    resultTime.Text   = data[7];
                    battleTimes.Text  = data[8];
                    if (!data[9].Equals(""))
                    {
                        apBox.SelectedIndex = int.Parse(data[9]);
                    }
                    autoApple.Checked = bool.Parse(data[10]);
                    autoSell.Checked  = bool.Parse(data[11]);
                }
                catch (Exception)
                {
                    File.Delete("data2");
                }
                if (File.Exists("itemdata.json"))
                {
                    var sr = new StreamReader("itemdata.json", Encoding.UTF8, true);
                    try
                    {
                        JToken itemData = (JObject)JsonConvert.DeserializeObject(sr.ReadToEnd());
                        foreach (JProperty item in itemData)
                        {
                            ScriptConst.mstItem.Add(item.Name.ToString(), item.Value.ToString());
                        }
                    }
                    catch (Exception)
                    {
                    }
                    sr.Close();
                    sr.Dispose();
                }
                if (File.Exists("svtdata.json"))
                {
                    var sr = new StreamReader("svtdata.json", Encoding.UTF8, true);
                    try
                    {
                        JToken svtData = (JObject)JsonConvert.DeserializeObject(sr.ReadToEnd());
                        foreach (JProperty item in svtData)
                        {
                            ScriptConst.mstSvt.Add(item.Name.ToString(), item.Value.ToString());
                        }
                    }
                    catch (Exception)
                    {
                    }
                    sr.Close();
                    sr.Dispose();
                }
            }
            var invTable = new DataTable();

            invTable.Columns.AddRange(new DataColumn[] { new DataColumn("物品名字"), new DataColumn("数量") });
            itemInv.DataSource = invTable;
            logBox.AppendText(LogHelper.getPrefix() + "程序加载成功.\r\n");
        }