protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { var nodes = new TreeNodeCollection(); var settings = _settingsService.GetSettings(); var trashedNodes = _umbracoDbRepository.GetTrashedNodes(); if (id == PackageConstants.FirstNodeId && settings != null && !settings.HideLeftPanel) { foreach (var timage in _imageService.GetTopOptimizedImages()) { var treeNode = CreateTreeNode(timage.Id + string.Empty, id, queryStrings, timage.Name, PackageConstants.TreeIcon, false, queryStrings.GetValue <string>(PackageConstants.AppAlias) + PackageConstants.CustomTreeUrl + SolutionExtensions.Base64Encode(timage.Id)); if (trashedNodes.Count(idNode => timage.Id.Equals(idNode.ToString())) != 0) { treeNode.Name += " (trashed)"; } treeNode.MenuUrl = null; nodes.Add(treeNode); } } return(nodes); }
internal async Task OpenTracker() { Debug.WriteLine("==== Open Tracker"); RepositoryManager.Instance.Clear(); _fileCache = new SccProviderSolutionCache(_sccProvider); _fileChangesetManager = new ConcurrentDictionary <GitRepository, GitChangesetManager>(); var solutionFileName = await GetSolutionFileName(); await RepositoryManager.Instance.SetSolutionTracker(solutionFileName); await _statusBarManager.SetActiveRepository(RepositoryManager.Instance.SolutionTracker); await SetSolutionExplorerTitle(); RepositoryName = RepositoryManager.Instance?.SolutionTracker?.Name; if (!string.IsNullOrEmpty(solutionFileName)) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var projects = await SolutionExtensions.GetLoadedControllableProjects(); foreach (var vsSccProject2 in projects) { await AddProject(vsSccProject2 as IVsHierarchy); } } }
internal static async Task <GitActionResult <string> > Commit(GitRepository repository, string message, bool signoff = false) { var result = new GitActionResult <string>(); SolutionExtensions.WriteMessageToOutputPane("Commiting"); if (String.IsNullOrWhiteSpace(message)) { result.Succeeded = false; result.ErrorMessage = ErrorMessages.CommitMissingComment; SolutionExtensions.WriteMessageToOutputPane(ErrorMessages.CommitMissingComment); return(result); } var stagedCount = repository?.ChangedFiles.Count(f => f.IsStaged) ?? 0; if (stagedCount <= 0) { result.Succeeded = false; result.ErrorMessage = ErrorMessages.CommitNoFilesStaged; SolutionExtensions.WriteMessageToOutputPane(ErrorMessages.CommitNoFilesStaged); return(result); } result = repository?.Commit(message, false, signoff); if (result.Succeeded) { SolutionExtensions.WriteMessageToOutputPane("Commit successfully. Commit Hash: " + result.Item); } return(result); }
public async Task AddProject(EnvDTE.Project envProject) { IVsHierarchy projectHierarchy = null; await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); IVsSolution sol = (IVsSolution)_sccProvider.GetService(typeof(SVsSolution)); if (sol.GetProjectOfUniqueName(envProject.UniqueName, out projectHierarchy) == 0) { var project = projectHierarchy as IVsSccProject2; if (project != null) { await AddProject(project); if (!_projects.Contains(project) && project != null) { _projects.Add(project); } var files = SolutionExtensions.GetProjectFiles(envProject).ToList(); foreach (var file in files) { AddFileToList(file.ToLower(), project); } } } }
public void SamplesSolutionNeedsToBeAvailable() { var samplesSolutionFilePath = SolutionExtensions.GetSamplesSolutionFilePath(); Assert.IsTrue(File.Exists(samplesSolutionFilePath)); Assert.IsTrue(samplesSolutionFilePath.Contains(SolutionExtensions.SamplesSolutionFilename)); }
public void GetTutorialsSolutionShouldReturnFilePathFromInstallerFolder() { Environment.CurrentDirectory = @"C:\"; Assert.IsTrue( SolutionExtensions.GetTutorialsSolutionFilePath().Contains( @"DeltaEngine.1.0\OpenTK\Tutorials\DeltaEngine.Tutorials.Basics.sln")); }
public void TutorialsSolutionNeedsToBeAvailable() { var tutorialsSolutionFilePath = SolutionExtensions.GetTutorialsSolutionFilePath(); Assert.IsTrue(File.Exists(tutorialsSolutionFilePath)); Assert.IsTrue( tutorialsSolutionFilePath.Contains(SolutionExtensions.TutorialsSolutionFilename)); }
public void RequestRequild() { int numberOfRequests = service.NumberOfBuildRequests; AppInfo app = AppBuilderTestExtensions.TryGetAlreadyBuiltApp("LogoApp", PlatformName.Windows); app.SolutionFilePath = SolutionExtensions.GetSamplesSolutionFilePath(); viewModel.AppListViewModel.RequestRebuild(app); Assert.AreEqual(numberOfRequests + 1, service.NumberOfBuildRequests); }
private async Task ReloadAllGlyphs() { var projects = await SolutionExtensions.GetLoadedControllableProjects(); await Task.Run(async delegate { await RefreshSolutionGlyphs(); await RefreshProjectGlyphs(projects); }); }
private async Task ScanSolution() { var projects = await SolutionExtensions.GetLoadedControllableProjects(); //TODO MAke sure I want to do this _fileProjectLookup = new ConcurrentDictionary <string, List <IVsSccProject2> >(); foreach (var project in projects) { await AddProject(project); } }
private async void OnAddProjectToSCC(object sender, EventArgs e) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var project = SolutionExtensions.GetSelectedProjectHierarchy() as IVsSccProject2; if (project != null) { await sccService.AddProjectToSourceControl(project); } }
public void GetSpecificCSharpProjectFromDeltaEngineSamplesSolution() { string engineSamplesSolution = SolutionExtensions.GetSamplesSolutionFilePath(); Assert.IsTrue(File.Exists(engineSamplesSolution)); var solutionLoader = new SolutionFileLoader(engineSamplesSolution); ProjectEntry logoAppProject = solutionLoader.GetCSharpProject("LogoApp"); Assert.IsNotNull(logoAppProject); Assert.AreEqual("LogoApp", logoAppProject.Name); }
internal async Task InitRepo() { await GitCommandWrappers.InitRepo(await GetSolutionFileName()); SolutionExtensions.WriteMessageToOutputPane("Enabling SCC Provider"); await OpenTracker(); await EnableSccForSolution(); await ReloadAllGlyphs(); SolutionExtensions.WriteMessageToOutputPane("Done"); }
public async Task AddProject(IVsSccProject2 project) { if (!_projects.Contains(project) && project != null) { _projects.Add(project); } var files = await SolutionExtensions.GetProjectFiles(project); foreach (var file in files) { AddFileToList(file, project); } }
public TImage Convert(uModels.Media uMedia) { TImage image = new TImage() { Id = uMedia.Id.ToString(), Name = uMedia.Name, AbsoluteUrl = SolutionExtensions.GetAbsoluteUrl(uMedia) }; if (string.IsNullOrEmpty(image.AbsoluteUrl)) { image.AbsoluteUrl = _umbracoDbRepository.GetMediaAbsoluteUrl(uMedia.Id); } return(image); }
private void SetupDocumentEvents() { ThreadHelper.ThrowIfNotOnUIThread(); IVsTrackProjectDocuments2 tpdService = (IVsTrackProjectDocuments2)_sccProvider.GetService(typeof(SVsTrackProjectDocuments)); tpdService.AdviseTrackProjectDocumentsEvents(this, out _tpdTrackProjectDocumentsCookie); Debug.Assert(VSConstants.VSCOOKIE_NIL != _tpdTrackProjectDocumentsCookie); var activeIde = SolutionExtensions.GetActiveIDE(); //var activeIde = BasicSccProvider.GetServiceEx<EnvDTE80.DTE2>(); //activeIde.Events.SolutionItemsEvents. _windowEvents = activeIde.Events.WindowEvents; _solutionEvents = activeIde.Events.SolutionEvents; _solutionEvents.ProjectAdded += _solutionEvents_ProjectAdded; _windowEvents.WindowActivated += _windowEvents_WindowActivated; }
public string GetAbsoluteSolutionFilePath(string contentProjectName) { string customFilePath; if (!availableContentWithCodeProjects.TryGetValue(contentProjectName, out customFilePath)) { return(""); } if (!String.IsNullOrEmpty(customFilePath)) { return(customFilePath); } if (contentProjectName.Contains("Tutorials")) { return(SolutionExtensions.GetTutorialsSolutionFilePath()); } return(SolutionExtensions.GetSamplesSolutionFilePath()); }
public void UndoTinify(int mediaId) { byte[] imageBytes; var originImage = _imageHistoryService.Get(mediaId); if (originImage != null) { var mediaFile = _mediaService.GetById(mediaId) as uMedia; if (File.Exists(originImage.OriginFilePath)) { using (var file = new FileStream(originImage.OriginFilePath, FileMode.Open)) imageBytes = SolutionExtensions.ReadFully(file); if (Directory.Exists(Path.GetDirectoryName(originImage.OriginFilePath))) { File.Delete(originImage.OriginFilePath); } var image = new TImage { Id = mediaId.ToString(), Name = mediaFile.Name, AbsoluteUrl = SolutionExtensions.GetAbsoluteUrl(mediaFile) }; // update physical file UpdateMedia(image, imageBytes); // update umbraco media attributes _imageRepository.Update(mediaId, imageBytes.Length); _historyService.Delete(mediaId.ToString()); // update statistic _statisticService.UpdateStatistic(); //delete image history _imageHistoryService.Delete(mediaId); } } else { throw new UndoTinifierException("Image not optimized or Undo tinify not enabled"); } }
public string GetAbsoluteSolutionFilePath(string contentProjectName) { if (String.IsNullOrWhiteSpace(contentProjectName)) { return(""); } if (contentProjects.ContainsKey(contentProjectName)) { return(contentProjects[contentProjectName]); } if (IsStarterKit(contentProjectName)) { return(SolutionExtensions.GetSamplesSolutionFilePath()); } if (IsTutorial(contentProjectName)) { return(SolutionExtensions.GetTutorialsSolutionFilePath()); } return(""); }
internal async Task InitRepo() { await GitCommandWrappers.InitRepo(await GetSolutionFileName()); SolutionExtensions.WriteMessageToOutputPane("Enabling SCC Provider"); await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var projects = await SolutionExtensions.GetLoadedControllableProjects(); SolutionExtensions.WriteMessageToOutputPane("Adding Projects To git"); foreach (var vsSccProject2 in projects) { await AddProjectToSourceControl(vsSccProject2); } await OpenTracker(); await RefreshSolution(); SolutionExtensions.WriteMessageToOutputPane("Done"); }
private byte[] GetImageBytesFromPath(TImage tImage, IFileSystem fs, string path) { byte[] imageBytes; var fileSystem = _fileSystemProviderRepository.GetFileSystem(); if (fileSystem != null) { if (fileSystem.Type.Contains("PhysicalFileSystem")) { path = fs.GetRelativePath(tImage.AbsoluteUrl); } } using (var file = fs.OpenFile(path)) { imageBytes = SolutionExtensions.ReadFully(file); } return(imageBytes); }
internal async Task AddProjectToSourceControl(IVsSccProject2 project) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); string projectName = await GetProjectFileName(project as IVsHierarchy); if (string.IsNullOrEmpty(projectName)) { return; } string projectDirecotry = Path.GetDirectoryName(projectName); var repo = RepositoryManager.Instance.GetTrackerForPath(projectDirecotry); repo.AddFile(projectName); var files = await SolutionExtensions.GetProjectFiles(project); foreach (var file in files) { repo.AddFile(file); } }
private async Task AutoAddProject(Project dteProject) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); var project = await SolutionExtensions.GetIVsHierarchy(dteProject) as IVsSccProject2; if (_solutionLoaded) { if (GitSccOptions.Current.AutoAddProjects && project != null && !SolutionExtensions.IsProjectInGit(dteProject.FullName)) { await AddProjectToSourceControl(project); } //ok To be safe rebuild cache await RefreshSolution(); //if (!_fileCache.ProjectAddedToCache(project)) //{ // await _fileCache.AddProject(project); //} } }
public static async Task InitRepo(string solutionFile) { var solutionPath = Path.GetDirectoryName(solutionFile); SolutionExtensions.WriteMessageToOutputPane("Creating Repo"); GitRepository.Init(solutionPath); SolutionExtensions.WriteMessageToOutputPane("Repo Created"); SolutionExtensions.WriteMessageToOutputPane("Adding .gitignore file"); await IgnoreFileManager.UpdateGitIgnore(solutionPath); //File.WriteAllText(Path.Combine(solutionPath, ".tfignore"), @"\.git"); RepositoryManager.Instance.Clear(); Thread.Sleep(1000); var repo = RepositoryManager.Instance.GetTrackerForPath(solutionFile); if (repo != null) { repo.AddFile(Path.Combine(solutionPath, ".gitignore")); repo.AddFile(solutionFile); } }
internal static async Task <GitActionResult <string> > AmendCommit(GitRepository repository, string message, bool signoff = false) { var result = new GitActionResult <string>(); SolutionExtensions.WriteMessageToOutputPane("Amending Commiti"); if (String.IsNullOrWhiteSpace(message)) { result.Succeeded = false; result.ErrorMessage = ErrorMessages.CommitMissingComment; SolutionExtensions.WriteMessageToOutputPane(ErrorMessages.CommitMissingComment); return(result); } result = repository?.Commit(message, true, signoff); if (result.Succeeded) { SolutionExtensions.WriteMessageToOutputPane("Amend last commit successfully. Commit Hash: " + result.Item); } return(result); }
public HttpResponseMessage GetTImage(string timageId) { TImage timage; try { timage = int.TryParse(timageId, out var imageId) ? _imageService.GetImage(imageId) : _imageService.GetCropImage(SolutionExtensions.Base64Decode(timageId)); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.BadRequest, new TNotification("Tinifier Oops", ex.Message, EventMessageType.Error) { sticky = true, })); } var history = _historyService.GetImageHistory(timage.Id); return(Request.CreateResponse(HttpStatusCode.OK, new { timage, history })); }
internal static async Task <GitActionResult <GitBranchInfo> > SwitchCommand(SwitchBranchInfo result) { if (!result.CreateBranch && !result.Switch) { return(new GitActionResult <GitBranchInfo>() { ErrorMessage = "No Branch Operation", Succeeded = false }); } GitActionResult <GitBranchInfo> branchResult = new GitActionResult <GitBranchInfo>(); bool inError = false; var branch = result.BranchInfo; await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Branch Operation Started"); if (result.CreateBranch) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Creating Branch"); await TaskScheduler.Default; branchResult = result.Repository.CreateBranch(result.BranchName); if (branchResult.Succeeded) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Branch: ' " + branchResult.Item.Name + "' Created"); branch = branchResult.Item; } else { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); inError = true; SolutionExtensions.WriteMessageToOutputPane(branchResult.ErrorMessage); } } if (result.Switch && !inError) { if (branch != null) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Switching Branch"); await TaskScheduler.Default; if (branch.IsRemote) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Creating Local Branch"); var createResult = result.Repository.CreateBranch(branch.Name.Remove(0, branch.RemoteName.Length + 1), branch.Sha); if (!createResult.Succeeded) { return(createResult); } result.Repository.SetRemoteBranch(createResult.Item, branch.RemoteName); branchResult = result.Repository.Checkout(createResult.Item); } else { branchResult = result.Repository.Checkout(branch); } if (!branchResult.Succeeded) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); inError = true; SolutionExtensions.WriteMessageToOutputPane(branchResult.ErrorMessage); } } } if (!inError) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Branch Operation Complete"); } return(branchResult); }
//TODO.. Move this and Commit. I sorta hate it all! internal async Task SwitchCommand(BranchPickerResult result) { if (!result.CreateBranch && !result.Switch) { return; } bool inError = false; var branch = result.BranchInfo; await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Branch Operation Started"); if (result.CreateBranch) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Creating Branch"); //await status.SetMessage("Creating Branch"); await TaskScheduler.Default; var branchResult = result.Repository.CreateBranch(result.BranchName); if (branchResult.Succeeded) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Branch: ' " + branchResult.Item.Name + "' Created"); branch = branchResult.Item; } else { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); inError = true; //status.Hide(); SolutionExtensions.WriteMessageToOutputPane(branchResult.ErrorMessage); MessageBox.Show(branchResult.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } if (result.Switch && !inError) { if (branch != null) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Switching Branch"); await TaskScheduler.Default; var switchResult = result.Repository.Checkout(branch); if (!switchResult.Succeeded) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); inError = true; SolutionExtensions.WriteMessageToOutputPane(switchResult.ErrorMessage); MessageBox.Show(switchResult.ErrorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Exclamation); } } } if (!inError) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); SolutionExtensions.WriteMessageToOutputPane("Branch Operation Complete"); await UpdateRepositoryName(); } }
public async Task QuickRefreshNodesGlyphs(IVsSccProject2 project, List <string> files) { try { if (files.Count > 0) { string[] rgpszFullPaths = new string[files.Count]; for (int i = 0; i < files.Count; i++) { rgpszFullPaths[i] = files[i]; } VsStateIcon[] rgsiGlyphs = new VsStateIcon[files.Count]; uint[] rgdwSccStatus = new uint[files.Count]; GetSccGlyph(files.Count, rgpszFullPaths, rgsiGlyphs, rgdwSccStatus); uint[] rguiAffectedNodes = new uint[files.Count]; //TODO We could/Should cache this mapping !!!! await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); IList <uint> subnodes = await SolutionExtensions.GetProjectItems((IVsHierarchy)project, VSConstants.VSITEMID_ROOT); var dict = new Dictionary <string, uint>(); var proj = project as IVsProject2; foreach (var id in subnodes) { string docname; var res = proj.GetMkDocument(id, out docname); if (res == VSConstants.S_OK && !string.IsNullOrEmpty(docname)) { dict[docname] = id; } } for (int i = 0; i < files.Count; ++i) { uint id; if (dict.TryGetValue(files[i], out id)) { rguiAffectedNodes[i] = id; } } await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); project.SccGlyphChanged(files.Count, rguiAffectedNodes, rgsiGlyphs, rgdwSccStatus); } } catch (Exception ex) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); IVsActivityLog log = _sccProvider.GetService(typeof(SVsActivityLog)) as IVsActivityLog; if (log == null) { return; } int hr = log.LogEntry((UInt32)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, ex.StackTrace, string.Format(CultureInfo.CurrentCulture, "Called for: {0}", this.ToString())); } }
int IOleCommandTarget.QueryStatus(ref Guid guidCmdGroup, uint cCmds, OLECMD[] prgCmds, IntPtr pCmdText) { Debug.Assert(cCmds == 1, "Multiple commands"); Debug.Assert(prgCmds != null, "NULL argument"); if ((prgCmds == null)) { return(VSConstants.E_INVALIDARG); } // Filter out commands that are not defined by this package if (guidCmdGroup != GuidList.guidSccProviderCmdSet) { return((int)(Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED)); } OLECMDF cmdf = OLECMDF.OLECMDF_SUPPORTED; // All source control commands needs to be hidden and disabled when the provider is not active if (!sccService.Active) { cmdf = cmdf | OLECMDF.OLECMDF_INVISIBLE; cmdf = cmdf & ~(OLECMDF.OLECMDF_ENABLED); prgCmds[0].cmdf = (uint)cmdf; return(VSConstants.S_OK); } // Process our Commands switch (prgCmds[0].cmdID) { case CommandId.imnuGitSourceControlMenu: OLECMDTEXT cmdtxtStructure = (OLECMDTEXT)Marshal.PtrToStructure(pCmdText, typeof(OLECMDTEXT)); if (cmdtxtStructure.cmdtextf == (uint)OLECMDTEXTF.OLECMDTEXTF_NAME) { var branchName = sccService.CurrentBranchName; string menuText = string.IsNullOrEmpty(branchName) ? "Git" : "Git (" + branchName + ")"; SetOleCmdText(pCmdText, menuText); } break; case PackageIds.cmdIdAddProjectToSCC: if (SolutionExtensions.CanAddSelectedProjectToGitRepoitory() && sccService.Active) { cmdf |= OLECMDF.OLECMDF_ENABLED; } else { cmdf |= OLECMDF.OLECMDF_INVISIBLE; } break; case CommandId.icmdSccCommandGitBash: //if (GitBash.Exists) //{ cmdf |= OLECMDF.OLECMDF_ENABLED; //} break; case CommandId.icmdSccCommandGitExtension: var gitExtensionPath = GitSccOptions.Current.GitExtensionPath; if (!string.IsNullOrEmpty(gitExtensionPath) && File.Exists(gitExtensionPath) && GitSccOptions.Current.NotExpandGitExtensions) { cmdf |= OLECMDF.OLECMDF_ENABLED; } else { cmdf |= OLECMDF.OLECMDF_INVISIBLE; } break; case CommandId.icmdSccCommandGitTortoise: var tortoiseGitPath = GitSccOptions.Current.TortoiseGitPath; if (!string.IsNullOrEmpty(tortoiseGitPath) && File.Exists(tortoiseGitPath) && GitSccOptions.Current.NotExpandTortoiseGit) { cmdf |= OLECMDF.OLECMDF_ENABLED; } else { cmdf |= OLECMDF.OLECMDF_INVISIBLE; } break; case CommandId.icmdSccCommandUndo: case CommandId.icmdSccCommandCompare: //if (GitBash.Exists && sccService.CanCompareSelectedFile) cmdf |= OLECMDF.OLECMDF_ENABLED; if (sccService.CanCompareSelectedFile) { cmdf |= OLECMDF.OLECMDF_ENABLED; } break; case CommandId.icmdSccCommandEditIgnore: if (sccService.IsSolutionGitControlled) { cmdf |= OLECMDF.OLECMDF_ENABLED; } break; case CommandId.cmdidGitIgnoreSubMenuCommandUpdate: if (sccService.IsSolutionGitControlled) { cmdf |= OLECMDF.OLECMDF_ENABLED; } break; case CommandId.icmdSccCommandHistory: case CommandId.icmdSccCommandPendingChanges: case CommandId.icmdPendingChangesAmend: case CommandId.icmdPendingChangesCommit: case CommandId.icmdPendingChangesCommitToBranch: //if (GitBash.Exists && sccService.IsSolutionGitControlled) cmdf |= OLECMDF.OLECMDF_ENABLED; if (sccService.IsSolutionGitControlled) { cmdf |= OLECMDF.OLECMDF_ENABLED; } break; case CommandId.icmdSccCommandRefresh: //if (sccService.IsSolutionGitControlled) cmdf |= OLECMDF.OLECMDF_ENABLED; break; case CommandId.icmdSccCommandInit: if (!sccService.IsSolutionGitControlled) { cmdf |= OLECMDF.OLECMDF_ENABLED; } else { cmdf |= OLECMDF.OLECMDF_INVISIBLE; } break; case CommandId.icmdPendingChangesSettings: cmdf |= OLECMDF.OLECMDF_ENABLED; break; default: var gitExtPath = GitSccOptions.Current.GitExtensionPath; var torGitPath = GitSccOptions.Current.TortoiseGitPath; if (prgCmds[0].cmdID >= CommandId.icmdGitExtCommand1 && prgCmds[0].cmdID < CommandId.icmdGitExtCommand1 + GitToolCommands.GitExtCommands.Count && !string.IsNullOrEmpty(gitExtPath) && File.Exists(gitExtPath) && !GitSccOptions.Current.NotExpandGitExtensions) { int idx = (int)prgCmds[0].cmdID - CommandId.icmdGitExtCommand1; SetOleCmdText(pCmdText, GitToolCommands.GitExtCommands[idx].Name); cmdf |= OLECMDF.OLECMDF_ENABLED; break; } else if (prgCmds[0].cmdID >= CommandId.icmdGitTorCommand1 && prgCmds[0].cmdID < CommandId.icmdGitTorCommand1 + GitToolCommands.GitTorCommands.Count && !string.IsNullOrEmpty(torGitPath) && File.Exists(torGitPath) && !GitSccOptions.Current.NotExpandTortoiseGit) { int idx = (int)prgCmds[0].cmdID - CommandId.icmdGitTorCommand1; SetOleCmdText(pCmdText, GitToolCommands.GitTorCommands[idx].Name); cmdf |= OLECMDF.OLECMDF_ENABLED; break; } //else if (prgCmds[0].cmdID >= CommandId.icmdGitIgnoreCommand1 && //prgCmds[0].cmdID < CommandId.icmdGitIgnoreCommand1 + GitToolCommands.IgnoreCommands.Count) //{ // int idx = (int)prgCmds[0].cmdID - CommandId.icmdGitTorCommand1; // SetOleCmdText(pCmdText, GitToolCommands.IgnoreCommands[idx]); // cmdf |= OLECMDF.OLECMDF_ENABLED; // break; //} else { return((int)(Microsoft.VisualStudio.OLE.Interop.Constants.OLECMDERR_E_NOTSUPPORTED)); } } prgCmds[0].cmdf = (uint)(cmdf); return(VSConstants.S_OK); }