private void OnStatusCompleted() { //OnNextUpdate.Do(() => D.Log("Status Updatees : " + (StatusCompleted != null ? StatusCompleted.GetInvocationList().Length : 0) + "\n" + StatusCompleted.GetInvocationList().Select(i => (i.Target ?? "") + ":" + i.Method.ToString()).Aggregate((a, b) => a + "\n" + b))); if (StatusCompleted != null) { OnNextUpdate.Do(StatusCompleted); } AssetDatabaseRefreshManager.RefreshAssetDatabase(); }
public bool Delete(IEnumerable <string> assets, OperationMode mode = OperationMode.Force) { return(HandleExceptions(() => { var beforeStatus = StoreCurrentStatus(assets); if (!OnOperationStarting(OperationType.Delete, beforeStatus)) { return false; } bool filesOSDeleted = false; var deleteAssets = new List <string>(); foreach (string assetIt in assets) { var metaAsset = assetIt + VCCAddMetaFiles.metaStr; if (GetAssetStatus(assetIt).fileStatus != VCFileStatus.Unversioned) { deleteAssets.Add(metaAsset); deleteAssets.Add(assetIt); } else { if (File.Exists(metaAsset)) { File.SetAttributes(metaAsset, FileAttributes.Normal); File.Delete(metaAsset); filesOSDeleted = true; } if (File.Exists(assetIt)) { File.SetAttributes(assetIt, FileAttributes.Normal); File.Delete(assetIt); filesOSDeleted = true; } if (Directory.Exists(assetIt)) { foreach (var subDirFile in Directory.GetFiles(assetIt, "*", SearchOption.AllDirectories)) { File.SetAttributes(subDirFile, FileAttributes.Normal); File.Delete(subDirFile); } Directory.Delete(assetIt, true); filesOSDeleted = true; } } } bool result = vcc.Delete(deleteAssets, mode); AssetDatabaseRefreshManager.RequestAssetDatabaseRefresh(); if (filesOSDeleted) { AssetDatabaseRefreshManager.RefreshAssetDatabase(); } var afterStatus = StoreCurrentStatus(assets); OnOperationCompleted(OperationType.Delete, beforeStatus, afterStatus, result || filesOSDeleted); return result; })); }
public bool Revert(IEnumerable <string> assets) { return(HandleExceptions(() => { FlushFiles(); //assets = assets.Concat(assets.Select(vcc.GetAssetStatus).Where(status => !ComposedString.IsNullOrEmpty(status.movedFrom)).Select(status => status.movedFrom.Compose()) ).ToArray(); Status(assets, StatusLevel.Local); var beforeStatus = StoreCurrentStatus(assets); if (!OnOperationStarting(OperationType.Revert, beforeStatus)) { return false; } bool revertSuccess = vcc.Revert(assets); Status(assets, StatusLevel.Local); AssetDatabaseRefreshManager.RequestAssetDatabaseRefresh(); if (revertSuccess) { AssetDatabaseRefreshManager.RefreshAssetDatabase(); } var afterStatus = StoreCurrentStatus(assets); OnOperationCompleted(OperationType.Revert, beforeStatus, afterStatus, revertSuccess); return revertSuccess; })); }