/// <summary> /// Initializes a new instance of the <see cref="CustomPluginEditor"/> class. /// </summary> /// <param name="map">The map.</param> /// <remarks></remarks> public RestoreSelection(Map map, HaloMap.Meta.Meta meta, ref string filename) { InitializeComponent(); this.map = map; this.meta = meta; OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = Globals.Prefs.pathExtractsFolder; ofd.FileName = filename; if (ofd.ShowDialog() == DialogResult.OK) { FileStream fs = new FileStream(ofd.FileName, FileMode.Open); BinaryReader br = new BinaryReader(fs); fStream = new MemoryStream((int)fs.Length); fStream.Write(br.ReadBytes((int)fs.Length), 0, (int)fs.Length); br.Close(); fs.Close(); tvSourceTags.loadMeta(meta, map.HaloVersion, fStream); /* * tvSourceTags.Nodes.Clear(); * IFPIO ifpx = IFPHashMap.GetIfp(meta.type, map); * * // path stores parent offsets * string path = string.Empty; * * // Creates a tree listing recursively * TreeNode[] tns = CreateTree(ifpx.items, path); * * // Create a TreeViewCollection to be passed to our function * baseTree = new TreeNode(); * baseTree.Nodes.AddRange(tns); * * // Checks the tree listing and removes any reflexives that have a 0 count in the file * // Source Nodes * FileStream fs = new FileStream(ofd.FileName, FileMode.Open); * BinaryReader br = new BinaryReader(fs); * fStream = new MemoryStream((int)fs.Length); * fStream.Write(br.ReadBytes((int)fs.Length), 0, (int)fs.Length); * br.Close(); * fs.Close(); * br = new BinaryReader(fStream); * // Displays our created source tree * tvSourceTags.Nodes.AddRange(verifyReflexives(br, baseTree.Nodes, 0)); * * /* * tns = new TreeNode[tncs.Count]; * tncs.CopyTo(tns, 0); * tvSourceTags.Nodes.AddRange(tns); */ // Destination Nodes /* * BinaryReader br = new BinaryReader(meta.MS); * tvDestTags.Nodes.AddRange(verifyReflexives(br, baseTree.Nodes, 0)); */ } else { filename = null; } }
/// <summary> /// Initializes a new instance of the <see cref="CustomPluginEditor"/> class. /// </summary> /// <param name="map">The map.</param> /// <remarks></remarks> public RestoreSelection(Map map, HaloMap.Meta.Meta meta, ref string filename) { InitializeComponent(); this.map = map; this.meta = meta; OpenFileDialog ofd = new OpenFileDialog(); ofd.InitialDirectory = Globals.Prefs.pathExtractsFolder; ofd.FileName = filename; if (ofd.ShowDialog() == DialogResult.OK) { FileStream fs = new FileStream(ofd.FileName, FileMode.Open); BinaryReader br = new BinaryReader(fs); fStream = new MemoryStream((int)fs.Length); fStream.Write(br.ReadBytes((int)fs.Length), 0, (int)fs.Length); br.Close(); fs.Close(); tvSourceTags.loadMeta(meta, map.HaloVersion, fStream); /* tvSourceTags.Nodes.Clear(); IFPIO ifpx = IFPHashMap.GetIfp(meta.type, map); // path stores parent offsets string path = string.Empty; // Creates a tree listing recursively TreeNode[] tns = CreateTree(ifpx.items, path); // Create a TreeViewCollection to be passed to our function baseTree = new TreeNode(); baseTree.Nodes.AddRange(tns); // Checks the tree listing and removes any reflexives that have a 0 count in the file // Source Nodes FileStream fs = new FileStream(ofd.FileName, FileMode.Open); BinaryReader br = new BinaryReader(fs); fStream = new MemoryStream((int)fs.Length); fStream.Write(br.ReadBytes((int)fs.Length), 0, (int)fs.Length); br.Close(); fs.Close(); br = new BinaryReader(fStream); // Displays our created source tree tvSourceTags.Nodes.AddRange(verifyReflexives(br, baseTree.Nodes, 0)); /* tns = new TreeNode[tncs.Count]; tncs.CopyTo(tns, 0); tvSourceTags.Nodes.AddRange(tns); */ // Destination Nodes /* BinaryReader br = new BinaryReader(meta.MS); tvDestTags.Nodes.AddRange(verifyReflexives(br, baseTree.Nodes, 0)); */ } else filename = null; }