private void SetData(TreeNode Node, byte[] New) { ShowStatus("Inserting new data, please wait..."); byte[] File = Prot.Files[GetDepthIndex(Node, 0)]; if (Node.Level > 0) { LPack Pack = LPack.FromData(File); if (Node.Level > 1) { byte[] Data = Pack.Files[GetDepthIndex(Node, 1)].Data; LScript Script = LScript.FromData(Data); Script.Scripts[Node.Index] = New; New = LScript.ToData(Script); Node = Node.Parent; } Pack.Files[Node.Index].Data = New; New = LPack.ToData(Pack); Node = Node.Parent; } Prot.Files[Node.Index] = New; ShowStatus("Ready"); }
private void Open(string FileName) { Prot = LProt.FromFile(FileName); TreeNode[] ProtNodes = new TreeNode[Prot.Files.Length]; for (int i = 0; i < Prot.Files.Length; i++) { LPack Pack = LPack.FromData(Prot.Files[i]); ProtNodes[i] = MakeNode( "File", i, Pack != null ? 1 : 0, Prot.Files[i].Length); //Add Pack nodes if file is Pack if (Pack != null) { TreeNode[] PackNodes = new TreeNode[Pack.Files.Length]; for (int j = 0; j < Pack.Files.Length; j++) { LScript Script = LScript.FromData(Pack.Files[j].Data); PackNodes[j] = MakeNode( "Data", j, Script != null ? 1 : 0, Pack.Files[j].Data.Length); //Add Script nodes if file is Script if (Script != null) { for (int k = 0; k < Script.Scripts.Length; k++) { PackNodes[j].Nodes.Add(MakeNode("Script", k, 2, Script.Scripts[k].Length)); } } } ProtNodes[i].Nodes.AddRange(PackNodes); } } TreeFiles.Nodes.Clear(); TreeFiles.Nodes.AddRange(ProtNodes); CurrNode = null; HasNewText = false; TextEdit.Text = string.Empty; }
private byte[] GetData(TreeNode Node) { byte[] File = Prot.Files[GetDepthIndex(Node, 0)]; if (Node.Level > 0) { LPack Pack = LPack.FromData(File); if (Node.Level > 1) { byte[] Data = Pack.Files[GetDepthIndex(Node, 1)].Data; LScript Script = LScript.FromData(Data); return(Script.Scripts[Node.Index]); } return(Pack.Files[Node.Index].Data); } return(File); }
private void SearchCallback(object sender, SearchEventArgs e) { string Results = string.Empty; int Matches = 0; ShowStatus("Searching, please wait..."); for (int i = 0; i < Prot.Files.Length; i++) { LPack Pack = LPack.FromData(Prot.Files[i]); //Add Pack nodes if file is Pack if (Pack != null) { for (int j = 0; j < Pack.Files.Length; j++) { LScript Script = LScript.FromData(Pack.Files[j].Data); //Add Script nodes if file is Script if (Script != null) { for (int k = 0; k < Script.Scripts.Length; k++) { string Text = Utils.Data2Text(Script.Scripts[k]); if (Text.Contains(e.Text)) { Results += Environment.NewLine + string.Format("...at {0:D5}/{1:D5}/{2:D5}", i, j, k); if (++Matches == 10) { Results += Environment.NewLine + "...output truncated"; i = Prot.Files.Length; j = Pack.Files.Length; break; } } } } } } } ShowStatus("Ready"); if (Results != string.Empty) { MessageBox.Show( "Text found..." + Environment.NewLine + Results, "Search", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show( "Sorry, the text you're looking for was not found...", "Search", MessageBoxButtons.OK, MessageBoxIcon.Information); } }