Exemple #1
0
 private static List<RemoteFile> GetVersionsOrderByLastModified(File  SQObject)
 {
     return  RemoteRepo.TrashFiles.Where (ft => ft.AbsolutePath.Contains ( SQObject.AbsolutePath)).OrderBy(ft => ft.AsS3Object.LastModified).ToList<RemoteFile>();
 }
Exemple #2
0
 public Change(File file, System.IO.WatcherChangeTypes changeEvent)
 {
     File = file;
     Event = changeEvent;
 }
Exemple #3
0
 public static void Upload(File file)
 {
     connection.Upload(file);
 }
Exemple #4
0
        public static void UpdateTrashFolder(File  SQObject)
        {
            if ( SQObject.IsAFolder)
                return;
            List<RemoteFile> versions = GetVersionsOrderByLastModified ( SQObject);

            foreach (RemoteFile version in versions) {
                //if (version.IsAFolder)
                //  continue;
                //Console.WriteLine ("Incrementa versao");
                string newName = "";
                string oldName = version.FullLocalName;
                int sizeOldName = oldName.Length;
                int v = int.Parse(oldName[sizeOldName-2].ToString())+1;
                newName = oldName.Substring (0, sizeOldName - 3) +"("+v+")";

                connection.CopyInTrash (version, new RemoteFile(newName));
                connection.DeleteInTrash (version);
            }
            versions = GetVersionsOrderByLastModified ( SQObject);
            while (versions.Count > 3) {
                connection.DeleteInTrash (versions.First());
                versions = GetVersionsOrderByLastModified( SQObject);
            }
        }
Exemple #5
0
 public static void MoveToTrash(File  SQObject)
 {
     connection.CopyToTrash ( SQObject);
     UpdateTrashFolder ( SQObject);
     connection.Delete ( SQObject);
 }
Exemple #6
0
 public static void Move(File old, File newO)
 {
     connection.Copy (old, newO);
     connection.CopyToTrash (old);
     if (RemoteRepo.Files.Where (rf => rf.Name == old.Name).Any())
         connection.Delete (old);
 }
Exemple #7
0
 public static bool ExistsInBucket(File file)
 {
     return Files.Where (rf => rf.AbsolutePath == file.AbsolutePath
                         || rf.AbsolutePath.Contains (file.AbsolutePath)).Any ();
 }