/// <summary> /// Sets the information in the control from a template information string. /// </summary> /// <param name="str">The template information string.</param> public void SetTemplateInformation(string str) { string[] info = str.Split('|'); __TemplateName.Text = info[0]; __TemplateCode.Text = info[1]; if (TemplateInfo == null) { TemplateInfo = new SkillDatabase.TemplateInformation(info[1]); } else { TemplateInfo.ParseTemplateCode(info[1]); } if (TemplateInfo.ValidTemplate) { // Start off by placing the profession information: __TemplateInfo.Text = TemplateInfo.PrimaryProfession.ToString(); if (TemplateInfo.SecondaryProfession != Skill.Professions.None) { __TemplateInfo.Text += "/" + TemplateInfo.SecondaryProfession.ToString(); } __TemplateInfo.Text += Environment.NewLine; // Now, let's grab the attributes information: foreach (SkillDatabase.TemplateInformation.AttributeRank attr in TemplateInfo.Attributes) { __TemplateInfo.Text += attr.Attribute.ToString().Replace('_', ' ') + ": " + attr.Rank.ToString() + Environment.NewLine; } for (int i = 0; i < 8; ++i) { if (TemplateInfo.SkillBar[i] != null) { Skillbar[i].Image = TemplateInfo.SkillBar[i].Icon; } else { Skillbar[i].Image = null; } } } else { foreach (PictureBox box in Skillbar) { box.Image = null; } __TemplateInfo.Text = "Invalid template code."; } }
private void __TemplateCode_TextChanged(object sender, EventArgs e) { if (TemplateInformation == null) { TemplateInformation = new SkillDatabase.TemplateInformation(__TemplateCode.Text); } else { TemplateInformation.ParseTemplateCode(__TemplateCode.Text); } if (TemplateInformation.ValidTemplate) { // Start off by placing the profession information: __GeneralInformation.Text = TemplateInformation.PrimaryProfession.ToString(); if (TemplateInformation.SecondaryProfession != Skill.Professions.None) { __GeneralInformation.Text += "/" + TemplateInformation.SecondaryProfession.ToString(); } __GeneralInformation.Text += Environment.NewLine; // Now, let's grab the attributes information: foreach (SkillDatabase.TemplateInformation.AttributeRank attr in TemplateInformation.Attributes) { __GeneralInformation.Text += attr.Attribute.ToString().Replace('_', ' ') + ": " + attr.Rank.ToString() + Environment.NewLine; } for (int i = 0; i < 8; ++i) { if (TemplateInformation.SkillBar[i] != null) { SkillBar[i].Image = TemplateInformation.SkillBar[i].Icon; } else { SkillBar[i].Image = null; } } } else { foreach (PictureBox box in SkillBar) { box.Image = null; } __GeneralInformation.Text = "Invalid template code."; } }