Hex view
Inheritance: Microsoft.VisualStudio.Utilities.IPropertyOwner
コード例 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="hexView">Hex view</param>
 public HexViewCreatedEventArgs(HexView hexView)
 {
     if (hexView == null)
     {
         throw new ArgumentNullException(nameof(hexView));
     }
     HexView = hexView;
 }
コード例 #2
0
		public override HexIntellisenseSessionStack GetStackForHexView(HexView hexView) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			var wpfHexView = hexView as WpfHexView;
			if (wpfHexView == null)
				throw new InvalidOperationException();
			return hexView.Properties.GetOrCreateSingletonProperty(typeof(HexIntellisenseSessionStackImpl), () => new HexIntellisenseSessionStackImpl(wpfHexView));
		}
コード例 #3
0
		public HexViewEditorFormatMap(HexView hexView, TC.EditorFormatMapService editorFormatMapService)
			: base(editorFormatMapService, DefaultWpfHexViewOptions.AppearanceCategoryName) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			this.hexView = hexView;
			hexView.Options.OptionChanged += Options_OptionChanged;
			Initialize();
		}
コード例 #4
0
		public override HexToolTipProvider GetToolTipProvider(HexView hexView) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			var wpfHexView = hexView as WpfHexView;
			if (wpfHexView == null)
				throw new ArgumentException();
			return wpfHexView.Properties.GetOrCreateSingletonProperty(typeof(HexToolTipProviderImpl), () => new HexToolTipProviderImpl(wpfHexView));
		}
コード例 #5
0
		public CommandTargetFilter(HexView hexView, HexCommandOperations hexCommandOperations) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			if (hexCommandOperations == null)
				throw new ArgumentNullException(nameof(hexCommandOperations));
			this.hexView = hexView;
			this.hexCommandOperations = hexCommandOperations;
		}
コード例 #6
0
ファイル: HexScrollMapImpl.cs プロジェクト: manojdjoshi/dnSpy
		public HexScrollMapImpl(HexView hexView) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			HexView = hexView;
			HexView.BufferLinesChanged += HexView_BufferLinesChanged;
			HexView.LayoutChanged += HexView_LayoutChanged;
			HexView.Closed += HexView_Closed;
		}
コード例 #7
0
		public HexEditorOperationsImpl(HexView hexView, HexHtmlBuilderService htmlBuilderService) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			if (htmlBuilderService == null)
				throw new ArgumentNullException(nameof(htmlBuilderService));
			HexView = hexView;
			HexView.Closed += HexView_Closed;
			this.htmlBuilderService = htmlBuilderService;
		}
コード例 #8
0
		public HexQuickInfoController(HexQuickInfoBroker quickInfoBroker, HexView hexView) {
			if (quickInfoBroker == null)
				throw new ArgumentNullException(nameof(quickInfoBroker));
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			this.hexView = hexView;
			this.quickInfoBroker = quickInfoBroker;
			hexView.MouseHover += HexView_MouseHover;
		}
コード例 #9
0
ファイル: HexViewState.cs プロジェクト: manojdjoshi/dnSpy
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="view">Hex view</param>
		/// <param name="effectiveViewportWidth">Viewport width</param>
		/// <param name="effectiveViewportHeight">Viewport height</param>
		public HexViewState(HexView view, double effectiveViewportWidth, double effectiveViewportHeight) {
			if (view == null)
				throw new ArgumentNullException(nameof(view));
			ViewportTop = view.ViewportTop;
			ViewportLeft = view.ViewportLeft;
			ViewportWidth = effectiveViewportWidth;
			ViewportHeight = effectiveViewportHeight;
			Buffer = view.Buffer;
		}
コード例 #10
0
		public override HexQuickInfoSession TriggerQuickInfo(HexView hexView, HexCellPosition triggerPoint, bool trackMouse) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			if (triggerPoint.IsDefault)
				throw new ArgumentException();
			var session = CreateQuickInfoSession(hexView, triggerPoint, trackMouse);
			session.Start();
			return session.IsDismissed ? null : session;
		}
コード例 #11
0
		public override HexQuickInfoSession CreateQuickInfoSession(HexView hexView, HexCellPosition triggerPoint, bool trackMouse) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			if (triggerPoint.IsDefault)
				throw new ArgumentException();
			var stack = intellisenseSessionStackMapService.Value.GetStackForHexView(hexView);
			var session = new HexQuickInfoSessionImpl(hexView, triggerPoint, trackMouse, intellisensePresenterFactoryService.Value, quickInfoSourceProviders);
			stack.PushSession(session);
			return session;
		}
コード例 #12
0
ファイル: HexMouseHoverEventArgs.cs プロジェクト: zz110/dnSpy
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="view">Hex view</param>
 /// <param name="line">Line</param>
 /// <param name="textPosition">Text position</param>
 public HexMouseHoverEventArgs(HexView view, HexBufferLine line, int textPosition)
 {
     if (textPosition < 0)
     {
         throw new ArgumentOutOfRangeException(nameof(textPosition));
     }
     View         = view ?? throw new ArgumentNullException(nameof(view));
     Line         = line ?? throw new ArgumentNullException(nameof(line));
     TextPosition = textPosition;
 }
コード例 #13
0
		public override string GenerateHtmlFragment(NormalizedHexBufferSpanCollection spans, HexView hexView, string delimiter, CancellationToken cancellationToken) {
			if (spans == null)
				throw new ArgumentNullException(nameof(spans));
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			if (delimiter == null)
				throw new ArgumentNullException(nameof(delimiter));

			return GenerateHtmlFragmentCore(hexView.BufferLines, spans, hexView, delimiter, cancellationToken);
		}
コード例 #14
0
		static void InitializeHexView(HexView hexView, HexSpan span) {
			if (!IsVisible(hexView, span))
				return;
			var bufferSpan = new HexBufferSpan(hexView.Buffer, span);
			hexView.Selection.Select(bufferSpan.Start, bufferSpan.End, alignPoints: false);
			var column = hexView.Caret.IsValuesCaretPresent ? HexColumnType.Values : HexColumnType.Ascii;
			hexView.Caret.MoveTo(column, bufferSpan.Start);
			var flags = column == HexColumnType.Values ? HexSpanSelectionFlags.Values : HexSpanSelectionFlags.Ascii;
			hexView.ViewScroller.EnsureSpanVisible(bufferSpan, flags, VSTE.EnsureSpanVisibleOptions.ShowStart);
		}
コード例 #15
0
ファイル: HexViewUIState.cs プロジェクト: manojdjoshi/dnSpy
		public HexViewUIState(HexView hexView) {
			var pos = hexView.Caret.Position.Position;
			ActiveColumn = pos.ActiveColumn;
			ValuesPosition = pos.ValuePosition.BufferPosition.Position;
			ValuesCellPosition = pos.ValuePosition.CellPosition;
			AsciiPosition = pos.AsciiPosition.BufferPosition.Position;
			ViewportLeft = hexView.ViewportLeft;
			var line = hexView.HexViewLines.FirstVisibleLine;
			TopLinePosition = line.BufferStart.Position;
			TopLineVerticalDistance = line.Top - hexView.ViewportTop;
		}
コード例 #16
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="view">Hex view</param>
		/// <param name="line">Line</param>
		/// <param name="textPosition">Text position</param>
		public HexMouseHoverEventArgs(HexView view, HexBufferLine line, int textPosition) {
			if (view == null)
				throw new ArgumentNullException(nameof(view));
			if (line == null)
				throw new ArgumentNullException(nameof(line));
			if (textPosition < 0)
				throw new ArgumentOutOfRangeException(nameof(textPosition));
			View = view;
			Line = line;
			TextPosition = textPosition;
		}
コード例 #17
0
		public HexCommandOperationsImpl(IMessageBoxService messageBoxService, HexEditorGroupFactoryService hexEditorGroupFactoryService, HexView hexView) {
			if (messageBoxService == null)
				throw new ArgumentNullException(nameof(messageBoxService));
			if (hexEditorGroupFactoryService == null)
				throw new ArgumentNullException(nameof(hexEditorGroupFactoryService));
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			this.messageBoxService = messageBoxService;
			this.hexEditorGroupFactoryService = hexEditorGroupFactoryService;
			HexView = hexView;
			hexView.Closed += HexView_Closed;
		}
コード例 #18
0
ファイル: HexViewState.cs プロジェクト: azureidea/dnSpy-1
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="view">Hex view</param>
 /// <param name="effectiveViewportWidth">Viewport width</param>
 /// <param name="effectiveViewportHeight">Viewport height</param>
 public HexViewState(HexView view, double effectiveViewportWidth, double effectiveViewportHeight)
 {
     if (view == null)
     {
         throw new ArgumentNullException(nameof(view));
     }
     ViewportTop    = view.ViewportTop;
     ViewportLeft   = view.ViewportLeft;
     ViewportWidth  = effectiveViewportWidth;
     ViewportHeight = effectiveViewportHeight;
     Buffer         = view.Buffer;
     Version        = view.Buffer.Version;
 }
コード例 #19
0
		public override HexStructureInfoAggregator Create(HexView hexView) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			return hexView.Properties.GetOrCreateSingletonProperty(typeof(HexStructureInfoAggregatorImpl), () => {
				var list = new List<HexStructureInfoProvider>(hexStructureInfoProviderFactories.Length);
				foreach (var lz in hexStructureInfoProviderFactories) {
					var provider = lz.Value.Create(hexView);
					if (provider != null)
						list.Add(provider);
				}
				return new HexStructureInfoAggregatorImpl(list.ToArray());
			});
		}
コード例 #20
0
ファイル: HexCaret.cs プロジェクト: haise0/dnSurgeon
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="hexView">Hex view</param>
 /// <param name="oldPosition">Old position</param>
 /// <param name="newPosition">New position</param>
 public HexCaretPositionChangedEventArgs(HexView hexView, HexCaretPosition oldPosition, HexCaretPosition newPosition)
 {
     if (oldPosition.IsDefault)
     {
         throw new ArgumentException();
     }
     if (newPosition.IsDefault)
     {
         throw new ArgumentException();
     }
     HexView     = hexView ?? throw new ArgumentNullException(nameof(hexView));
     OldPosition = oldPosition;
     NewPosition = newPosition;
 }
コード例 #21
0
		public override LocalGroupOptions GetDefaultLocalOptions(HexView hexView) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			var options = new LocalGroupOptions();
			options.ShowOffsetColumn = true;
			options.ShowValuesColumn = true;
			options.ShowAsciiColumn = true;
			options.StartPosition = hexView.Buffer.Span.Start;
			options.EndPosition = hexView.Buffer.Span.End;
			options.BasePosition = HexPosition.Zero;
			options.UseRelativePositions = false;
			options.OffsetBitSize = 0;
			options.HexValuesDisplayFormat = HexValuesDisplayFormat.HexByte;
			options.BytesPerLine = 0;
			return options;
		}
コード例 #22
0
		public HexQuickInfoSessionImpl(HexView hexView, HexCellPosition triggerPoint, bool trackMouse, HexIntellisensePresenterFactoryService intellisensePresenterFactoryService, Lazy<HexQuickInfoSourceProvider, VSUTIL.IOrderable>[] quickInfoSourceProviders) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			if (triggerPoint.IsDefault)
				throw new ArgumentException();
			if (intellisensePresenterFactoryService == null)
				throw new ArgumentNullException(nameof(intellisensePresenterFactoryService));
			if (quickInfoSourceProviders == null)
				throw new ArgumentNullException(nameof(quickInfoSourceProviders));
			QuickInfoContent = new VSLI.BulkObservableCollection<object>();
			HexView = hexView;
			TriggerPoint = triggerPoint;
			TrackMouse = trackMouse;
			this.intellisensePresenterFactoryService = intellisensePresenterFactoryService;
			this.quickInfoSourceProviders = quickInfoSourceProviders;
			HexView.Closed += HexView_Closed;
		}
コード例 #23
0
		string GenerateHtmlFragmentCore(HexBufferLineProvider bufferLines, NormalizedHexBufferSpanCollection spans, HexView hexView, string delimiter, CancellationToken cancellationToken) {
			HexClassifier classifier = null;
			try {
				VSTC.IClassificationFormatMap classificationFormatMap;
				if (hexView != null) {
					classifier = viewClassifierAggregatorService.GetClassifier(hexView);
					classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(hexView);
				}
				else {
					classifier = spans.Count == 0 ? null : classifierAggregatorService.GetClassifier(spans[0].Buffer);
					classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(AppearanceCategoryConstants.HexEditor);
				}

				const int tabSize = 4;
				var builder = new HexHtmlBuilder(classificationFormatMap, delimiter, tabSize);
				if (spans.Count != 0)
					builder.Add(bufferLines, classifier, spans, cancellationToken);
				return builder.Create();
			}
			finally {
				classifier.Dispose();
			}
		}
コード例 #24
0
		static bool IsVisible(HexView hexView, HexPosition start, HexPosition end) =>
			start < HexPosition.MaxEndPosition && start >= hexView.BufferLines.StartPosition && end <= hexView.BufferLines.EndPosition;
コード例 #25
0
		static void RedisplayHexLines(HexView hexView) {
			var line = hexView.HexViewLines.FirstVisibleLine;
			var verticalDistance = line.Top - hexView.ViewportTop;
			var bufferPosition = line.BufferStart;
			hexView.DisplayHexLineContainingBufferPosition(bufferPosition, verticalDistance, VSTE.ViewRelativePosition.Top, null, null, DisplayHexLineOptions.CanRecreateBufferLines);
		}
コード例 #26
0
		/// <summary>
		/// Gets all active quick info sessions in <paramref name="hexView"/>
		/// </summary>
		/// <param name="hexView">Hex view</param>
		/// <returns></returns>
		public abstract ReadOnlyCollection<HexQuickInfoSession> GetSessions(HexView hexView);
コード例 #27
0
		/// <summary>
		/// Creates a quick info session
		/// </summary>
		/// <param name="hexView">Hex view</param>
		/// <param name="triggerPoint">Trigger point</param>
		/// <param name="trackMouse">true to track the mouse</param>
		/// <returns></returns>
		public abstract HexQuickInfoSession CreateQuickInfoSession(HexView hexView, HexCellPosition triggerPoint, bool trackMouse);
コード例 #28
0
		/// <summary>
		/// Triggers a quick info session
		/// </summary>
		/// <param name="hexView">Hex view</param>
		/// <returns></returns>
		public abstract HexQuickInfoSession TriggerQuickInfo(HexView hexView);
コード例 #29
0
		/// <summary>
		/// Returns true if quick info is active in <paramref name="hexView"/>
		/// </summary>
		/// <param name="hexView">Hex view to check</param>
		/// <returns></returns>
		public abstract bool IsQuickInfoActive(HexView hexView);
コード例 #30
0
		public override void Detach(HexView hexView) => hexView.MouseHover -= HexView_MouseHover;
コード例 #31
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="hexView">Hex view</param>
 public HexViewCreatedEventArgs(HexView hexView) => HexView = hexView ?? throw new ArgumentNullException(nameof(hexView));
コード例 #32
0
ファイル: HexMarkerHelper.cs プロジェクト: manojdjoshi/dnSpy
		public static bool IsMultiLineSpan(HexView hexView, HexBufferSpan bufferSpan) {
			var lineNum1 = hexView.BufferLines.GetLineNumberFromPosition(bufferSpan.Start);
			var lineNum2 = hexView.BufferLines.GetLineNumberFromPosition(bufferSpan.End);
			return lineNum1 != lineNum2;
		}
コード例 #33
0
 /// <summary>
 /// Handles a reference
 /// </summary>
 /// <param name="hexView">Hex view</param>
 /// <param name="reference">Reference created by eg. <see cref="HexStructureInfoProvider.GetReference(HexPosition)"/></param>
 /// <param name="tags">Tags, see <see cref="PredefinedHexReferenceHandlerTags"/></param>
 /// <returns></returns>
 public abstract bool Handle(HexView hexView, object reference, IList <string> tags);
コード例 #34
0
 /// <summary>
 /// Creates a <see cref="HexStructureInfoProvider"/> instance
 /// </summary>
 /// <param name="hexView">Hex view</param>
 /// <returns></returns>
 public abstract HexStructureInfoProvider Create(HexView hexView);
コード例 #35
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="hexView">Hex view</param>
		public HexViewCreatedEventArgs(HexView hexView) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			HexView = hexView;
		}
コード例 #36
0
ファイル: HexCaret.cs プロジェクト: zquans/dnSpy
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="hexView">Hex view</param>
 /// <param name="oldPosition">Old position</param>
 /// <param name="newPosition">New position</param>
 public HexCaretPositionChangedEventArgs(HexView hexView, in HexCaretPosition oldPosition, in HexCaretPosition newPosition)
コード例 #37
0
		public HexViewScrollerImpl(HexView hexView) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			this.hexView = hexView;
		}
コード例 #38
0
		/// <summary>
		/// Creates a <see cref="HexIntellisenseController"/> or returns null
		/// </summary>
		/// <param name="hexView">Hex view</param>
		/// <returns></returns>
		public abstract HexIntellisenseController TryCreateIntellisenseController(HexView hexView);
コード例 #39
0
ファイル: HexViewState.cs プロジェクト: azureidea/dnSpy-1
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="view">Hex view</param>
 public HexViewState(HexView view)
     : this(view, view?.ViewportWidth ?? 0, view?.ViewportHeight ?? 0)
 {
 }