private void SaveIABt_Click(object sender, EventArgs e) { if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dynamic iapath = saveFileDialog1.FileName; Display Disp = new Display(ChoixName.Text, ChoixAuteur.Text, ChoixClasse.Text, ChoixVersion.Value); FightConfig Config = new FightConfig(ChoixTactique.SelectedText, ChoixPlacement.SelectedText, (int)ChoixFarCells.Value); //string ApplicationDataPath = Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData); //string tempPath = iapath = System.IO.Path.Combine (ApplicationDataPath, "BlueSheep", "Temp"); //string dispPath = System.IO.Path.Combine (tempPath, "disp.xml"); //Serialize(Disp, dispPath); //string configPath = System.IO.Path.Combine (tempPath, "config.xml"); //Serialize(Config, configPath); //string spellsPath = System.IO.Path.Combine (tempPath, "spells.xml"); //Serialize(SpellsList, spellsPath); //compression(tempPath, iapath); //File.Delete(dispPath); //File.Delete(configPath); //File.Delete(spellsPath); Serialize(Disp, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Temp\disp.xml"); Serialize(Config, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Temp\config.xml"); Serialize(SpellsList, Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Temp\spells.xml"); compression(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Temp\", iapath); File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Temp\disp.xml"); File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Temp\config.xml"); File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\BlueSheep\Temp\spells.xml"); this.Close(); } }
//public Dictionary<string, int> m_Ressources; //public Dictionary<DateTime, int> m_xpWon; //public Dictionary<string, int> m_winLoseDic; public Config(FightConfig myconf, List <BSpell> myspells, string path, string flood)//,Dictionary<string, int> ressources,Dictionary<DateTime, int> xpWon, //Dictionary<string, int> winLoseDic) { this.m_Conf = myconf; this.m_Spells = myspells; this.m_Path = path; this.m_FloodContent = flood; //this.m_Ressources = ressources; //this.m_xpWon = xpWon; //this.m_winLoseDic = winLoseDic; }
public object DeserializeConfig(string file) { StreamReader sr = new StreamReader(file); XmlSerializer seria = new XmlSerializer(typeof(FightConfig)); List <object> Infos = new List <object>(); FightConfig conf = (FightConfig)seria.Deserialize(sr); Infos.Add(conf.Placement); Infos.Add(conf.Tactic); sr.Close(); return(conf); }
public void SaveConfig() { FightConfig fconf = null; List <BSpell> lspells = new List <BSpell>(); string ia = "Aucune IA"; //Dictionary<DateTime, int> exp = new Dictionary<DateTime,int>(); //Dictionary<string,int> winLose = new Dictionary<string,int>(); if (account.Fight != null) { fconf = account.Fight.m_Conf; lspells = account.Fight.m_Spells; ia = account.NomIA.Text; //exp = account.Fight.xpWon; //winLose = account.Fight.winLoseDic; } string path = ""; if (account.Path != null && !string.IsNullOrEmpty(account.Path.path)) { path = account.Path.path; } string flood = ""; if (account.FloodContent.Length > 0) { flood = account.FloodContent; } string pathBot = ""; if (account.Path.pathBot != null) { pathBot = account.Path.pathBot; } Dictionary <string, int> ressources = account.Gather.Stats; List <string> L1R = ressources.Keys.ToList(); List <int> L2R = ressources.Values.ToList(); if (fconf != null) { Config conf = new Config(fconf, lspells, path, flood, pathBot, ia, L1R, L2R);//, ressources, exp, winLose); string spath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "BlueSheep", "Accounts", account.AccountName, account.CharacterBaseInformations.name + ".xml"); Serialize(conf, spath); } }
//public Dictionary<DateTime, int> m_xpWon; //public Dictionary<string, int> m_winLoseDic; public Config(FightConfig myconf, List <BSpell> myspells, string path, string flood, string botpath, string ia, List <string> L1R, List <int> L2R)//,Dictionary<string, int> ressources,Dictionary<DateTime, int> xpWon, //Dictionary<string, int> winLoseDic) { this.m_Conf = myconf; this.m_Spells = myspells; this.m_Path = path; this.m_FloodContent = flood; this.m_BotPath = botpath; this.m_IA = ia; this.m_L1R = L1R; this.m_L2R = L2R; //this.m_Ressources = ressources; //this.m_xpWon = xpWon; //this.m_winLoseDic = winLoseDic; }
public void SaveConfig() { FightConfig fconf = null; List <BSpell> lspells = new List <BSpell>(); //Dictionary<DateTime, int> exp = new Dictionary<DateTime,int>(); //Dictionary<string,int> winLose = new Dictionary<string,int>(); if (account.Fight != null) { fconf = account.Fight.m_Conf; lspells = account.Fight.m_Spells; //exp = account.Fight.xpWon; //winLose = account.Fight.winLoseDic; } string path = ""; if (account.Path != null) { path = account.Path.path; } string flood = ""; if (account.FloodContent.Length > 0) { flood = account.FloodContent; } //Dictionary<string, int> ressources = account.Gather.Stats; Config conf = new Config(fconf, lspells, path, flood);//, ressources, exp, winLose); string spath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "BlueSheep", "Accounts", account.AccountName, account.CharacterBaseInformations.name + ".xml"); Serialize(conf, spath); }
private void FilesList_SelectedIndexChanged(object sender, EventArgs e) { if (FilesList.SelectedItems.Count > 0) { string path = FilesList.SelectedItems[0].SubItems[4].Text; string ApplicationDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string combinedPath = System.IO.Path.Combine(ApplicationDataPath, "BlueSheep", "Temp"); Decompress(combinedPath, path); combinedPath = System.IO.Path.Combine(ApplicationDataPath, "BlueSheep", "Temp", "config.xml"); string file1 = combinedPath; combinedPath = System.IO.Path.Combine(ApplicationDataPath, "BlueSheep", "Temp", "spells.xml"); string file2 = combinedPath; FightConfig Conf = (FightConfig)DeserializeConfig(file1); List <BSpell> Spells = (List <BSpell>)DeserializeSpells(file2); Account.Fight = new BFight(Conf, Spells, Account); Account.NomIA.Text = FilesList.SelectedItems[0].SubItems[0].Text; combinedPath = System.IO.Path.Combine(ApplicationDataPath, "BlueSheep", "Temp", "disp.xml"); File.Delete(combinedPath); File.Delete(file1); File.Delete(file2); this.Close(); } }