private void AssignButton(SocialButton which, int pageNo, int btnNo) { which.Page = pageNo; which.Button = btnNo; if ( MessageBox.Show( "You are about to modify your live EQ ini files!\r\nIf your toon is logged in to EQ this won't work!", "Warning", MessageBoxButtons.OKCancel ) == DialogResult.OK) { FuEQ.SaveSocial(m_eqFolder, m_toonName, m_serverName, which); pages[pageNo - 1][btnNo - 1] = which; LoadSocialButton(btnNo); LoadPage(); } }
private static void BuildEmptyConfigFile(string path) { System.Text.StringBuilder sb = new StringBuilder(); sb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\" ?>"); sb.AppendLine("<configuration>"); sb.AppendLine("<appSettings>"); foreach (KeyValuePair <string, string> kvp in FuEQ.GetDefaultSettings()) { sb.AppendLine(String.Format("<add key=\"{0}\" value=\"{1}\" />", kvp.Key, kvp.Value)); } sb.AppendLine("</appSettings>"); sb.AppendLine("</configuration>"); System.IO.File.WriteAllText(path, sb.ToString()); }
private void LoadConfig() { cmbToons.Items.Clear(); cmbToons.Items.AddRange(FuEQ.GetToons().ToArray()); if (cmbToons.Items.Count > 0) { cmbToons.Enabled = true; if (m_currentToon.Length > 0 && m_currentServer.Length > 0) { int i = cmbToons.Items.IndexOf(String.Format("{0} - {1}", m_currentServer, m_currentToon)); if (i > -1) { cmbToons.SelectedIndex = i; } } else if (cmbToons.Items.Count > 0) { cmbToons.SelectedIndex = 0; } string[] toonBits = cmbToons.Items[cmbToons.SelectedIndex].ToString().Split(new string[] { " - " }, StringSplitOptions.None); if (toonBits.Length == 2) { m_currentToon = toonBits[1]; m_currentServer = toonBits[0]; EnableRestOfUI(); } } else { cmbToons.Enabled = false; // force them to add a toon DisableRestOfUI(); } txtEqFolder.Text = FuEQ.GetEQFolderForToon(m_currentToon, m_currentServer); // txtEqFolder.Text = Cfg.get("EqFolder"); txtLootMinutes.Text = Cfg.get("LootMinutes"); txtLootLookupMinutes.Text = Cfg.get("LootLookupMinutes"); txtEqCharacter.Text = ""; txtEqServer.Text = "bristle"; txtFuUsername.Text = Cfg.getEncrypted("HttpUsername"); txtFuPassword.Text = Cfg.getEncrypted("HttpPassword"); }
private void UpgradeOld() { string toon = Cfg.get("EqToon"); if (toon.Length > 0) { string server = Cfg.get("EqServerShortName"); string folder = Cfg.get("EqFolder"); FuEQ.SetToons(new List <string> { String.Format("{0} - {1}", server, toon) }); FuEQ.SetEQFolderForToon(toon, server, folder); Cfg.delete("EqToon"); Cfg.delete("EqServerShortName"); Cfg.delete("EqFolder"); Cfg.delete("EqLogFolder"); } }
public static MemoryStream ParseAttendance(string toon, string server) { MemoryStream ms = new MemoryStream(); StreamWriter sw = new StreamWriter(ms, Encoding.ASCII); string lastdumpfile = GetLastFile(FuEQ.GetEQFolderForToon(toon, server), String.Format("RaidRoster_{0}-*.txt", server)); if (String.IsNullOrEmpty(lastdumpfile)) { System.Windows.Forms.MessageBox.Show(String.Format("There were no files matching {0} in the {1} folder", "RaidRoster-*.txt", FuEQ.GetEQFolderForToon(toon, server))); return(ms); } try { string dump = File.ReadAllText(lastdumpfile); if (dump.Length > 0) { sw.Write(dump); } else { System.Windows.Forms.MessageBox.Show(String.Format("The file {0} was empty", lastdumpfile)); } } catch (Exception e) { System.Windows.Forms.MessageBox.Show(String.Format("An exception occurred - {0}", e.Message)); return(ms); // failure reading file } sw.Flush(); ms.Position = 0; return(ms); }