static void CheckoutIfControlled(string[] paths, IPlasticAPI api) { List <string> fullPaths = new List <string>(); foreach (string path in paths) { string fullPath = Path.GetFullPath(path); string fullPathMeta = MetaPath.GetMetaPath(fullPath); if (api.GetWorkspaceTreeNode(fullPath) != null) { fullPaths.Add(fullPath); } if (api.GetWorkspaceTreeNode(fullPathMeta) != null) { fullPaths.Add(fullPathMeta); } } if (fullPaths.Count == 0) { return; } api.Checkout( fullPaths.ToArray(), CheckoutModifiers.None); }
internal static void ForWorkspace( WorkspaceInfo wkInfo, IPlasticAPI plasticApi) { RepositoryInfo repInfo = null; IThreadWaiter waiter = ThreadWaiter.GetWaiter(10); waiter.Execute( /*threadOperationDelegate*/ delegate { RepositorySpec repSpec = plasticApi.GetRepositorySpec(wkInfo); repInfo = plasticApi.GetRepositoryInfo(repSpec); }, /*afterOperationDelegate*/ delegate { if (waiter.Exception != null) { ExceptionsHandler.LogException( "SetupCloudProjectId", waiter.Exception); return; } SetupCloudProjectId.ForRepository(repInfo); }); }
internal static void Enable(IPlasticAPI plasticApi) { PlasticAssetsProcessor.RegisterPlasticAPI(plasticApi); AssetPostprocessor.IsEnabled = true; AssetModificationProcessor.IsEnabled = true; }
internal static void ForWorkspace( WorkspaceInfo wkInfo, IPlasticAPI plasticApi) { if (HasCloudProjectId()) { return; } string repGuid = null; IThreadWaiter waiter = ThreadWaiter.GetWaiter(10); waiter.Execute( /*threadOperationDelegate*/ delegate { RepositorySpec repSpec = plasticApi.GetRepositorySpec(wkInfo); RepositoryInfo repInfo = plasticApi.GetRepositoryInfo(repSpec); repGuid = repInfo.GUID.ToString(); }, /*afterOperationDelegate*/ delegate { if (waiter.Exception != null) { ExceptionsHandler.LogException( "SetupCloudProjectId", waiter.Exception); } ConfigureCloudProjectId(repGuid); }); }
internal static void Enable( IPlasticAPI plasticApi, IAssetStatusCache assetStatusCache) { PlasticAssetsProcessor.RegisterPlasticAPI(plasticApi); AssetModificationProcessor.RegisterAssetStatusCache(assetStatusCache); AssetPostprocessor.IsEnabled = true; AssetModificationProcessor.IsEnabled = false; }
internal static WorkspaceInfo InfoForApplicationPath(string path, IPlasticAPI plasticApi) { string wkPath = PathForApplicationPath(path); if (string.IsNullOrEmpty(wkPath)) { return(null); } return(plasticApi.GetWorkspaceFromPath(wkPath)); }
internal static void IfRepositoryIsEmpty( WorkspaceInfo wkInfo, string repository, bool isGluonWorkspace, IPlasticAPI plasticApi, IProgressControls progressControls, ICreateWorkspaceListener createWorkspaceListener, PlasticWindow plasticWindow) { RepositoryInfo repInfo = null; bool isEmptyRepository = false; progressControls.ShowProgress(string.Empty); IThreadWaiter waiter = ThreadWaiter.GetWaiter(10); waiter.Execute( /*threadOperationDelegate*/ delegate { RepositorySpec repSpec = new SpecGenerator(). GenRepositorySpec(false, repository); repInfo = plasticApi.GetRepositoryInfo(repSpec); isEmptyRepository = IsEmptyRepositoryCondition. Evaluate(wkInfo, repSpec, plasticApi); }, /*afterOperationDelegate*/ delegate { progressControls.HideProgress(); if (waiter.Exception != null) { DisplayException(progressControls, waiter.Exception); return; } if (!SetupCloudProjectId.HasCloudProjectId()) { SetupCloudProjectId.ForRepository(repInfo); } if (!isEmptyRepository) { plasticWindow.RefreshWorkspaceUI(); AssetMenu.AssetMenuItems.Enable(); return; } CheckinPackagesAndProjectSettingsFolders( wkInfo, isGluonWorkspace, plasticApi, progressControls, createWorkspaceListener); }); }
static void DeleteIfControlled( string fullPath, IPlasticAPI api) { if (api.GetWorkspaceTreeNode(fullPath) == null) { return; } api.DeleteControlled( fullPath, DeleteModifiers.None); }
static void SetupCloudProjectIdIfNeeded( WorkspaceInfo wkInfo, IPlasticAPI plasticApi) { if (SetupCloudProjectId.HasCloudProjectId()) { return; } SetupCloudProjectId.ForWorkspace(wkInfo, plasticApi); mLog.DebugFormat("Setup CloudProjectId on Project: {0}", wkInfo.ClientPath); }
static void MoveIfControlled( string srcFullPath, string dstFullPath, IPlasticAPI api) { if (api.GetWorkspaceTreeNode(srcFullPath) == null) { return; } api.Move( srcFullPath, dstFullPath, MoveModifiers.None); }
static void PerformAdd( List <string> paths, IPlasticAPI plasticApi) { AddOptions options = new AddOptions(); options.AddPrivateParents = true; options.CheckoutParent = true; options.Recurse = true; options.SearchForPrivatePaths = true; options.SkipIgnored = true; IList checkouts; plasticApi.Add(paths.ToArray(), options, out checkouts); }
static void AddIfNotControlled( string[] paths, IPlasticAPI api) { List <string> fullPaths = new List <string>(); IgnoredFilesFilter ignoredFilter = new IgnoredFilesFilter( GlobalConfig.Instance); foreach (string path in paths) { string fullPath = Path.GetFullPath(path); string fullPathMeta = MetaPath.GetMetaPath(fullPath); if (api.GetWorkspaceFromPath(fullPath) == null) { return; } if (api.GetWorkspaceTreeNode(fullPath) == null && !ignoredFilter.IsIgnored(fullPath)) { fullPaths.Add(fullPath); } if (File.Exists(fullPathMeta) && api.GetWorkspaceTreeNode(fullPathMeta) == null && !ignoredFilter.IsIgnored(fullPath)) { fullPaths.Add(fullPathMeta); } } if (fullPaths.Count == 0) { return; } IList checkouts; api.Add( fullPaths.ToArray(), GetDefaultAddOptions(), out checkouts); }
static void CheckinPackagesAndProjectSettingsFolders( WorkspaceInfo wkInfo, bool isGluonWorkspace, IPlasticAPI plasticApi, IProgressControls progressControls, ICreateWorkspaceListener createWorkspaceListener) { List <string> paths = new List <string> { Path.Combine(wkInfo.ClientPath, "Packages"), Path.Combine(wkInfo.ClientPath, "ProjectSettings") }; string comment = PlasticLocalization.GetString( PlasticLocalization.Name.UnityInitialCheckinComment); progressControls.ShowProgress(PlasticLocalization.GetString( PlasticLocalization.Name.UnityInitialCheckinProgress)); IThreadWaiter waiter = ThreadWaiter.GetWaiter(10); waiter.Execute( /*threadOperationDelegate*/ delegate { PerformAdd(paths, plasticApi); PerformCheckinForMode( wkInfo, paths, comment, isGluonWorkspace); }, /*afterOperationDelegate*/ delegate { progressControls.HideProgress(); if (waiter.Exception != null && !IsMergeNeededException(waiter.Exception)) { DisplayException(progressControls, waiter.Exception); return; } createWorkspaceListener.OnWorkspaceCreated( wkInfo, isGluonWorkspace); }); }
internal static void IfWorkspaceConfigChanged( IPlasticAPI plasticApi, WorkspaceInfo lastWkInfo, bool lastIsGluonMode, Action reloadAction) { string applicationPath = Application.dataPath; bool isGluonMode = false; WorkspaceInfo wkInfo = null; IThreadWaiter waiter = ThreadWaiter.GetWaiter(10); waiter.Execute( /*threadOperationDelegate*/ delegate { wkInfo = FindWorkspace. InfoForApplicationPath(applicationPath, plasticApi); if (wkInfo != null) { isGluonMode = plasticApi.IsGluonWorkspace(wkInfo); } }, /*afterOperationDelegate*/ delegate { if (waiter.Exception != null) { return; } if (!IsWorkspaceConfigChanged( lastWkInfo, wkInfo, lastIsGluonMode, isGluonMode)) { return; } reloadAction(); }); }
static void CheckoutIfControlledAndChanged(string[] paths, IPlasticAPI api) { List <string> fullPaths = new List <string>(); foreach (string path in paths) { string fullPath = Path.GetFullPath(path); string fullPathMeta = MetaPath.GetMetaPath(fullPath); WorkspaceTreeNode node = api.GetWorkspaceTreeNode(fullPath); WorkspaceTreeNode nodeMeta = api.GetWorkspaceTreeNode(fullPathMeta); if (node != null && ChangedFileChecker.IsChanged( node.LocalInfo, fullPath, false)) { fullPaths.Add(fullPath); } if (nodeMeta != null && ChangedFileChecker.IsChanged( nodeMeta.LocalInfo, fullPathMeta, false)) { fullPaths.Add(fullPathMeta); } } if (fullPaths.Count == 0) { return; } api.Checkout( fullPaths.ToArray(), CheckoutModifiers.None); }
internal static void RegisterPlasticAPI(IPlasticAPI plasticAPI) { mPlasticAPI = plasticAPI; }