static void Execute2(ContextMenuEntryContext context) { DecompileTabState tabState; var module = GetModule(context, out tabState); if (module == null) { return; } uint?token = GoToTokenContextMenuEntry.AskForToken("Go to MD Table Row"); if (token == null) { return; } var tokRef = new TokenReference(module, token.Value); if (MainWindow.Instance.DnSpyFileListTreeNode.FindTokenNode(tokRef) == null) { MainWindow.Instance.ShowMessageBox(string.Format("Token {0:X8} doesn't exist in the metadata", token.Value)); return; } if (tabState != null) { MainWindow.Instance.JumpToReference(tabState.TextView, tokRef); } else { MainWindow.Instance.JumpToReference(tokRef); } }
public override void _Process(float delta) { if (Input.IsActionJustReleased("ui_esc")) { ClientVariables.SelectedTokens.Clear(); } if (Input.IsActionJustPressed("delete")) { foreach (Node token in ClientVariables.SelectedTokens) { Rpc(nameof(RemoveToken), token.Name); } } if (Input.IsActionJustPressed("ping")) { Rpc(nameof(PingMap), GetGlobalMousePosition()); } if (Input.IsActionJustPressed("ui_duplicate")) { foreach (Node token in ClientVariables.SelectedTokens) { Token tokenNode = (Token)token; TokenReference tokenReference = ClientVariables.FindTokenReferenceByName(token.Name); if (tokenReference != null) { RpcId(1, nameof(RequestCreateToken), tokenReference.UniqueName.Split("_")[0], tokenReference.ImageFile, tokenNode.GlobalPosition, tokenNode.Scale); } } } }
DocumentTabReferenceResult Create(TokenReference tokRef, IDocumentTabService documentTabService) { var node = HexDocumentTreeNodeDataFinder.FindNode(documentTabService.DocumentTreeView, tokRef); if (node == null) return null; var content = documentTabService.TryCreateContent(new DocumentTreeNodeData[] { node }); if (content == null) return null; return new DocumentTabReferenceResult(content); }
FileTabReferenceResult Create(TokenReference tokRef, IFileTabManager fileTabManager) { var node = HexFileTreeNodeDataFinder.FindNode(fileTabManager.FileTreeView, tokRef); if (node == null) return null; var content = fileTabManager.TryCreateContent(new IFileTreeNodeData[] { node }); if (content == null) return null; return new FileTabReferenceResult(content); }
internal static MetaDataTableRecordNode FindNode(IDocumentTreeView documentTreeView, TokenReference tokRef) { if (tokRef == null) return null; var modNode = documentTreeView.FindNode(tokRef.ModuleDef); if (modNode == null) return null; modNode.TreeNode.EnsureChildrenLoaded(); var peNode = (PENode)modNode.TreeNode.DataChildren.FirstOrDefault(a => a is PENode); return peNode?.FindTokenNode(tokRef.Token); }
internal MetaDataTableRecordTreeNode FindTokenNode(TokenReference @ref) { var asm = assemblyList.FindAssemblyByFileName(@ref.Filename); if (asm == null) { return(null); } var modNode = FindModuleNode(asm.ModuleDefinition); return(modNode == null ? null : modNode.FindTokenNode(@ref.Token)); }
public void RemoveToken(String tokenName) { if (!tokenName.Empty()) { Node token = Tokens.GetNode(tokenName); token.QueueFree(); TokenReference tokenReference = ClientVariables.FindTokenReferenceByName(tokenName); if (tokenReference != null) { ClientVariables.InsertedTokens.Remove(tokenReference); } } }
FileTabReferenceResult Create(TokenReference tokRef, IFileTabManager fileTabManager) { var node = HexFileTreeNodeDataFinder.FindNode(fileTabManager.FileTreeView, tokRef); if (node == null) { return(null); } var content = fileTabManager.TryCreateContent(new IFileTreeNodeData[] { node }); if (content == null) { return(null); } return(new FileTabReferenceResult(content)); }
DocumentTabReferenceResult?Create(TokenReference tokRef, IDocumentTabService documentTabService) { var node = HexDocumentTreeNodeDataFinder.FindNode(documentTabService.DocumentTreeView, tokRef); if (node is null) { return(null); } var content = documentTabService.TryCreateContent(new DocumentTreeNodeData[] { node }); if (content is null) { return(null); } return(new DocumentTabReferenceResult(content)); }
internal static MetaDataTableRecordNode FindNode(IFileTreeView fileTreeView, TokenReference tokRef) { if (tokRef == null) { return(null); } var modNode = fileTreeView.FindNode(tokRef.ModuleDef); if (modNode == null) { return(null); } modNode.TreeNode.EnsureChildrenLoaded(); var peNode = (PENode)modNode.TreeNode.DataChildren.FirstOrDefault(a => a is PENode); return(peNode == null ? null : peNode.FindTokenNode(tokRef.Token)); }
public void SaveSession() { if (Map.CurrentMap.Equals("empty")) { return; } SessionData session = new SessionData(); session.MapScale = Map.Scale; foreach (TokenReference token in ClientVariables.InsertedTokens) { Token tokenNode = (Token)Tokens.GetNode(token.UniqueName); TokenReference tokenRef = new TokenReference(token.UniqueName.Split("_")[0], token.ImageFile, tokenNode.GlobalPosition, tokenNode.Scale); session.Tokens.Add(tokenRef); } String sessionData = JsonConvert.SerializeObject(session, Formatting.Indented); System.IO.File.WriteAllText(ClientVariables.DataFolder + Map.CurrentMap.Split(".")[0] + ".json", sessionData); }
static void Execute2(ContextMenuEntryContext context) { DecompileTabState tabState; var module = GetModule(context, out tabState); if (module == null) return; uint? token = GoToTokenContextMenuEntry.AskForToken("Go to MD Table Row"); if (token == null) return; var tokRef = new TokenReference(module.Location, token.Value); if (MainWindow.Instance.AssemblyListTreeNode.FindTokenNode(tokRef) == null) { MainWindow.Instance.ShowMessageBox(string.Format("Token {0:X8} doesn't exist in the metadata", token.Value)); return; } if (tabState != null) MainWindow.Instance.JumpToReference(tabState.TextView, tokRef); else MainWindow.Instance.JumpToReference(tokRef); }
void Apply(TokenSpooled @event) { var token = new TokenReference(@event.TokenId, @event.TokenVersion, @event.TokenCode, @event.TokenHash); Data.SpooledTokens.AddOrUpdate(token); }
internal MetaDataTableRecordTreeNode FindTokenNode(TokenReference @ref) { var modNode = FindModuleNode(@ref.ModuleDef); return modNode == null ? null : modNode.FindTokenNode(@ref.Token); }
internal MetaDataTableRecordTreeNode FindTokenNode(TokenReference @ref) { var modNode = FindModuleNode(@ref.ModuleDef); return(modNode == null ? null : modNode.FindTokenNode(@ref.Token)); }