Exemplo n.º 1
0
        string GetFilename(OutputBufferVM vm)
        {
            // Same as VS2015
            var s = vm.Name.Replace(" ", string.Empty);

            return(dnSpy_Resources.Window_Output + "-" + s + ".txt");
        }
Exemplo n.º 2
0
 public OutputBufferVM SelectLog(int index)
 {
     if (!CanSelectLog(index))
     {
         return(null);
     }
     SelectedOutputBufferVM = OutputBuffers[index];
     return(SelectedOutputBufferVM);
 }
Exemplo n.º 3
0
        public void Select(Guid guid)
        {
            var vm = OutputBuffers.FirstOrDefault(a => a.Guid == guid);

            Debug.Assert(vm != null);
            if (vm != null)
            {
                SelectedOutputBufferVM = vm;
            }
        }
Exemplo n.º 4
0
 int GetSortedInsertIndex(OutputBufferVM vm)
 {
     for (int i = 0; i < OutputBuffers.Count; i++)
     {
         if (StringComparer.InvariantCultureIgnoreCase.Compare(vm.Name, OutputBuffers[i].Name) < 0)
         {
             return(i);
         }
     }
     return(OutputBuffers.Count);
 }
Exemplo n.º 5
0
        IOutputTextPane Create(Guid guid, string name, object contentTypeObj)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            var vm = OutputBuffers.FirstOrDefault(a => a.Guid == guid);

            Debug.Assert(vm == null || vm.Name == name);
            if (vm != null)
            {
                return(vm);
            }

            var logEditorOptions = new LogEditorOptions {
                MenuGuid          = new Guid(MenuConstants.GUIDOBJ_LOG_TEXTEDITORCONTROL_GUID),
                ContentType       = contentTypeObj as IContentType,
                ContentTypeString = contentTypeObj as string,
                CreateGuidObjects = args => CreateGuidObjects(args),
            };

            logEditorOptions.ExtraRoles.Add(PredefinedDsTextViewRoles.OutputTextPane);
            var logEditor = logEditorProvider.Create(logEditorOptions);

            logEditor.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.OutputWindow);

            // Prevent toolwindow's ctx menu from showing up when right-clicking in the left margin
            menuService.InitializeContextMenu(logEditor.TextViewHost.HostControl, Guid.NewGuid());

            vm = new OutputBufferVM(editorOperationsFactoryService, guid, name, logEditor);
            int index = GetSortedInsertIndex(vm);

            OutputBuffers.Insert(index, vm);
            while (index < OutputBuffers.Count)
            {
                OutputBuffers[index].Index = index++;
            }

            OutputTextPaneUtils.AddInstance(vm, logEditor.TextView);
            return(vm);
        }
Exemplo n.º 6
0
        void OutputBuffers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (SelectedOutputBufferVM == null)
            {
                SelectedOutputBufferVM = OutputBuffers.FirstOrDefault();
            }

            if (e.NewItems != null)
            {
                foreach (OutputBufferVM vm in e.NewItems)
                {
                    if (vm.Guid == prevSelectedGuid && prevSelectedGuid != Guid.Empty)
                    {
                        SelectedOutputBufferVM = vm;
                        prevSelectedGuid       = Guid.Empty;
                        break;
                    }
                }
            }
        }
Exemplo n.º 7
0
        void OutputBuffers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (SelectedOutputBufferVM == null)
            {
                SelectedOutputBufferVM = OutputBuffers.FirstOrDefault();
            }

            if (e.NewItems != null)
            {
                foreach (OutputBufferVM vm in e.NewItems)
                {
                    vm.WordWrapStyle   = outputManagerSettingsImpl.WordWrapStyle;
                    vm.ShowLineNumbers = outputManagerSettingsImpl.ShowLineNumbers;
                    vm.ShowTimestamps  = outputManagerSettingsImpl.ShowTimestamps;
                    if (vm.Guid == prevSelectedGuid && prevSelectedGuid != Guid.Empty)
                    {
                        SelectedOutputBufferVM = vm;
                        prevSelectedGuid       = Guid.Empty;
                    }
                }
            }
        }
Exemplo n.º 8
0
		public OutputBufferVM SelectLog(int index) {
			if (!CanSelectLog(index))
				return null;
			SelectedOutputBufferVM = OutputBuffers[index];
			return SelectedOutputBufferVM;
		}
Exemplo n.º 9
0
		string GetFilename(OutputBufferVM vm) {
			// Same as VS2015
			var s = vm.Name.Replace(" ", string.Empty);
			return dnSpy_Resources.Window_Output + "-" + s + ".txt";
		}
Exemplo n.º 10
0
		public void Select(Guid guid) {
			var vm = OutputBuffers.FirstOrDefault(a => a.Guid == guid);
			Debug.Assert(vm != null);
			if (vm != null)
				SelectedOutputBufferVM = vm;
		}
Exemplo n.º 11
0
		int GetSortedInsertIndex(OutputBufferVM vm) {
			for (int i = 0; i < OutputBuffers.Count; i++) {
				if (StringComparer.InvariantCultureIgnoreCase.Compare(vm.Name, OutputBuffers[i].Name) < 0)
					return i;
			}
			return OutputBuffers.Count;
		}
Exemplo n.º 12
0
		IOutputTextPane Create(Guid guid, string name, object contentTypeObj) {
			if (name == null)
				throw new ArgumentNullException(nameof(name));

			var vm = OutputBuffers.FirstOrDefault(a => a.Guid == guid);
			Debug.Assert(vm == null || vm.Name == name);
			if (vm != null)
				return vm;

			var logEditorOptions = new LogEditorOptions {
				MenuGuid = new Guid(MenuConstants.GUIDOBJ_LOG_TEXTEDITORCONTROL_GUID),
				ContentType = contentTypeObj as IContentType,
				ContentTypeString = contentTypeObj as string,
				CreateGuidObjects = args => CreateGuidObjects(args),
			};
			logEditorOptions.ExtraRoles.Add(PredefinedDsTextViewRoles.OutputTextPane);
			var logEditor = logEditorProvider.Create(logEditorOptions);
			logEditor.TextView.Options.SetOptionValue(DefaultWpfViewOptions.AppearanceCategory, AppearanceCategoryConstants.OutputWindow);

			// Prevent toolwindow's ctx menu from showing up when right-clicking in the left margin
			menuService.InitializeContextMenu(logEditor.TextViewHost.HostControl, Guid.NewGuid());

			vm = new OutputBufferVM(editorOperationsFactoryService, guid, name, logEditor);
			int index = GetSortedInsertIndex(vm);
			OutputBuffers.Insert(index, vm);
			while (index < OutputBuffers.Count)
				OutputBuffers[index].Index = index++;

			OutputTextPaneUtils.AddInstance(vm, logEditor.TextView);
			return vm;
		}
Exemplo n.º 13
0
		void OutputBuffers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) {
			if (SelectedOutputBufferVM == null)
				SelectedOutputBufferVM = OutputBuffers.FirstOrDefault();

			if (e.NewItems != null) {
				foreach (OutputBufferVM vm in e.NewItems) {
					if (vm.Guid == prevSelectedGuid && prevSelectedGuid != Guid.Empty) {
						SelectedOutputBufferVM = vm;
						prevSelectedGuid = Guid.Empty;
						break;
					}
				}
			}
		}