public static void DeleteRange(this RepositoryHost repositoryHost, RepositoryPath[] paths)
        {
            var files = paths.SelectMany(item => item.GetFiles()).ToArray();

            foreach (var item in files)
            {
                if (File.Exists(item) == false)
                {
                    throw new FileNotFoundException();
                }
            }
            repositoryHost.DeleteRange(files);
        }
 public static void Delete(this RepositoryHost repositoryHost, RepositoryPath path)
 {
     if (path.IsDirectory == true)
     {
         repositoryHost.Delete(path.Path);
     }
     else
     {
         var files = path.GetFiles();
         foreach (var item in files)
         {
             if (File.Exists(item) == false)
             {
                 throw new FileNotFoundException();
             }
         }
         repositoryHost.DeleteRange(files);
     }
 }
        //public static void Add(this RepositoryHost repositoryHost, RepositoryPath path, string contents)
        //{
        //    repositoryHost.Add(path.Path);
        //}

        //public static void Modify(this RepositoryHost repositoryHost, RepositoryPath path, string contents)
        //{
        //    repositoryHost.Modify(path.Path, contents);
        //}

        public static void Move(this RepositoryHost repositoryHost, RepositoryPath srcPath, RepositoryPath toPath)
        {
            if (srcPath.IsDirectory == true)
            {
                repositoryHost.Move(srcPath.Path, toPath.Path);
            }
            else
            {
                var files = srcPath.GetFiles();

                for (var i = 0; i < files.Length; i++)
                {
                    var path1     = files[i];
                    var extension = Path.GetExtension(path1);
                    var path2     = toPath.Path + extension;
                    repositoryHost.Move(path1, path2);
                }
            }
        }
 public static void Add(this RepositoryHost repositoryHost, RepositoryPath path)
 {
     if (path.IsDirectory)
     {
         repositoryHost.Add(path.Path);
     }
     else
     {
         var files  = path.GetFiles();
         var status = repositoryHost.Status(files);
         foreach (var item in status)
         {
             if (item.Status == RepositoryItemStatus.Untracked)
             {
                 repositoryHost.Add(item.Path);
             }
         }
     }
 }
 public static void AddRange(this RepositoryHost repositoryHost, RepositoryPath[] paths)
 {
     repositoryHost.AddRange(paths.Select(item => item.Path).ToArray());
 }
 public static void Copy(this RepositoryHost repositoryHost, RepositoryPath srcPath, RepositoryPath toPath)
 {
     repositoryHost.Copy(srcPath.Path, toPath.Path);
 }
Esempio n. 7
0
 public RepositoryHostLock(RepositoryHost repository, Authentication authentication, object target, string methodName, string[] lockPaths)
 {
     repository.Lock(authentication, target, methodName, lockPaths);
     this.action = new Action(() => repository.Unlock(authentication, target, methodName, lockPaths));
 }