/// <summary> /// Try to get a message to inform the user which processes have a lock on a given file. /// </summary> private static string GetLockedFileMessage(string file) { string message = string.Empty; #if !RUNTIME_TYPE_NETCORE && !MONO try { var processes = LockCheck.GetProcessesLockingFile(file); message = !string.IsNullOrEmpty(processes) ? ResourceUtilities.FormatResourceStringIgnoreCodeAndKeyword("Copy.FileLocked", processes) : String.Empty; } catch (Exception) { // Never throw if we can't get the processes locking the file. } #endif return(message); }
private static string GetLockedFileMessage(string file) { string message = string.Empty; try { if (NativeMethodsShared.IsWindows && ChangeWaves.AreFeaturesEnabled(ChangeWaves.Wave17_4)) { var processes = LockCheck.GetProcessesLockingFile(file); message = !string.IsNullOrEmpty(processes) ? ResourceUtilities.FormatResourceStringIgnoreCodeAndKeyword("Copy.FileLocked", processes) : String.Empty; } } catch (Exception) { // Never throw if we can't get the processes locking the file. } return(message); }