示例#1
0
        public async Task CloneRepo(string repoUrl, string workingDirectory, string targetDirectory, Action <int, int> statusReporter, Action <string, bool> spinnerAction)
        {
            var co   = new CloneOptions();
            var prog = new CheckoutProgressHandler((path, completed, total) => OnProgressChanged(path, completed, total, statusReporter, spinnerAction));

            co.OnCheckoutProgress  = prog;
            co.CredentialsProvider = (_url, _user, _cred) => new UsernamePasswordCredentials {
                Username = cache.Settings["git_username"], Password = SecureUtils.Unprotect(cache.Settings["git_password"])
            };
            string password = SecureUtils.Unprotect(cache.Settings["git_password"]);

            spinnerAction($"Downloading from {repoUrl}", true);
            string dir = await Task.Run(() => Repository.Clone(repoUrl, workingDirectory + "\\" + targetDirectory, co));

            Debug.WriteLine(DateTime.Now.ToString() + " - Cloned to " + dir);
        }
示例#2
0
 public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
 {
     return(SecureUtils.Unprotect(value.ToString()));
 }