public static void UpdateWarData(byte[] data) { try { FileStream fileStream = File.Open(System.IO.Directory.GetCurrentDirectory() + "\\data.myp", FileMode.Open, FileAccess.ReadWrite); MYP myp = new MYP(MythicPackage.ART, (Stream)fileStream); myp.UpdateFile("data/mythloginserviceconfig.xml", data); myp.Save(); fileStream.Close(); } catch (Exception ex) { Client.Popup("Data.myp:" + Environment.NewLine + ex.ToString()); } }
private void treeView1_BeforeExpand(object sender, TreeViewCancelEventArgs e) { e.Node.Nodes.Clear(); MythicPackage parent = (MythicPackage)e.Node.Tag; var myp = new MYP(); using (var stream = new FileStream(Path.Combine(frmBuilder.WarFolder,parent.ToString() + ".MYP"), FileMode.Open, FileAccess.Read)) { myp.Load(stream); List<TreeNode> nodes = new List<TreeNode>(); foreach (var key in myp.Files.Keys) { string name = key.ToString(); if (MYPHash.DeHash.ContainsKey(key)) name = MYPHash.DeHash[key]; TreeNode node = new TreeNode(name); node.Tag = myp.Files[key]; nodes.Add(node); } e.Node.Nodes.AddRange(nodes.OrderBy(x => x.Text).ToArray()); } }