コード例 #1
0
 /// <summary>
 /// Deletes an empty directory from a specified path.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="path">The name of the empty directory to remove. This directory must be writable or empty.</param>
 /// <param name="recursive"><c>true</c> to remove directories, subdirectories, and files in path; otherwise, <c>false</c>.</param>
 public static void Delete(RemoteDevice device, string path, bool recursive)
 {
     if (Exists(device, path))
     {
         if (recursive)
         {
             foreach (var file in GetFiles(device, path))
             {
                 RemoteFile.Delete(device, file);
             }
             foreach (var dir in GetDirectories(device, path))
             {
                 Delete(device, dir, true);
             }
         }
         if (0 == device.ISession.CeRemoveDirectory(path))
         {
             device.ThrowRAPIException();
         }
     }
 }
コード例 #2
0
 /// <summary>
 /// Gets the creation date and time of a directory.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="path">The path of the directory.</param>
 /// <returns>A <see cref="DateTime"/> structure set to the creation date and time for the specified directory. This value is expressed in local time.</returns>
 public static DateTime GetCreationTime(RemoteDevice device, string path)
 {
     return(RemoteFile.GetCreationTime(device, path));
 }
コード例 #3
0
 /// <summary>
 /// Determines whether the given path refers to an existing directory on disk.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="path">The path to test.</param>
 /// <returns><c>true</c> if <paramref name="path"/> refers to an existing directory; otherwise, <c>false</c>.</returns>
 public static bool Exists(RemoteDevice device, string path)
 {
     return(RemoteFile.Exists(device, path));
 }
コード例 #4
0
 /// <summary>
 /// Moves a file or a directory and its contents to a new location.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="sourceDirName">The path of the file or directory to move.</param>
 /// <param name="destDirName">The path to the new location for <paramref name="sourceDirName"/>. If <paramref name="sourceDirName"/> is a file, then <paramref name="destDirName"/> must also be a file name.</param>
 public static void Move(RemoteDevice device, string sourceDirName, string destDirName)
 {
     RemoteFile.Move(device, sourceDirName, destDirName);
 }
コード例 #5
0
 /// <summary>
 /// Returns the date and time the specified file or directory was last accessed.
 /// </summary>
 /// <param name="device">The device.</param>
 /// <param name="path">The file or directory for which to obtain access date and time information.</param>
 /// <returns>A <see cref="DateTime"/> structure set to the date and time the specified file or directory was last accessed. This value is expressed in local time.</returns>
 public static DateTime GetLastAccessTime(RemoteDevice device, string path)
 {
     return(RemoteFile.GetLastAccessTime(device, path));
 }
コード例 #6
0
ファイル: RemoteFileInfo.cs プロジェクト: Dooks123/Rapi2
 /// <summary>
 /// Deletes a file.
 /// </summary>
 public override void Delete()
 {
     RemoteFile.Delete(Device, FullPath);
 }
コード例 #7
0
ファイル: RemoteFileInfo.cs プロジェクト: Dooks123/Rapi2
 /// <summary>
 /// Copies an existing file to a new file, allowing the overwriting of an existing file.
 /// </summary>
 /// <param name="destFileName">The name of the new file to copy to.</param>
 /// <param name="overwrite"><c>true</c> to allow an existing file to be overwritten; otherwise <c>false</c>.</param>
 /// <returns>A new file, or an overwrite of an existing file if overwrite is <c>true</c>. If the file exists and overwrite is <c>false</c>, an exception is thrown.</returns>
 public RemoteFileInfo CopyTo(string destFileName, bool overwrite)
 {
     CheckValidFileName(destFileName);
     RemoteFile.Copy(Device, FullPath, destFileName, overwrite);
     return(new RemoteFileInfo(Device, destFileName));
 }
コード例 #8
0
ファイル: RemoteFileInfo.cs プロジェクト: Dooks123/Rapi2
 /// <summary>
 /// Moves a specified file to a new location, providing the option to specify a new file name.
 /// </summary>
 /// <param name="destFileName">The path to move the file to, which can specify a different file name.</param>
 public void MoveTo(string destFileName)
 {
     CheckValidFileName(destFileName);
     RemoteFile.Move(Device, FullPath, destFileName);
 }