Exemple #1
0
        public override async void Invoke(CancellationToken cancellationToken)
        {
            if (LastDocument != null)
            {
                var window = await IdeUtils.ShowWindowAsync <DisasmWindow>(cancellationToken);

                window?.ViewModel?.RunOperationAsync(await GetSymbol(LastDocument, LastTokenPos, cancellationToken));
            }
        }
        public override async void Invoke(CancellationToken cancellationToken)
        {
            DisasmWindow window = await IdeUtils.ShowWindowAsync <DisasmWindow>(cancellationToken);

            SyntaxNode syntaxNode = await _symbol.DeclaringSyntaxReferences.FirstOrDefault().GetSyntaxAsync();

            ITrackingSpan trackingSpan = SnapshotSpan.Snapshot.CreateTrackingSpan(new Span(syntaxNode.FullSpan.Start, syntaxNode.FullSpan.Length), SpanTrackingMode.EdgeInclusive);

            trackingSpan.TextBuffer.Insert(syntaxNode.SpanStart, "[BenchmarkDotNet.Attributes.Benchmark]" + Environment.NewLine + "\t\t");

            window?.ViewModel?.RunOperationAsync(_symbol, _codeDoc, OperationType.Benchmark);
        }
Exemple #3
0
        private static void ConfigureDisasmoHiddenLauncher(string workingDir,
                                                           Dictionary <string, string> csprojVariables,
                                                           Dictionary <string, string> csVariables)
        {
            if (!Directory.Exists(workingDir))
            {
                Directory.CreateDirectory(workingDir);
            }

            try
            {
                var    csFileContent     = IdeUtils.ReadStringFromEmbeddedResource("Disasmo.Resources.LauncherTemplate.Main.cs");
                var    csprojFileContent = IdeUtils.ReadStringFromEmbeddedResource("Disasmo.Resources.LauncherTemplate.DisasmoHiddenLauncher.csproj");
                string csFileName        = Path.Combine(workingDir, "DisasmoHiddenLauncher.cs");
                string csprojFileName    = Path.Combine(workingDir, "DisasmoHiddenLauncher.csproj");

                File.Delete(csprojFileName);
                File.Delete(csFileName);

                foreach (var item in csprojVariables)
                {
                    csprojFileContent = csprojFileContent.Replace(item.Key, item.Value);
                }

                foreach (var item in csVariables)
                {
                    csFileContent = csFileContent.Replace(item.Key, item.Value);
                }

                File.WriteAllText(csFileName, csFileContent);
                File.WriteAllText(csprojFileName, csprojFileContent);
            }
            catch (Exception e)
            {
                throw new Exception("Failed to setup DisasmoHiddenLauncher.", e);
            }
        }
Exemple #4
0
        public override async void Invoke(CancellationToken cancellationToken)
        {
            var window = await IdeUtils.ShowWindowAsync <DisasmWindow>(cancellationToken);

            window?.ViewModel?.RunOperationAsync(_symbol, _codeDoc, OperationType.ObjectLayout);
        }