コード例 #1
0
        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);
        }
コード例 #2
0
 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);
     }
 }
コード例 #3
0
        //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);
                }
            }
        }
コード例 #4
0
 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);
             }
         }
     }
 }
コード例 #5
0
 public static void AddRange(this RepositoryHost repositoryHost, RepositoryPath[] paths)
 {
     repositoryHost.AddRange(paths.Select(item => item.Path).ToArray());
 }
コード例 #6
0
 public static void Copy(this RepositoryHost repositoryHost, RepositoryPath srcPath, RepositoryPath toPath)
 {
     repositoryHost.Copy(srcPath.Path, toPath.Path);
 }
コード例 #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));
 }