public XmlNode RemovePackagedFile(string name) { PackagedFile pf = PackagedFiles.Find(x => x.Name.InnerText.Equals(name)); if (pf == null) { return(null); } PackagedFiles.Remove(pf); return(Document.DocumentElement.RemoveChild(pf.Name.ParentNode)); }
public PackagedFile CreatePackagedFile(string name) { PackagedFile pf = PackagedFiles.Find(x => x.Name.InnerText.Equals(name)); if (pf != null) { return(pf); } XmlElement _pf = Document.CreateElement("PackagedFile"); Document.DocumentElement.AppendChild(_pf); pf = new PackagedFile(_pf); pf.SetInnerText("Name", name); pf.SetInnerText("EPFlags", "0x00000000"); _pf.AppendChild(Document.CreateElement("metatags")); PackagedFiles.Add(pf); return(pf); }
public PackagedFile CreatePackagedFile(string name) { PackagedFile pf = PackagedFiles.Find(x => x.Name.InnerText.Equals(name)); if (pf != null) return pf; XmlElement _pf = Document.CreateElement("PackagedFile"); Document.DocumentElement.AppendChild(_pf); pf = new PackagedFile(_pf); pf.SetInnerText("Name", name); pf.SetInnerText("EPFlags", "0x00000000"); _pf.AppendChild(Document.CreateElement("metatags")); PackagedFiles.Add(pf); return pf; }
private void btnOK_Click(object sender, EventArgs e) { string source = tbSource.Text; bool deleteSource = false; try { XmlValues xv = new XmlValues(); xv.SetAttributeValue("Type", tbType.Text); xv.SetAttributeValue("SubType", tbSubType.Text); xv.SetInnerText("ArchiveVersion", tbArchiveVersion.Text); xv.SetInnerText("CodeVersion", tbCodeVersion.Text); xv.SetInnerText("GameVersion", tbGameVersion.Text); xv.SetInnerText("DisplayName", tbDisplayName.Text); xv.SetInnerText("Description", tbDescription.Text); xv.SetInnerText("PackageId", tbPackageId.Text); //Date gets set by packer xv.SetInnerText("AssetVersion", tbAssetVersion.Text); xv.SetInnerText("MinReqVersion", tbMinReqVersion.Text); if (ckbCreateManifest.Checked) { source = CopyToTemp(source, tbPackageId.Text); deleteSource = true; try { Manifest.UpdatePackage(source, tbPackageId.Text, tbType.Text, tbSubType.Text, tbDisplayName.Text, tbDescription.Text, ckbCreateMissingIcon.Checked); } catch (ApplicationException aex) { CopyableMessageBox.Show(aex.Message, "s3su", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Warning); return; } } //Ensure a minimal entry for the package exists but don't override existing values PackagedFile pf = xv.PackagedFiles.Find(p => p.Guid.InnerText.ToLower().Equals(tbPackageId.Text.ToLower())); if (pf == null) { pf = xv.CreatePackagedFile(tbPackageId.Text + ".package"); pf.GetInnerText(pf.Guid, "Guid", tbPackageId.Text); pf.GetInnerText(pf.ContentType, "ContentType", tbType.Text); pf.GetInnerText(pf.EPFlags, "EPFlags", "0x00000000"); } S3Pack.Sims3Pack.Pack(source, tbTarget.Text, xv); CopyableMessageBox.Show("Done!", "Sims3Pack created", CopyableMessageBoxButtons.OK, CopyableMessageBoxIcon.Information); } finally { if (deleteSource) { File.Delete(source); } ResetSource(); ResetTarget(); ResetPackageId(); tbDisplayName.Text = tbDescription.Text = ""; tbSubType.Text = "0x00000000"; ckbCreateManifest.Enabled = false; ckbCreateManifest.Checked = ckbCreateManifest.Enabled; OKforOK(); } }
bool PackagedFileExists(string folder, PackagedFile pf) { return(pf.Name != null && pf.Name.InnerText.Length != 0 && File.Exists(Path.Combine(folder, Path.GetFileName(pf.Name.InnerText)))); }
bool PackagedFileExists(string folder, PackagedFile pf) { return pf.Name != null && pf.Name.InnerText.Length != 0 && File.Exists(Path.Combine(folder, Path.GetFileName(pf.Name.InnerText))); }