private AttemptMove ( string Source, string Target ) : bool | ||
Source | string | |
Target | string | |
Résultat | bool |
private bool AttemptMove( string Source, string Target ) {
bool MoveSuccessful = false;
if ( IsWinNT ) {
// We can only call this when we have kernel32.dll
MoveSuccessful = UnsafeNativeMethods.MoveFileEx(
Source,
Target,
UnsafeNativeMethods.MOVEFILE_REPLACE_EXISTING );
}
else {
try {
File.Move(Source, Target);
MoveSuccessful = true;
}
catch {
MoveSuccessful = false;
}
}
return MoveSuccessful;
}