public static bool IsOpenForEdit(string assetPath, out string message, StatusQueryOptions statusOptions) { message = ""; bool result; if (!Provider.enabled) { result = true; } else if (string.IsNullOrEmpty(assetPath)) { result = true; } else { Asset asset; if (statusOptions == StatusQueryOptions.UseCachedIfPossible || statusOptions == StatusQueryOptions.UseCachedAsync) { AssetModificationHook.CachedStatusMode mode = (statusOptions != StatusQueryOptions.UseCachedAsync) ? AssetModificationHook.CachedStatusMode.Sync : AssetModificationHook.CachedStatusMode.Async; asset = AssetModificationHook.GetStatusCachedIfPossible(assetPath, mode); } else { asset = AssetModificationHook.GetStatusForceUpdate(assetPath); } if (asset == null) { if (Provider.onlineState == OnlineState.Offline && Provider.offlineReason != string.Empty) { message = Provider.offlineReason; } result = false; } else { result = Provider.IsOpenForEdit(asset); } } return(result); }
public static bool IsOpenForEdit(string assetPath, out string message, StatusQueryOptions statusOptions) { message = ""; bool result; if (!Provider.enabled) { result = true; } else if (string.IsNullOrEmpty(assetPath)) { result = true; } else { Asset asset = (statusOptions != StatusQueryOptions.UseCachedIfPossible) ? AssetModificationHook.GetStatusForceUpdate(assetPath) : AssetModificationHook.GetStatusCachedIfPossible(assetPath); result = (asset != null && Provider.IsOpenForEdit(asset)); } return(result); }