Пример #1
0
        string GetFilename(OutputBufferVM vm)
        {
            // Same as VS2015
            var s = vm.Name.Replace(" ", string.Empty);

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

            Debug.Assert(vm != null);
            if (vm != null)
            {
                SelectedOutputBufferVM = vm;
            }
        }
Пример #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);
 }
Пример #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);
        }
Пример #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;
                    }
                }
            }
        }
Пример #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;
                    }
                }
            }
        }
Пример #8
0
		public OutputBufferVM SelectLog(int index) {
			if (!CanSelectLog(index))
				return null;
			SelectedOutputBufferVM = OutputBuffers[index];
			return SelectedOutputBufferVM;
		}
Пример #9
0
		string GetFilename(OutputBufferVM vm) {
			// Same as VS2015
			var s = vm.Name.Replace(" ", string.Empty);
			return dnSpy_Resources.Window_Output + "-" + s + ".txt";
		}
Пример #10
0
		public void Select(Guid guid) {
			var vm = OutputBuffers.FirstOrDefault(a => a.Guid == guid);
			Debug.Assert(vm != null);
			if (vm != null)
				SelectedOutputBufferVM = vm;
		}
Пример #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;
		}
Пример #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;
		}
Пример #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;
					}
				}
			}
		}