PO/Library/Artifacts/a9/a9e1e42fe947deb2eb52b62e5be...

233 lines
12 KiB
Plaintext
Raw Normal View History

2022-01-12 10:06:03 +03:00
<0F>.42019.4.19f1<00><><EFBFBD><EFBFBD> <00><>f<EFBFBD><66>!<21>5<>9<EFBFBD>4Q<0E><>B<00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00> E<00> <00><00>#<00>.<00>,<00>5a<00> <00><00>#<00>.<00>,<00><00><00>r<00> <00><00># <00>.<00>,
<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00> Q<00>j<00><00><00>J<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><00>\<00><00><><EFBFBD><EFBFBD><EFBFBD><00>H<00>r<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00>w<00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>H<00><><00><><EFBFBD><EFBFBD><00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00>#!<00>.<00>,"<00><00><><00><><EFBFBD><EFBFBD>#@1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>$<00><00><00>%.<00>j<00>&<00><00><><00><><EFBFBD><EFBFBD>'<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>(<00><00><00><00>)<00>j<00><><EFBFBD><EFBFBD><EFBFBD>*<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD>+<00>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>,@<00><00><00>-Q<00>j<00>.y<00>
<00> /<00><00>#0<00>.<00>,1<00> <00><>2@<00><00><> 3@<00><00>#4<00>.<00>,5<00>H<00><><00><><EFBFBD><EFBFBD>6<01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>7@<00><00><00>8Q<00>j<00>9H<00><><00><><EFBFBD><EFBFBD>:<01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>;@<00><00><00><Q<00>j<00>=H<00><><00><><EFBFBD><EFBFBD>><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>?@<00><00><00>@Q<00>j<00>AMonoImporterPPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_ExternalObjectsSourceAssetIdentifiertypeassemblynamem_UsedFileIDsm_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariants<00><><EFBFBD>G<EFBFBD><47>܏Z56<35>:!@i<>J*<00><00>7<00><><EFBFBD><EFBFBD><EFBFBD><00><00><00><><00>E<00> <00><00><00>.<00><00>(a<00> <00><00><00>.<00><00><00><00>r<00> <00><00> <00>.<00>
<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD> <01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD> @<00><00><00> Q<00>j<00>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00><00><00>=<00><><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD><01><00><00><00><00>j<00><><EFBFBD><EFBFBD><EFBFBD><01>H<00><><00><><EFBFBD><EFBFBD><EFBFBD><01>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>@<00><00><00>Q<00>j<00>y<00>
<00> <00><00><00>.<00><00>y<00>Q <00><00><00>.<00> <00><00><00>X!H<00>i<00><><EFBFBD><EFBFBD>"<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>#@<00><00><00>$Q<00>j<00>%H<00>u<00><><EFBFBD><EFBFBD>&<10>1<00>1<00><><EFBFBD><EFBFBD><EFBFBD>'@<00><00><00>(Q<00>j<00>)PPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespace\<00>y<EFBFBD>`<00><00>y<EFBFBD>AssetMenuOperations^using System;
using System.IO;
using UnityEditor.VersionControl;
using Codice;
using Codice.Client.Commands.WkTree;
using PlasticGui;
using Unity.PlasticSCM.Editor.AssetsOverlays.Cache;
using Unity.PlasticSCM.Editor.AssetsOverlays;
namespace Unity.PlasticSCM.Editor.AssetMenu
{
[Flags]
internal enum AssetMenuOperations : byte
{
None = 0,
Checkout = 1 << 0,
Diff = 1 << 1,
History = 1 << 2,
Add = 1 << 3,
Checkin = 1 << 4,
Undo = 1 << 5,
}
internal class SelectedAssetGroupInfo
{
internal int SelectedCount;
internal bool IsControlledSelection;
internal bool IsCheckedInSelection;
internal bool IsCheckedOutSelection;
internal bool IsPrivateSelection;
internal bool IsAddedSelection;
internal bool IsFileSelection;
internal bool HasAnyAddedInSelection;
internal bool HasAnyRemoteLockedInSelection;
internal static SelectedAssetGroupInfo BuildFromAssetList(
AssetList assetList,
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;
int selectedCount = 0;
foreach (Asset asset in assetList)
{
if (string.IsNullOrEmpty(asset.path))
continue;
SelectedAssetGroupInfo singleFileGroupInfo = BuildFromSingleFile(
asset.path,
asset.isFolder,
statusCache);
if (!singleFileGroupInfo.IsCheckedInSelection)
isCheckedInSelection = false;
if (!singleFileGroupInfo.IsControlledSelection)
isControlledSelection = false;
if (!singleFileGroupInfo.IsCheckedOutSelection)
isCheckedOutSelection = false;
if (!singleFileGroupInfo.IsPrivateSelection)
isPrivateSelection = false;
if (!singleFileGroupInfo.IsAddedSelection)
isAddedSelection = false;
if (!singleFileGroupInfo.IsFileSelection)
isFileSelection = false;
if (singleFileGroupInfo.HasAnyAddedInSelection)
hasAnyAddedInSelection = true;
if (singleFileGroupInfo.HasAnyRemoteLockedInSelection)
hasAnyRemoteLockedInSelection = true;
selectedCount++;
}
return new SelectedAssetGroupInfo()
{
IsCheckedInSelection = isCheckedInSelection,
IsCheckedOutSelection = isCheckedOutSelection,
IsControlledSelection = isControlledSelection,
IsPrivateSelection = isPrivateSelection,
IsAddedSelection = isAddedSelection,
IsFileSelection = isFileSelection,
HasAnyAddedInSelection = hasAnyAddedInSelection,
HasAnyRemoteLockedInSelection = hasAnyRemoteLockedInSelection,
SelectedCount = selectedCount,
};
}
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 interface IAssetMenuOperations
{
void ShowPendingChanges();
void Add();
void Checkout();
void Checkin();
void Undo();
void ShowDiff();
void ShowHistory();
}
internal static class AssetMenuUpdater
{
internal static AssetMenuOperations GetAvailableMenuOperations(
SelectedAssetGroupInfo info)
{
AssetMenuOperations result = AssetMenuOperations.None;
if (info.SelectedCount == 0)
{
return result;
}
if (info.IsControlledSelection &&
info.IsCheckedInSelection &&
info.IsFileSelection &&
!info.HasAnyRemoteLockedInSelection)
{
result |= AssetMenuOperations.Checkout;
}
if (info.IsFileSelection &&
info.IsPrivateSelection)
{
result |= AssetMenuOperations.Add;
}
if (info.IsFileSelection &&
info.IsControlledSelection &&
info.IsCheckedOutSelection)
{
result |= AssetMenuOperations.Checkin;
result |= AssetMenuOperations.Undo;
}
if (info.SelectedCount == 1 &&
info.IsControlledSelection &&
!info.HasAnyAddedInSelection &&
info.IsFileSelection)
{
result |= AssetMenuOperations.Diff;
}
if (info.SelectedCount == 1 &&
info.IsControlledSelection &&
!info.HasAnyAddedInSelection)
{
result |= AssetMenuOperations.History;
}
return result;
}
}
}
AssetMenuOperations