| 676 | | catch (IOException) |
| 677 | | { |
| 678 | | if (System.Runtime.InteropServices.Marshal.GetLastWin32Error() == |
| 679 | | Win32ErrorCode.SharingViolation) |
| 680 | | { |
| 681 | | if (!ManagerLibrary.Settings.ForceUnlockLockedFiles) |
| 682 | | throw; |
| 683 | | |
| 684 | | List<System.Diagnostics.Process> processes = |
| 685 | | new List<System.Diagnostics.Process>(); |
| 686 | | foreach (OpenHandle handle in OpenHandle.Items) |
| 687 | | if (handle.Path == paths[i]) |
| 688 | | processes.Add(System.Diagnostics.Process.GetProcessById(handle.ProcessId)); |
| 689 | | |
| 690 | | string lockedBy = null; |
| 691 | | if (processes.Count > 0) |
| | 682 | catch (SharingViolationException) |
| | 683 | { |
| | 684 | if (!ManagerLibrary.Settings.ForceUnlockLockedFiles) |
| | 685 | throw; |
| | 686 | |
| | 687 | List<System.Diagnostics.Process> processes = |
| | 688 | new List<System.Diagnostics.Process>(); |
| | 689 | foreach (OpenHandle handle in OpenHandle.Items) |
| | 690 | if (handle.Path == paths[i]) |
| | 691 | processes.Add(System.Diagnostics.Process.GetProcessById(handle.ProcessId)); |
| | 692 | |
| | 693 | string lockedBy = null; |
| | 694 | if (processes.Count > 0) |
| | 695 | { |
| | 696 | StringBuilder processStr = new StringBuilder(); |
| | 697 | foreach (System.Diagnostics.Process process in processes) |
| 709 | | Logger.Log(S._("Could not force closure of file \"{0}\" {1}", paths[i], |
| 710 | | lockedBy == null ? string.Empty : lockedBy).Trim(), LogLevel.Error); |
| 711 | | } |
| 712 | | else |
| 713 | | throw; |
| | 709 | lockedBy = S._("(locked by {0})", processStr.ToString().Remove(processStr.Length - 2)); |
| | 710 | } |
| | 711 | |
| | 712 | Logger.Log(S._("Could not force closure of file \"{0}\" {1}", paths[i], |
| | 713 | lockedBy == null ? string.Empty : lockedBy).Trim(), LogLevel.Error); |