public async Task RunAsync (ApplicationArguments args) { try { var projectsSynchronizer = new ProjectsSynchronizer (args); await projectsSynchronizer.MakeResourcesSubdirectoriesAndFilesLowercase (async () => { System.Console.WriteLine ("Permissions to change original project has been requested and granted."); return true; }); projectsSynchronizer.Sync (); } catch (Exception e) { System.Console.WriteLine(e.Message); } }
/// <summary> /// This function is the callback used to execute a command when the a menu item is clicked. /// See the Initialize method to see how the menu item is associated to this function using /// the OleMenuCommandService service and the MenuCommand class. /// </summary> private async void MenuItemCallback(object sender, EventArgs e) { if (string.IsNullOrEmpty(Settings.Default.AnidePath)) { var dlg = new ConfigurationDialog(); dlg.ShowModal(); } if (string.IsNullOrEmpty(Settings.Default.AnidePath)) return; try { var envDte = GetService(typeof(DTE)) as DTE; var projectItem = envDte.SelectedItems.OfType<SelectedItem>().First().ProjectItem; var project = projectItem.ContainingProject; //it should have at least one item var fileName = project.FileName; var synchronizer = new ProjectsSynchronizer(fileName, Settings.Default.AnidePath); await synchronizer.MakeResourcesSubdirectoriesAndFilesLowercase(async () => AskPermissionToChangeCsProj()); ShowSuggestions(); synchronizer.Sync(projectItem.FileCount > 0 ? projectItem.FileNames[0] : string.Empty); project.Save(); } catch (OperationCanceledException) { } catch (CsprojEditFailedException exc) { ShowErrorDuringSync(".csproj edit failed: {0} ", exc); } catch (FileRenameToLowercaseException exc) { ShowErrorDuringSync("Renaming {0} to lowercase failed: {1}", exc.FileName, exc); } catch (Exception exc) { ShowErrorDuringSync("General failure: {0}", exc); } }