Example #1
0
 ExportProjectCommand(IAppWindow appWindow, IDocumentTreeView documentTreeView, IDecompilerService decompilerService, IDocumentTreeViewSettings documentTreeViewSettings, IExportToProjectSettings exportToProjectSettings, [ImportMany] IEnumerable <Lazy <IBamlDecompiler> > bamlDecompilers)
 {
     this.appWindow                = appWindow;
     this.documentTreeView         = documentTreeView;
     this.decompilerService        = decompilerService;
     this.documentTreeViewSettings = documentTreeViewSettings;
     this.exportToProjectSettings  = exportToProjectSettings;
     this.bamlDecompiler           = bamlDecompilers.FirstOrDefault();
 }
Example #2
0
		ExportProjectCommand(IAppWindow appWindow, IDocumentTreeView documentTreeView, IDecompilerService decompilerService, IDocumentTreeViewSettings documentTreeViewSettings, IExportToProjectSettings exportToProjectSettings, [ImportMany] IEnumerable<Lazy<IBamlDecompiler>> bamlDecompilers, [ImportMany] IEnumerable<Lazy<IXamlOutputOptionsProvider>> xamlOutputOptionsProviders) {
			this.appWindow = appWindow;
			this.documentTreeView = documentTreeView;
			this.decompilerService = decompilerService;
			this.documentTreeViewSettings = documentTreeViewSettings;
			this.exportToProjectSettings = exportToProjectSettings;
			bamlDecompiler = bamlDecompilers.FirstOrDefault();
			xamlOutputOptionsProvider = xamlOutputOptionsProviders.FirstOrDefault();
		}
Example #3
0
        public DocumentTreeView(bool isGlobal, IDocumentTreeNodeFilter filter, ITreeViewService treeViewService, IDecompilerService decompilerService, IDsDocumentService documentService, IDocumentTreeViewSettings documentTreeViewSettings, IMenuService menuService, IDotNetImageService dotNetImageService, IWpfCommandService wpfCommandService, IResourceNodeFactory resourceNodeFactory, IAppSettings appSettings, [ImportMany] IEnumerable <Lazy <IDsDocumentNodeProvider, IDsDocumentNodeProviderMetadata> > dsDocumentNodeProvider, [ImportMany] IEnumerable <Lazy <IDocumentTreeNodeDataFinder, IDocumentTreeNodeDataFinderMetadata> > mefFinders, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider)
        {
            this.decompilerService        = decompilerService;
            this.documentTreeViewSettings = documentTreeViewSettings;
            this.appSettings = appSettings;

            this.context = new DocumentTreeNodeDataContext(this, resourceNodeFactory, filter ?? FilterNothingDocumentTreeNodeFilter.Instance, treeViewNodeTextElementProvider)
            {
                SyntaxHighlight            = documentTreeViewSettings.SyntaxHighlight,
                SingleClickExpandsChildren = documentTreeViewSettings.SingleClickExpandsTreeViewChildren,
                ShowAssemblyVersion        = documentTreeViewSettings.ShowAssemblyVersion,
                ShowAssemblyPublicKeyToken = documentTreeViewSettings.ShowAssemblyPublicKeyToken,
                ShowToken            = documentTreeViewSettings.ShowToken,
                Decompiler           = decompilerService.Decompiler,
                UseNewRenderer       = appSettings.UseNewRenderer_DocumentTreeView,
                DeserializeResources = documentTreeViewSettings.DeserializeResources,
                CanDragAndDrop       = isGlobal,
            };

            var options = new TreeViewOptions {
                AllowDrop          = true,
                IsVirtualizing     = true,
                VirtualizationMode = VirtualizationMode.Recycling,
                TreeViewListener   = this,
                RootNode           = new RootNode {
                    DropNodes = OnDropNodes,
                    DropFiles = OnDropFiles,
                },
            };

            this.documentTreeNodeGroups = new DocumentTreeNodeGroups();
            this.dsDocumentNodeProvider = dsDocumentNodeProvider.OrderBy(a => a.Metadata.Order).ToArray();
            this.TreeView = treeViewService.Create(new Guid(TreeViewConstants.DOCUMENT_TREEVIEW_GUID), options);
            this.TreeView.SelectionChanged += TreeView_SelectionChanged;
            this.DocumentService            = documentService;
            this.DotNetImageService         = dotNetImageService;
            this.dispatcher = Dispatcher.CurrentDispatcher;
            this.DocumentService.SetDispatcher(AddAction);
            documentService.CollectionChanged        += DocumentService_CollectionChanged;
            decompilerService.DecompilerChanged      += DecompilerService_DecompilerChanged;
            documentTreeViewSettings.PropertyChanged += DocumentTreeViewSettings_PropertyChanged;
            appSettings.PropertyChanged += AppSettings_PropertyChanged;

            this.WpfCommands = wpfCommandService.GetCommands(ControlConstants.GUID_DOCUMENT_TREEVIEW);

            if (isGlobal)
            {
                menuService.InitializeContextMenu(this.TreeView.UIObject, new Guid(MenuConstants.GUIDOBJ_DOCUMENTS_TREEVIEW_GUID), new GuidObjectsProvider(this.TreeView));
                wpfCommandService.Add(ControlConstants.GUID_DOCUMENT_TREEVIEW, TreeView.UIObject);
            }

            this.nodeFinders = mefFinders.OrderBy(a => a.Metadata.Order).ToArray();
            InitializeDocumentTreeNodeGroups();
        }
 DocumentTreeViewProvider(ITreeViewService treeViewService, IDecompilerService decompilerService, IDsDocumentServiceProvider documentServiceProvider, IDocumentTreeViewSettings documentTreeViewSettings, IMenuService menuService, IDotNetImageService dotNetImageService, IWpfCommandService wpfCommandService, IResourceNodeFactory resourceNodeFactory, [ImportMany] IEnumerable <Lazy <IDsDocumentNodeProvider, IDsDocumentNodeProviderMetadata> > dsDocumentNodeProviders, [ImportMany] IEnumerable <Lazy <IDocumentTreeNodeDataFinder, IDocumentTreeNodeDataFinderMetadata> > mefFinders, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider)
 {
     this.treeViewService          = treeViewService;
     this.decompilerService        = decompilerService;
     this.documentServiceProvider  = documentServiceProvider;
     this.documentTreeViewSettings = documentTreeViewSettings;
     this.menuService             = menuService;
     this.dotNetImageService      = dotNetImageService;
     this.wpfCommandService       = wpfCommandService;
     this.resourceNodeFactory     = resourceNodeFactory;
     this.dsDocumentNodeProviders = dsDocumentNodeProviders.ToArray();
     this.mefFinders = mefFinders.ToArray();
     this.treeViewNodeTextElementProvider = treeViewNodeTextElementProvider;
 }
		DocumentTreeViewProvider(ITreeViewService treeViewService, IDecompilerService decompilerService, IDsDocumentServiceProvider documentServiceProvider, IDocumentTreeViewSettings documentTreeViewSettings, IMenuService menuService, IDotNetImageService dotNetImageService, IWpfCommandService wpfCommandService, IResourceNodeFactory resourceNodeFactory, IAppSettings appSettings, [ImportMany] IEnumerable<Lazy<IDsDocumentNodeProvider, IDsDocumentNodeProviderMetadata>> dsDocumentNodeProviders, [ImportMany] IEnumerable<Lazy<IDocumentTreeNodeDataFinder, IDocumentTreeNodeDataFinderMetadata>> mefFinders, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider) {
			this.treeViewService = treeViewService;
			this.decompilerService = decompilerService;
			this.documentServiceProvider = documentServiceProvider;
			this.documentTreeViewSettings = documentTreeViewSettings;
			this.menuService = menuService;
			this.dotNetImageService = dotNetImageService;
			this.wpfCommandService = wpfCommandService;
			this.resourceNodeFactory = resourceNodeFactory;
			this.appSettings = appSettings;
			this.dsDocumentNodeProviders = dsDocumentNodeProviders.ToArray();
			this.mefFinders = mefFinders.ToArray();
			this.treeViewNodeTextElementProvider = treeViewNodeTextElementProvider;
		}
Example #6
0
 RefreshResourcesCommand(IDocumentTabService documentTabService, IDocumentTreeViewSettings documentTreeViewSettings, IDecompilationCache decompilationCache)
 {
     this.documentTabService = documentTabService;
     this.decompilationCache = decompilationCache;
     documentTreeViewSettings.PropertyChanged += DocumentTreeViewSettings_PropertyChanged;
 }
Example #7
0
 Loader(IAppWindow appWindow, IDocumentTreeView documentTreeView, IDocumentSearcherProvider fileSearcherProvider, IDecompilerService decompilerService, IDocumentTreeViewProvider documentTreeViewProvider, IDocumentTreeViewSettings documentTreeViewSettings)
 {
     DnlibTypePicker.appWindow                = appWindow;
     DnlibTypePicker.documentTreeView         = documentTreeView;
     DnlibTypePicker.fileSearcherProvider     = fileSearcherProvider;
     DnlibTypePicker.decompilerService        = decompilerService;
     DnlibTypePicker.documentTreeViewProvider = documentTreeViewProvider;
     DnlibTypePicker.documentTreeViewSettings = documentTreeViewSettings;
 }
Example #8
0
 DecompilerTabContentContext(DecompilerTabContentTextElementProvider decompilerTabContentTextElementProvider, IDocumentTreeViewSettings documentTreeViewSettings)
 {
     DecompilerTabContentTextElementProvider = decompilerTabContentTextElementProvider;
     DocumentTreeViewSettings = documentTreeViewSettings;
 }
Example #9
0
 DocumentTreeView(ITreeViewService treeViewService, IDecompilerService decompilerService, IDsDocumentService documentService, IDocumentTreeViewSettings documentTreeViewSettings, IMenuService menuService, IDotNetImageService dotNetImageService, IWpfCommandService wpfCommandService, IResourceNodeFactory resourceNodeFactory, IAppSettings appSettings, [ImportMany] IEnumerable <Lazy <IDsDocumentNodeProvider, IDsDocumentNodeProviderMetadata> > dsDocumentNodeProviders, [ImportMany] IEnumerable <Lazy <IDocumentTreeNodeDataFinder, IDocumentTreeNodeDataFinderMetadata> > mefFinders, ITreeViewNodeTextElementProvider treeViewNodeTextElementProvider)
     : this(true, null, treeViewService, decompilerService, documentService, documentTreeViewSettings, menuService, dotNetImageService, wpfCommandService, resourceNodeFactory, appSettings, dsDocumentNodeProviders, mefFinders, treeViewNodeTextElementProvider)
 {
 }
		RefreshResourcesCommand(IDocumentTabService documentTabService, IDocumentTreeViewSettings documentTreeViewSettings, IDecompilationCache decompilationCache) {
			this.documentTabService = documentTabService;
			this.decompilationCache = decompilationCache;
			documentTreeViewSettings.PropertyChanged += DocumentTreeViewSettings_PropertyChanged;
		}
Example #11
0
		static void Execute(Lazy<IUndoCommandService> undoCommandService, IAppService appService, IDocumentTreeViewSettings documentTreeViewSettings, DocumentTreeNodeData[] nodes) {
			if (!CanExecute(nodes))
				return;

			var rsrcElNode = (ResourceElementNode)nodes[0];
			var module = nodes[0].GetModule();
			Debug.Assert(module != null);
			if (module == null)
				throw new InvalidOperationException();

			var options = new ResourceElementOptions(rsrcElNode.ResourceElement);
			var data = new ResourceElementVM(options, module, documentTreeViewSettings.DeserializeResources);
			data.CanChangeType = false;
			var win = new ResourceElementDlg();
			win.Title = dnSpy_AsmEditor_Resources.EditResourceCommand2;
			win.DataContext = data;
			win.Owner = appService.MainWindow;
			if (win.ShowDialog() != true)
				return;

			var opts = data.CreateResourceElementOptions();
			string error;
			try {
				error = rsrcElNode.CheckCanUpdateData(opts.Create());
			}
			catch (Exception ex) {
				error = string.Format(dnSpy_AsmEditor_Resources.Error_InvalidResourceData, ex.Message);
			}
			if (!string.IsNullOrEmpty(error)) {
				MsgBox.Instance.Show(error);
				return;
			}

			undoCommandService.Value.Add(new ResourceElementSettingsCommand(rsrcElNode, opts));
		}
Example #12
0
			CodeCommand(Lazy<IUndoCommandService> undoCommandService, IAppService appService, IDocumentTreeViewSettings documentTreeViewSettings)
				: base(appService.DocumentTreeView) {
				this.undoCommandService = undoCommandService;
				this.appService = appService;
				this.documentTreeViewSettings = documentTreeViewSettings;
			}
Example #13
0
		static void Execute(Lazy<IUndoCommandService> undoCommandService, IAppService appService, IResourceNodeFactory resourceNodeFactory, IDocumentTreeViewSettings documentTreeViewSettings, DocumentTreeNodeData[] nodes) {
			if (!CanExecute(nodes))
				return;

			var rsrcSetNode = nodes[0] as ResourceElementSetNode;
			if (rsrcSetNode == null)
				rsrcSetNode = nodes[0].TreeNode.Parent.Data as ResourceElementSetNode;
			Debug.Assert(rsrcSetNode != null);

			var module = nodes[0].GetModule();
			Debug.Assert(module != null);
			if (module == null)
				throw new InvalidOperationException();

			var options = new ResourceElementOptions(new ResourceElement {
				Name = string.Empty,
				ResourceData = new BuiltInResourceData(ResourceTypeCode.String, string.Empty),
			});
			var data = new ResourceElementVM(options, module, documentTreeViewSettings.DeserializeResources);
			var win = new ResourceElementDlg();
			win.Title = dnSpy_AsmEditor_Resources.CreateResourceCommand2;
			win.DataContext = data;
			win.Owner = appService.MainWindow;
			if (win.ShowDialog() != true)
				return;

			var opts = data.CreateResourceElementOptions();
			var treeView = appService.DocumentTreeView.TreeView;
			var treeNodeGroup = appService.DocumentTreeView.DocumentTreeNodeGroups.GetGroup(DocumentTreeNodeGroupType.ResourceElementTreeNodeGroup);
			var node = (ResourceElementNode)treeView.Create(resourceNodeFactory.Create(module, opts.Create(), treeNodeGroup)).Data;
			undoCommandService.Value.Add(new CreateResourceElementCommand(rsrcSetNode, node));
			appService.DocumentTabService.FollowReference(node);
		}
Example #14
0
			CodeCommand(Lazy<IUndoCommandService> undoCommandService, IAppService appService, IResourceNodeFactory resourceNodeFactory, IDocumentTreeViewSettings documentTreeViewSettings)
				: base(appService.DocumentTreeView) {
				this.undoCommandService = undoCommandService;
				this.appService = appService;
				this.resourceNodeFactory = resourceNodeFactory;
				this.documentTreeViewSettings = documentTreeViewSettings;
			}