private void WorkerCompletedCallback(BackgroundFileHandler fileHandler) { if (fileHandler.FilesCount != 2) { return; } var item = fileHandler.Files[0] as CompositFile; if (item == null) { return; } var selected = fileHandler.Files[1] as CompositFile; if (selected == null) { return; } string folder1 = selected.WorkingFolder; string folder2 = item.WorkingFolder; Process.Start(CrcsSettings.Current.WinMergeFile, " /r /e /f CscStudio \"" + folder1 + "\" \"" + folder2 + "\""); }
public void ProcessFiles(IEnumerable <CompositFile> files) { string statusText = "Processing files for selected apk and jar files"; string caption = "Select processing options for selected apk and jar files"; if (files == null) { if (solutionExplorer.SelectedProject == null) { return; } statusText = "Processing files for all included apk and jar files"; caption = "Select processing options for all included apk and jar files"; files = solutionExplorer.SelectedProject.GetCompositFiles().Where(x => x.IsIncluded); } var optionsForm = new ProcessOptionsForm(caption); if (optionsForm.ShowDialog(this) == DialogResult.Cancel || optionsForm.NoOptionsSelected) { return; } toolStripStatusText.Text = statusText; ShowProgressBarAndCancel(); var worker = new BackgroundFileHandler(WorkerCompletedCallback); worker.SetFileHandlers(ProcessHandlerFactory.CreateFileHandlers(optionsForm.ProcessingOptions, _solution.Properties)); AddBackGroundWorker(worker); worker.Start(files); }
private void MenuProjectCompareToItemClick(object sender, EventArgs e) { var menuItem = sender as ToolStripMenuItem; if (menuItem == null) { return; } var item = menuItem.Tag as CompositFile; if (item == null) { return; } var selected = SelectedNode.ProjectItem as CompositFile; if (selected == null) { return; } var worker = new BackgroundFileHandler(WorkerCompletedCallback); worker.SetFileHandlers(new IFileHandler[] { new BackupFilesHandler(), new BaksmaliHandler(_solution.Properties), new DecodeHandler(_solution.Properties) }); worker.Start(new[] { item, selected }); }
private void AddBackGroundWorker(BackgroundFileHandler worker) { lock (_workerLockObject) { _backgroundWorkers.Add(worker); } _solution.PauseFileSystemWatchers(); }
private void WorkerCompletedCallback(BackgroundFileHandler worker) { lock (_workerLockObject) { _backgroundWorkers.Remove(worker); } solutionExplorer.Refresh(); if (_backgroundWorkers.Count == 0) { HideProgressBarAndCancel(); _solution.ResumeFileSystemWatchers(); } }
public void ProcessFiles(IEnumerable <CompositFile> files, ProcessingOptions processingOptions) { if (files == null) { if (solutionExplorer.SelectedProject == null) { return; } files = solutionExplorer.SelectedProject.GetCompositFiles().Where(x => x.IsIncluded); } toolStripStatusText.Text = "Processing files..."; ShowProgressBarAndCancel(); var worker = new BackgroundFileHandler(WorkerCompletedCallback); worker.SetFileHandlers(ProcessHandlerFactory.CreateFileHandlers(processingOptions, _solution.Properties)); AddBackGroundWorker(worker); worker.Start(files); }
private void UpdateZipCompletedCallback(BackgroundFileHandler worker) { lock (_workerLockObject) { _backgroundWorkers.Remove(worker); if (worker.IsCanceled()) { _updateZipHandler.DeleteZipFile(); } else { _updateZipHandler.CloseZipFile(); } _updateZipHandler.Dispose(); _updateZipHandler = null; } if (_backgroundWorkers.Count == 0) { HideProgressBarAndCancel(); _solution.ResumeFileSystemWatchers(); } }
private void MenuMainBuildBuildClick(object sender, EventArgs e) { bool error = false; try { toolStripStatusText.Text = "Building update.zip"; ShowProgressBarAndCancel(); _solution.PauseFileSystemWatchers(); var worker = new BackgroundFileHandler(UpdateZipCompletedCallback); _updateZipHandler = new UpdateZipHandler(_solution.Properties); worker.AddFileHandler(_updateZipHandler); AddBackGroundWorker(worker); worker.Start(_solution.GetBuildFiles()); } catch (Exception ex) { error = true; MessageEngine.ShowError(ex); } finally { if (error) { HideProgressBarAndCancel(); _solution.ResumeFileSystemWatchers(); if (_updateZipHandler != null) { _updateZipHandler.DeleteZipFile(); _updateZipHandler.Dispose(); _updateZipHandler = null; } } } }