Exemple #1
0
        public override void Execute(IMenuItemContext context)
        {
            var modules = GetModules();

            if (modules.Length == 0)
            {
                return;
            }

            var decompiler = decompilerService.Decompiler;

            if (decompiler.ProjectFileExtension == null)
            {
                decompiler = decompilerService.AllDecompilers.FirstOrDefault(a => a.ProjectFileExtension != null);
                Debug.Assert(decompiler != null);
                if (decompiler == null)
                {
                    return;
                }
            }

            var task = new ExportTask(this, modules);
            var vm   = new ExportToProjectVM(new PickDirectory(), decompilerService, task, bamlDecompiler != null);

            task.vm                 = vm;
            vm.ProjectVersion       = exportToProjectSettings.ProjectVersion;
            vm.CreateResX           = documentTreeViewSettings.DeserializeResources;
            vm.DontReferenceStdLib  = modules.Any(a => a.Assembly.IsCorLib());
            vm.Decompiler           = decompiler;
            vm.SolutionFilename     = GetSolutionFilename(modules);
            vm.FilesToExportMessage = CreateFilesToExportMessage(modules);

            var win = new ExportToProjectDlg();

            task.dlg        = win;
            win.DataContext = vm;
            win.Owner       = appWindow.MainWindow;
            using (documentTreeView.DocumentService.DisableAssemblyLoad())
                win.ShowDialog();
            if (vm.IsComplete)
            {
                exportToProjectSettings.ProjectVersion = vm.ProjectVersion;
            }
            task.Dispose();
        }
Exemple #2
0
        public override void Execute(IMenuItemContext context)
        {
            var modules = GetModules();

            if (modules.Length == 0)
            {
                return;
            }

            var lang = languageManager.SelectedLanguage;

            if (lang.ProjectFileExtension == null)
            {
                lang = languageManager.Languages.FirstOrDefault(a => a.ProjectFileExtension != null);
                Debug.Assert(lang != null);
                if (lang == null)
                {
                    return;
                }
            }

            var task = new ExportTask(this, modules);
            var vm   = new ExportToProjectVM(new PickDirectory(), languageManager, task, bamlDecompiler != null);

            task.vm                 = vm;
            vm.CreateResX           = fileTreeViewSettings.DeserializeResources;
            vm.DontReferenceStdLib  = modules.Any(a => a.Assembly.IsCorLib());
            vm.Language             = lang;
            vm.SolutionFilename     = GetSolutionFilename(modules);
            vm.FilesToExportMessage = CreateFilesToExportMessage(modules);

            var win = new ExportToProjectDlg();

            task.dlg        = win;
            win.DataContext = vm;
            win.Owner       = appWindow.MainWindow;
            using (fileTreeView.FileManager.DisableAssemblyLoad())
                win.ShowDialog();
        }