Ejemplo n.º 1
0
        public static LocalFileInfo GetFileInfo(string filePath)
        {
            var info = new FileInfo(filePath);

            var localInfo = new LocalFileInfo();

            localInfo.Size         = info.Length;
            localInfo.LastWriting  = info.LastWriteTimeUtc;
            localInfo.Attributes   = info.Attributes;
            localInfo.RelativePath = SanitizeToRelativePath(PathsManager.GetDirectoryPath(filePath), filePath);

            return(localInfo);
        }
Ejemplo n.º 2
0
 public static void CreateShortcut(string targetFile, string shortcutFile)
 {
     File.Delete(shortcutFile);
     using (var fs = new FileStream(shortcutFile, FileMode.Create, FileAccess.ReadWrite))
     {
         using (var writer = new StreamWriter(fs))
         {
             writer.WriteLine("[InternetShortcut]");
             writer.WriteLine("URL=file:///" + targetFile);
             writer.WriteLine("IconIndex=0");
             writer.WriteLine("WorkingDirectory=" + PathsManager.GetDirectoryPath(targetFile));
             writer.WriteLine("IconFile=" + targetFile.Replace('\\', '/'));
             writer.Flush();
         }
     }
 }
Ejemplo n.º 3
0
 public static void Copy(string sourcePath, string destinationPath, bool overwrite = true)
 {
     DirectoriesManager.Create(PathsManager.GetDirectoryPath(destinationPath));
     File.Copy(sourcePath, destinationPath, overwrite);
 }