static bool IsOpenForEdit(string assetPath, out string message) { message = string.Empty; if (!IsEnabled) { return(true); } if (assetPath.StartsWith("ProjectSettings/")) { return(true); } if (ForceCheckout) { return(true); } if (MetaPath.IsMetaPath(assetPath)) { assetPath = MetaPath.GetPathFromMetaPath(assetPath); } AssetStatus status = mAssetStatusCache.GetStatusForPath( Path.GetFullPath(assetPath)); if (ClassifyAssetStatus.IsAdded(status) || ClassifyAssetStatus.IsCheckedOut(status)) { return(true); } return(!ClassifyAssetStatus.IsControlled(status)); }
static bool IsConflicted( bool isGluonMode, IAssetStatusCache assetStatusCache, string fullPath) { if (!isGluonMode) { return(false); } return(ClassifyAssetStatus.IsConflicted( assetStatusCache.GetStatusForPath(fullPath))); }
AssetStatus IAssetStatusCache.GetStatusForPath(string fullPath) { AssetStatus localStatus = mLocalStatusCache.GetStatus(fullPath); if (!ClassifyAssetStatus.IsControlled(localStatus)) { return(localStatus); } AssetStatus remoteStatus = mRemoteStatusCache.GetStatus(fullPath); AssetStatus lockStatus = mLockStatusCache.GetStatus(fullPath); return(localStatus | remoteStatus | lockStatus); }
internal static SelectedAssetGroupInfo BuildFromSingleFile( string path, bool isDirectory, IAssetStatusCache statusCache) { bool isCheckedInSelection = true; bool isControlledSelection = true; bool isCheckedOutSelection = true; bool isPrivateSelection = true; bool isAddedSelection = true; bool isFileSelection = true; bool hasAnyAddedInSelection = false; bool hasAnyRemoteLockedInSelection = false; string assetPath = Path.GetFullPath(path); WorkspaceTreeNode wkTreeNode = PlasticGui.Plastic.API.GetWorkspaceTreeNode(assetPath); if (isDirectory) { isFileSelection = false; } if (CheckWorkspaceTreeNodeStatus.IsPrivate(wkTreeNode)) { isControlledSelection = false; } else { isPrivateSelection = false; } if (CheckWorkspaceTreeNodeStatus.IsCheckedOut(wkTreeNode)) { isCheckedInSelection = false; } else { isCheckedOutSelection = false; } if (CheckWorkspaceTreeNodeStatus.IsAdded(wkTreeNode)) { hasAnyAddedInSelection = true; } else { isAddedSelection = false; } AssetsOverlays.AssetStatus assetStatus = statusCache.GetStatusForPath(assetPath); if (ClassifyAssetStatus.IsLockedRemote(assetStatus)) { hasAnyRemoteLockedInSelection = true; } return(new SelectedAssetGroupInfo() { IsCheckedInSelection = isCheckedInSelection, IsCheckedOutSelection = isCheckedOutSelection, IsControlledSelection = isControlledSelection, IsPrivateSelection = isPrivateSelection, IsAddedSelection = isAddedSelection, IsFileSelection = isFileSelection, HasAnyAddedInSelection = hasAnyAddedInSelection, HasAnyRemoteLockedInSelection = hasAnyRemoteLockedInSelection, SelectedCount = 1, }); }
internal static SelectedPathsGroupInfo GetSelectedPathsGroupInfo( AssetList selectedAssets, IAssetStatusCache assetStatusCache) { SelectedPathsGroupInfo result = new SelectedPathsGroupInfo(); if (selectedAssets.Count == 0) { return(result); } result.SelectedCount = selectedAssets.Count; result.IsRootSelected = false; result.IsCheckedoutEverySelected = true; result.IsDirectoryEverySelected = true; result.IsCheckedinEverySelected = true; result.IsChangedEverySelected = true; Asset firstAsset = selectedAssets[0]; string firstAssetName = GetAssetName(firstAsset); AssetStatus firstStatus = GetAssetStatus( firstAsset, assetStatusCache); result.FirstIsControlled = ClassifyAssetStatus.IsControlled(firstStatus); result.FirstIsDirectory = firstAsset.isFolder; result.FilterInfo.CommonName = firstAssetName; result.FilterInfo.CommonExtension = Path.GetExtension(firstAssetName); result.FilterInfo.CommonFullPath = firstAsset.assetPath; foreach (Asset asset in selectedAssets) { string assetName = GetAssetName(asset); AssetStatus status = GetAssetStatus( asset, assetStatusCache); result.IsCheckedoutEverySelected &= ClassifyAssetStatus.IsCheckedOut(status); result.IsDirectoryEverySelected &= asset.isFolder; result.IsCheckedinEverySelected &= false; // TODO: not implemented yet result.IsChangedEverySelected &= false; // TODO: not implemented yet result.IsAnyDirectorySelected |= asset.isFolder; result.IsAnyPrivateSelected |= ClassifyAssetStatus.IsPrivate(status); result.FilterInfo.IsAnyIgnoredSelected |= ClassifyAssetStatus.IsIgnored(status); result.FilterInfo.IsAnyHiddenChangedSelected |= ClassifyAssetStatus.IsHiddenChanged(status); if (result.SelectedCount == 1) { continue; } if (result.FilterInfo.CommonName != assetName) { result.FilterInfo.CommonName = null; } if (result.FilterInfo.CommonExtension != Path.GetExtension(assetName)) { result.FilterInfo.CommonExtension = null; } if (result.FilterInfo.CommonFullPath != asset.assetPath) { result.FilterInfo.CommonFullPath = null; } } return(result); }