Esempio n. 1
0
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
			var vm = value as ModuleVM;
			var tag = parameter as string;
			if (vm == null || tag == null)
				return null;

			var writer = Cache.GetWriter();
			try {
				var printer = new ModulePrinter(writer, vm.Context.UseHexadecimal, vm.Context.TheDebugger.Debugger);
				if (tag == PredefinedTextClassifierTags.ModulesWindowName)
					printer.WriteName(vm);
				else if (tag == PredefinedTextClassifierTags.ModulesWindowPath)
					printer.WritePath(vm);
				else if (tag == PredefinedTextClassifierTags.ModulesWindowOptimized)
					printer.WriteOptimized(vm);
				else if (tag == PredefinedTextClassifierTags.ModulesWindowDynamic)
					printer.WriteDynamic(vm);
				else if (tag == PredefinedTextClassifierTags.ModulesWindowInMemory)
					printer.WriteInMemory(vm);
				else if (tag == PredefinedTextClassifierTags.ModulesWindowOrder)
					printer.WriteOrder(vm);
				else if (tag == PredefinedTextClassifierTags.ModulesWindowVersion)
					printer.WriteVersion(vm);
				else if (tag == PredefinedTextClassifierTags.ModulesWindowTimestamp)
					printer.WriteTimestamp(vm);
				else if (tag == PredefinedTextClassifierTags.ModulesWindowAddress)
					printer.WriteAddress(vm);
				else if (tag == PredefinedTextClassifierTags.ModulesWindowProcess)
					printer.WriteProcess(vm);
				else if (tag == PredefinedTextClassifierTags.ModulesWindowAppDomain)
					printer.WriteAppDomain(vm);
				else
					return null;

				var context = new TextClassifierContext(writer.Text, tag, vm.Context.SyntaxHighlight, writer.Colors);
				return vm.Context.TextElementProvider.CreateTextElement(vm.Context.ClassificationFormatMap, context, ContentTypes.ModulesWindow, TextElementFlags.FilterOutNewLines | TextElementFlags.CharacterEllipsis);
			}
			finally {
				Cache.FreeWriter(writer);
			}
		}
Esempio n. 2
0
        public override void Execute(ModulesCtxMenuContext context)
        {
            var output = new StringBuilderTextColorOutput();

            foreach (var vm in context.SelectedItems)
            {
                var printer = new ModulePrinter(output, debuggerSettings.UseHexadecimal, theDebugger.Value.Debugger);
                printer.WriteName(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteOptimized(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteDynamic(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteInMemory(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteOrder(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteVersion(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteTimestamp(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteAddress(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteProcess(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WriteAppDomain(vm);
                output.Write(BoxedTextColor.Text, "\t");
                printer.WritePath(vm);
                output.WriteLine();
            }
            var s = output.ToString();

            if (s.Length > 0)
            {
                try {
                    Clipboard.SetText(s);
                }
                catch (ExternalException) { }
            }
        }
Esempio n. 3
0
		public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
			var vm = value as ModuleVM;
			var s = parameter as string;
			if (vm == null || s == null)
				return null;

			if (StringComparer.OrdinalIgnoreCase.Equals(s, "Image"))
				return ImageCache.Instance.GetImage(vm.IsExe ? "AssemblyExe" : "AssemblyModule", BackgroundType.GridViewItem);

			var gen = UISyntaxHighlighter.Create(DebuggerSettings.Instance.SyntaxHighlightModules);
			var printer = new ModulePrinter(gen.TextOutput, DebuggerSettings.Instance.UseHexadecimal);
			if (StringComparer.OrdinalIgnoreCase.Equals(s, "Name"))
				printer.WriteName(vm);
			else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Path"))
				printer.WritePath(vm);
			else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Optimized"))
				printer.WriteOptimized(vm);
			else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Dynamic"))
				printer.WriteDynamic(vm);
			else if (StringComparer.OrdinalIgnoreCase.Equals(s, "InMemory"))
				printer.WriteInMemory(vm);
			else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Order"))
				printer.WriteOrder(vm);
			else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Version"))
				printer.WriteVersion(vm);
			else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Timestamp"))
				printer.WriteTimestamp(vm);
			else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Address"))
				printer.WriteAddress(vm);
			else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Process"))
				printer.WriteProcess(vm);
			else if (StringComparer.OrdinalIgnoreCase.Equals(s, "AppDomain"))
				printer.WriteAppDomain(vm);
			else
				return null;

			return gen.CreateTextBlock(true);
		}
Esempio n. 4
0
        protected override void Execute(ModulesCtxMenuContext context)
        {
            var output = new PlainTextOutput();

            foreach (var vm in context.SelectedItems)
            {
                var printer = new ModulePrinter(output, DebuggerSettings.Instance.UseHexadecimal);
                printer.WriteName(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteOptimized(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteDynamic(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteInMemory(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteOrder(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteVersion(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteTimestamp(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteAddress(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteProcess(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WriteAppDomain(vm);
                output.Write('\t', TextTokenType.Text);
                printer.WritePath(vm);
                output.WriteLine();
            }
            var s = output.ToString();

            if (s.Length > 0)
            {
                Clipboard.SetText(s);
            }
        }
Esempio n. 5
0
        public override void Execute(ModulesCtxMenuContext context)
        {
            var output = new NoSyntaxHighlightOutput();

            foreach (var vm in context.SelectedItems)
            {
                var printer = new ModulePrinter(output, debuggerSettings.UseHexadecimal, theDebugger.Value.Debugger);
                printer.WriteName(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteOptimized(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteDynamic(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteInMemory(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteOrder(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteVersion(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteTimestamp(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteAddress(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteProcess(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WriteAppDomain(vm);
                output.Write("\t", TextTokenKind.Text);
                printer.WritePath(vm);
                output.WriteLine();
            }
            var s = output.ToString();

            if (s.Length > 0)
            {
                Clipboard.SetText(s);
            }
        }
Esempio n. 6
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var vm = value as ModuleVM;
            var s  = parameter as string;

            if (vm == null || s == null)
            {
                return(null);
            }

            if (StringComparer.OrdinalIgnoreCase.Equals(s, "Image"))
            {
                return(vm.Context.ImageManager.GetImage(new ImageReference(GetType().Assembly, vm.IsExe ? "AssemblyExe" : "Module"), BackgroundType.GridViewItem));
            }

            var gen     = ColorizedTextElementProvider.Create(vm.Context.SyntaxHighlight);
            var printer = new ModulePrinter(gen.Output, vm.Context.UseHexadecimal, vm.Context.TheDebugger.Debugger);

            if (StringComparer.OrdinalIgnoreCase.Equals(s, "Name"))
            {
                printer.WriteName(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Path"))
            {
                printer.WritePath(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Optimized"))
            {
                printer.WriteOptimized(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Dynamic"))
            {
                printer.WriteDynamic(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "InMemory"))
            {
                printer.WriteInMemory(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Order"))
            {
                printer.WriteOrder(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Version"))
            {
                printer.WriteVersion(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Timestamp"))
            {
                printer.WriteTimestamp(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Address"))
            {
                printer.WriteAddress(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Process"))
            {
                printer.WriteProcess(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "AppDomain"))
            {
                printer.WriteAppDomain(vm);
            }
            else
            {
                return(null);
            }

            return(gen.CreateResult(true));
        }
Esempio n. 7
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var vm = value as ModuleVM;
            var s  = parameter as string;

            if (vm == null || s == null)
            {
                return(null);
            }

            if (StringComparer.OrdinalIgnoreCase.Equals(s, "Image"))
            {
                return(ImageCache.Instance.GetImage(vm.IsExe ? "AssemblyExe" : "AssemblyModule", BackgroundType.GridViewItem));
            }

            var gen     = UISyntaxHighlighter.Create(DebuggerSettings.Instance.SyntaxHighlightModules);
            var printer = new ModulePrinter(gen.TextOutput, DebuggerSettings.Instance.UseHexadecimal);

            if (StringComparer.OrdinalIgnoreCase.Equals(s, "Name"))
            {
                printer.WriteName(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Path"))
            {
                printer.WritePath(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Optimized"))
            {
                printer.WriteOptimized(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Dynamic"))
            {
                printer.WriteDynamic(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "InMemory"))
            {
                printer.WriteInMemory(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Order"))
            {
                printer.WriteOrder(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Version"))
            {
                printer.WriteVersion(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Timestamp"))
            {
                printer.WriteTimestamp(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Address"))
            {
                printer.WriteAddress(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "Process"))
            {
                printer.WriteProcess(vm);
            }
            else if (StringComparer.OrdinalIgnoreCase.Equals(s, "AppDomain"))
            {
                printer.WriteAppDomain(vm);
            }
            else
            {
                return(null);
            }

            return(gen.CreateTextBlock(true));
        }
Esempio n. 8
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var vm  = value as ModuleVM;
            var tag = parameter as string;

            if (vm == null || tag == null)
            {
                return(null);
            }

            var writer = Cache.GetWriter();

            try {
                var printer = new ModulePrinter(writer, vm.Context.UseHexadecimal, vm.Context.TheDebugger.Debugger);
                if (tag == PredefinedTextClassifierTags.ModulesWindowName)
                {
                    printer.WriteName(vm);
                }
                else if (tag == PredefinedTextClassifierTags.ModulesWindowPath)
                {
                    printer.WritePath(vm);
                }
                else if (tag == PredefinedTextClassifierTags.ModulesWindowOptimized)
                {
                    printer.WriteOptimized(vm);
                }
                else if (tag == PredefinedTextClassifierTags.ModulesWindowDynamic)
                {
                    printer.WriteDynamic(vm);
                }
                else if (tag == PredefinedTextClassifierTags.ModulesWindowInMemory)
                {
                    printer.WriteInMemory(vm);
                }
                else if (tag == PredefinedTextClassifierTags.ModulesWindowOrder)
                {
                    printer.WriteOrder(vm);
                }
                else if (tag == PredefinedTextClassifierTags.ModulesWindowVersion)
                {
                    printer.WriteVersion(vm);
                }
                else if (tag == PredefinedTextClassifierTags.ModulesWindowTimestamp)
                {
                    printer.WriteTimestamp(vm);
                }
                else if (tag == PredefinedTextClassifierTags.ModulesWindowAddress)
                {
                    printer.WriteAddress(vm);
                }
                else if (tag == PredefinedTextClassifierTags.ModulesWindowProcess)
                {
                    printer.WriteProcess(vm);
                }
                else if (tag == PredefinedTextClassifierTags.ModulesWindowAppDomain)
                {
                    printer.WriteAppDomain(vm);
                }
                else
                {
                    return(null);
                }

                var context = new TextClassifierContext(writer.Text, tag, vm.Context.SyntaxHighlight, writer.Colors);
                return(vm.Context.TextElementProvider.CreateTextElement(vm.Context.ClassificationFormatMap, context, ContentTypes.ModulesWindow, TextElementFlags.FilterOutNewLines | TextElementFlags.CharacterEllipsis));
            }
            finally {
                Cache.FreeWriter(writer);
            }
        }