private static void OnStatusUpdated() { if (SourceControlStatusCache.StatusUpdated != null) { SourceControlStatusCache.StatusUpdated(null, new EventArgs()); } }
public static void SetCachedStatus(IEnumerable <DocumentReference> items, SourceControlStatus status) { foreach (DocumentReference item in items) { SourceControlStatusCache.SetCachedStatusInternal(item, status); } SourceControlStatusCache.OnStatusUpdated(); }
internal static void UpdateStatus(IEnumerable <IDocumentItem> items, ISourceControlProvider sourceControlProvider) { if (sourceControlProvider == null) { return; } SourceControlStatusCache.UpdateStatus( from item in items where !item.IsReference select item.DocumentReference, sourceControlProvider); }
void Microsoft.Expression.Framework.Documents.IDocumentContainer.BeginCheckDocumentStatus(IDocument document) { ISolution currentSolution = base.Services.ProjectManager().CurrentSolution; if (currentSolution != null && currentSolution.IsSourceControlActive && SourceControlStatusCache.GetCachedStatus(this) == SourceControlStatus.CheckedIn) { ISourceControlProvider sourceControlProvider = base.Services.SourceControlProvider(); string[] path = new string[] { base.DocumentReference.Path }; if (sourceControlProvider.Checkout(path) == SourceControlSuccess.Success) { SourceControlStatusCache.SetCachedStatus(this, SourceControlStatus.CheckedOut); } } }
internal static void UpdateStatus(IEnumerable <DocumentReference> items, ISourceControlProvider sourceControlProvider) { if (items.CountIs <DocumentReference>(0) || sourceControlProvider == null) { return; } DocumentReference[] array = ( from item in items where PathHelper.FileExists(item.Path) select item).ToArray <DocumentReference>(); SourceControlStatus[] sourceControlStatusArray = new SourceControlStatus[(int)array.Length]; sourceControlProvider.QueryInfo(( from path in (IEnumerable <DocumentReference>) array select path.Path).ToArray <string>(), sourceControlStatusArray); for (int i = 0; i < (int)array.Length; i++) { SourceControlStatusCache.SetCachedStatusInternal(array[i], sourceControlStatusArray[i]); } SourceControlStatusCache.OnStatusUpdated(); }
internal static void UpdateSourceControl(IEnumerable <DocumentReference> paths, UpdateSourceControlActions updateSourceControlAction, IProjectActionContext context) { if (context == null) { return; } IProjectManager projectManager = context.ServiceProvider.ProjectManager(); if (projectManager == null) { return; } ISolution currentSolution = projectManager.CurrentSolution; if (currentSolution == null || !currentSolution.IsSourceControlActive) { return; } SourceControlStatusCache.UpdateStatus(paths, context.ServiceProvider.SourceControlProvider()); IEnumerable <DocumentReference> documentReferences = paths.Where <DocumentReference>((DocumentReference path) => { if (!context.IsSourceControlled(path)) { return(false); } return(PathHelper.FileExists(path.Path)); }); IEnumerable <DocumentReference> documentReferences1 = Enumerable.Empty <DocumentReference>(); if ((updateSourceControlAction & UpdateSourceControlActions.Checkout) == UpdateSourceControlActions.Checkout) { IEnumerable <DocumentReference> cachedStatus = from path in documentReferences where SourceControlStatusCache.GetCachedStatus(path) == SourceControlStatus.CheckedIn select path; if (context.ServiceProvider.SourceControlProvider().Checkout(( from path in cachedStatus select path.Path).ToArray <string>()) != SourceControlSuccess.Success) { documentReferences1.Concat <DocumentReference>(cachedStatus); } else { SourceControlStatusCache.SetCachedStatus(cachedStatus, SourceControlStatus.CheckedOut); foreach (DocumentReference cachedStatu in cachedStatus) { ProjectLog.LogSuccess(cachedStatu.Path, StringTable.MakeWritableAction, new object[0]); } } } if ((updateSourceControlAction & UpdateSourceControlActions.PendAdd) == UpdateSourceControlActions.PendAdd) { IEnumerable <DocumentReference> cachedStatus1 = from path in documentReferences where SourceControlStatusCache.GetCachedStatus(path) == SourceControlStatus.None select path; if (context.ServiceProvider.SourceControlProvider().Add(( from path in cachedStatus1 select path.Path).ToArray <string>()) != SourceControlSuccess.Success) { documentReferences1.Concat <DocumentReference>(cachedStatus1); } else { SourceControlStatusCache.SetCachedStatus(cachedStatus1, SourceControlStatus.Add); } } SourceControlStatusCache.UpdateStatus(documentReferences1, context.ServiceProvider.SourceControlProvider()); }
public static void SetCachedStatus(DocumentReference item, SourceControlStatus status) { SourceControlStatusCache.SetCachedStatusInternal(item, status); SourceControlStatusCache.OnStatusUpdated(); }
public static SourceControlStatus GetCachedStatus(IDocumentItem item) { return(SourceControlStatusCache.GetCachedStatus(item.DocumentReference)); }
internal static void ClearStatusCache() { SourceControlStatusCache.statusCache.Clear(); SourceControlStatusCache.OnStatusUpdated(); }