Ejemplo n.º 1
0
 internal static extern bool MoveFileTransacted(
     [In] string lpExistingFileName,
     [In] string lpNewFileName,
     [In] IntPtr lpProgressRoutine,
     [In] IntPtr lpData,
     [In] MoveFileFlags dwFlags,
     [In] KtmTransactionHandle hTransaction);
Ejemplo n.º 2
0
 public static void MoveFile(string existingFileName, string newFileName, MoveFileFlags flags)
 {
     if (!MoveFileEx(existingFileName, newFileName, (uint)flags))
     {
         ThrowLastWin32Exception();
     }
 }
Ejemplo n.º 3
0
 internal static extern bool MoveFileTransacted(
     [In, MarshalAs(UnmanagedType.LPWStr)] string lpExistingFileName
     , [In, MarshalAs(UnmanagedType.LPWStr)] string lpNewFileName
     , [In] IntPtr lpProgressRoutine
     , [In] IntPtr lpData
     , [In] MoveFileFlags dwFlags
     , [In] KtmTransactionHandle hTransaction);
Ejemplo n.º 4
0
 public static void MoveFile(string existingFileName, string newFileName, MoveFileFlags flags)
 {
     if (!MoveFileEx(existingFileName, newFileName, (uint)flags))
     {
         ThrowLastWin32Exception($"Failed to move '{existingFileName}' to '{newFileName}'");
     }
 }
Ejemplo n.º 5
0
        private void buttonExecute_Click(object sender, EventArgs e)
        {
            string        sourcePath = this.textBoxSourceFileName.Text;
            string        targetPath = (this.checkBoxIsNull.Checked) ? null : Path.Combine(this.textBoxTargetFolder.Text, Path.GetFileName(sourcePath));
            MoveFileFlags flags      = GetMoveFileOptions();

            var result = NativeMethods.MoveFileEx(sourcePath, targetPath, flags);

            if (result)
            {
                MessageBox.Show("Success!");
            }
            else
            {
                MessageBox.Show($"Failed (0x{NativeMethods.GetLastError():x8})");
            }
        }
Ejemplo n.º 6
0
        // hook function
        public static bool MoveFileExW_Hook(
            string lpExistingFileName,
            string lpNewFileName,
            MoveFileFlags dwFlags)
        {
            try
            {
                if ((lpExistingFileName != null) || (lpExistingFileName.Length > 0))
                {
                    if ((lpNewFileName != null) || (lpNewFileName.Length > 0))
                    {
                        reportEvent(MoveFileExWStr, lpExistingFileName, lpNewFileName);
                    }
                }
            }
            catch
            {
                // swallow exceptions so that any issues caused by this code do not crash target process
            }

            return(MoveFileW(lpExistingFileName, lpNewFileName));
        }
 internal static extern bool MoveFileEx(string srcFileName, string destFileName, MoveFileFlags flags);
Ejemplo n.º 8
0
 private static extern bool MoveFileEx(string lpExistFileName, string lpNewFileName, MoveFileFlags flags);
Ejemplo n.º 9
0
 static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags);
Ejemplo n.º 10
0
 internal static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags);  //Mark for deletion
 private static bool MoveFileEx(string source, string destination, MoveFileFlags flags)
 {
     return(Kernel32.MoveFileEx(source, destination, flags));
 }
Ejemplo n.º 12
0
 public static extern bool MoveFileExW([In, MarshalAs(LPWStr)] string lpExistingFileName, [In, MarshalAs(LPWStr)] string lpNewFileName, [In, MarshalAs(U4)] MoveFileFlags dwFlags);
Ejemplo n.º 13
0
 public static extern bool MoveFileEx(
     string lpExistingFilename, string lpNewFileName, MoveFileFlags flags);
Ejemplo n.º 14
0
 public static extern Boolean MoveFileWithProgress([NotNull] String lpExistingFileName, [NotNull] String lpNewFileName, CopyProgressRoutine lpProgressRoutine, IntPtr lpData,
                                                   MoveFileFlags dwCopyFlags);
Ejemplo n.º 15
0
 public static extern Boolean CopyFileEx([NotNull] String lpExistingFileName, [NotNull] String lpNewFileName, [CanBeNull] CopyProgressRoutine lpProgressRoutine, IntPtr lpData, ref Int32 IsCancelled,
                                         MoveFileFlags dwCopyFlags);
Ejemplo n.º 16
0
 public void MoveFileEx(string oldFilename, string newFilename, MoveFileFlags moveFlags)
 {
     Kernel32.MoveFileEx(oldFilename, newFilename, moveFlags);
 }
Ejemplo n.º 17
0
 private static extern bool MoveFileWithProgressA(string existingfile, string newfile,
                                                  CopyProgressRoutine progressRoutine, IntPtr lpData, MoveFileFlags flags);
Ejemplo n.º 18
0
 internal static extern bool MoveFileEx(string existingFileName, string newFileName, MoveFileFlags moveFileFlags);
Ejemplo n.º 19
0
 public void MoveFileEx(string oldFilename, string newFilename, MoveFileFlags moveFlags)
 {
     Kernel32.MoveFileEx(oldFilename, newFilename, moveFlags);
 }
Ejemplo n.º 20
0
 public static extern bool MoveFileWithProgressW([In, MarshalAs(LPWStr)] string lpExistingFileName, [In, MarshalAs(LPWStr)] string lpNewFileName, [In] CopyProgressRoutine lpProgressRoutine, [In] IntPtr lpData, [In, MarshalAs(U4)] MoveFileFlags dwFlags);
Ejemplo n.º 21
0
 static extern bool MoveFileWithProgress(
     string existingFileName,
     string destinationFileName,
     CopyProgressRoutine progressRoutine,
     IntPtr notNeeded,
     MoveFileFlags CopyFlags);
Ejemplo n.º 22
0
 internal static extern bool MoveFileEx(string existingFileName, string newFileName, MoveFileFlags moveFileFlags);
Ejemplo n.º 23
0
 public static extern bool MoveFileEx(
     [In] string lpExistingFileName,
     [In] string lpNewFileName,
     [In] MoveFileFlags dwFlags);
 internal static extern bool MoveFileEx([In] string existingFileName, [In] string newFileName, [In] MoveFileFlags flags);
Ejemplo n.º 25
0
 internal static extern bool MoveFileWithProgress(string lpExistingFileName, string lpNewFileName, CopyProgressRoutine lpProgressRoutine, IntPtr lpData, MoveFileFlags dwCopyFlags);
Ejemplo n.º 26
0
 public static bool MoveFileEx(string fileName, string newFileName, MoveFileFlags flags)
 {
     return(MoveFileExInternal(fileName, null, MoveFileFlags.DelayUntilReboot));
 }
Ejemplo n.º 27
0
 public static extern bool MoveFileWithProgress(string lpExistingFileName, string lpNewFileName, CopyProgressRoutine lpProgressRoutine, IntPtr lpData, MoveFileFlags dwFlags);
Ejemplo n.º 28
0
 public static extern Boolean MoveFileEx(String lpExistingFileName, String lpNewFileName, MoveFileFlags dwFlags);
Ejemplo n.º 29
0
 internal static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, MoveFileFlags dwFlags);
Ejemplo n.º 30
0
 public static void MoveFile(string SourceFilePath, string DestinationFilePath, MoveFileFlags Flags)
 {
     if (!Win32.MoveFileEx(SourceFilePath, DestinationFilePath, Flags))
     {
         throw new Win32Exception(Marshal.GetLastWin32Error(), "Failed to move file");
     }
 }