private void skin_delete(object sender, EventArgs e) { String character = comboBox1.SelectedItem.ToString(); DataGridViewCell cell = this.dataGridView1.CurrentCell; DataGridViewRow row = dataGridView1.Rows[cell.RowIndex]; NewSkin skin = new NewSkin(int.Parse(row.Cells[0].Value.ToString()), character, 0, library, properties, filebank); ArrayList library_skins = library.get_skins(character); Boolean id_check = false; foreach (String s in library_skins) { if (s.Split(';')[2] == row.Cells[0].Value.ToString()) { id_check = true; } } if (!id_check) { if (Directory.Exists(skin.filebank_folder)) { Directory.Delete(skin.filebank_folder, true); } filebank.delete_skin(comboBox1.SelectedItem.ToString(), int.Parse(row.Cells[0].Value.ToString())); load_skins(); main.write("Skin removed from Filebank", 2); } else { main.write("You cannot delete an associated skin in the Filebank", 1); } }
private void insertSkinInLibraryToolStripMenuItem_Click(object sender, EventArgs e) { String character = comboBox1.SelectedItem.ToString(); DataGridViewCell cell = this.dataGridView1.CurrentCell; DataGridViewRow row = dataGridView1.Rows[cell.RowIndex]; ArrayList library_skins = library.get_skins(character); Boolean id_check = false; foreach (String s in library_skins) { if (s.Split(';')[2] == row.Cells[0].Value.ToString()) { id_check = true; } } if (!id_check) { NewSkin skin = new NewSkin(int.Parse(row.Cells[0].Value.ToString()), comboBox1.SelectedItem.ToString(), library_skins.Count + 1, library, properties, filebank); library.add_skin(character, library_skins.Count + 1, row.Cells[1].Value.ToString()); library.set_id(skin); main.skin_ListBox_reload(); main.write(skin.libraryname + " was added from the Filebank", 2); } }
private void OpenNewFileSelector() { Hide(); NewFileSelector newFileSelector = new NewFileSelector(mruMenu.Files); if (newFileSelector.ShowDialog() == DialogResult.OK) { switch (newFileSelector.MpeStartupResult) { case MpeStartupResult.NewFile: Package = GetNewProject(); break; case MpeStartupResult.OpenFile: Show(); OpenFileDialog(); break; case MpeStartupResult.SkinWizard: Package = NewSkin.Get(Package); break; case MpeStartupResult.MruFile: LoadProject(newFileSelector.MpeStartupResultParam); break; } } Show(); BringToFront(); }
public void add_skin(NewSkin skin, String model_list, String csp_list) { //Checks if the skin tag is present for the character check_skin_tag(skin.fullname); #region Xml Loads XmlDocument xml = new XmlDocument(); xml.Load(filebank_xmlpath); XmlNode skins = xml.SelectSingleNode("/Filebank/Character[attribute::name='" + skin.fullname + "']/skins"); #endregion #region Element Creation //Element XmlElement xmlskin = xml.CreateElement("skin"); //ID XmlAttribute attr = xml.CreateAttribute("id"); attr.Value = skin.id.ToString(); xmlskin.Attributes.Append(attr); //Name XmlAttribute attr2 = xml.CreateAttribute("libraryname"); attr2.Value = skin.libraryname; xmlskin.Attributes.Append(attr2); //Files XmlElement models = xml.CreateElement("models"); models.InnerText = model_list; XmlElement csps = xml.CreateElement("csps"); csps.InnerText = csp_list; xmlskin.AppendChild(models); xmlskin.AppendChild(csps); #endregion skins.AppendChild(xmlskin); xml.Save(filebank_xmlpath); }
public void set_id(NewSkin current_newskin) { XmlDocument xml = new XmlDocument(); xml.Load(LibraryPath); XmlNode skin = xml.SelectSingleNode("/Roaster/Character[attribute::name='" + current_newskin.fullname + "']/skin[attribute::slot='" + current_newskin.cspslot + "']"); if (skin.Attributes.GetNamedItem("id") == null) { //ID XmlAttribute attr = xml.CreateAttribute("id"); attr.Value = current_newskin.id.ToString(); skin.Attributes.Append(attr); skin.InnerXml = ""; } else { skin.Attributes["id"].Value = current_newskin.id.ToString(); skin.InnerXml = ""; } xml.Save(LibraryPath); }