Changeset 1872 for trunk/eraser6/Eraser.Manager/DirectExecutor.cs
- Timestamp:
- 3/1/2010 9:36:02 AM (2 years ago)
- File:
-
- 1 edited
-
trunk/eraser6/Eraser.Manager/DirectExecutor.cs (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser6/Eraser.Manager/DirectExecutor.cs
r1864 r1872 309 309 throw; 310 310 } 311 catch (SharingViolationException) 312 { 313 } 311 314 catch (ThreadAbortException) 312 315 { … … 331 334 //is executed. This is here mainly to ensure that no BlackBox 332 335 //report is created for this exception. 336 } 337 catch (SharingViolationException) 338 { 333 339 } 334 340 catch (Exception e) … … 674 680 "permissions prevent access to the file.", info.FullName), LogLevel.Error); 675 681 } 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) 692 698 { 693 StringBuilder processStr = new StringBuilder(); 694 foreach (System.Diagnostics.Process process in processes) 699 try 695 700 { 696 try 697 { 698 processStr.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, 699 "{0}, ", process.MainModule.FileName); 700 } 701 catch (System.ComponentModel.Win32Exception) 702 { 703 } 701 processStr.AppendFormat(System.Globalization.CultureInfo.InvariantCulture, 702 "{0}, ", process.MainModule.FileName); 704 703 } 705 706 lockedBy = S._("(locked by {0})", processStr.ToString().Remove(processStr.Length - 2)); 704 catch (System.ComponentModel.Win32Exception) 705 { 706 } 707 707 } 708 708 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 else713 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); 714 714 } 715 715 finally
Note: See TracChangeset
for help on using the changeset viewer.
