private void LoadSocialButton(int which) { selBtn = which; selPage = curPage; SocialButton s = pages[selPage - 1][selBtn - 1]; txtSelectedButton.Text = String.Format("[Pg{0} Bt{1}] - {2}", selPage, selBtn, (s.Title.Length > 0 ? s.Title : "<No Button>")); txtCommands.Text = String.Join(Environment.NewLine, s.Lines); EnableEdit(); }
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(); } }
public static void SaveSocial(string eqFolder, string toonName, string serverShortName, SocialButton soc) { string fileName = Path.Combine(eqFolder, String.Format("{0}_{1}.ini", toonName, serverShortName)); if (!File.Exists(fileName)) { throw new FileNotFoundException(); } Ini ini = new Ini(fileName); string id = String.Format("Page{0}Button{1}", soc.Page, soc.Button); ini.WriteValue(id + "Name", "Socials", soc.Title); ini.WriteValue(id + "Color", "Socials", soc.Color); ini.WriteValue(id + "Line1", "Socials", soc.Lines[0]); ini.WriteValue(id + "Line2", "Socials", soc.Lines[1]); ini.WriteValue(id + "Line3", "Socials", soc.Lines[2]); ini.WriteValue(id + "Line4", "Socials", soc.Lines[3]); ini.WriteValue(id + "Line5", "Socials", soc.Lines[4]); ini.Save(); }