private void EnsureCredentials(ScmUserNamePasswordEventArgs e) { ISvnClientPool pool = (Context != null) ? Context.GetService <ISvnClientPool>() : null; if (pool != null) { using (SvnPoolClient client = pool.GetNoUIClient()) { EventHandler <SvnUserNamePasswordEventArgs> handler = delegate(object sender, SvnUserNamePasswordEventArgs args) { args.Save = true; args.UserName = e.UserName; args.Password = e.Password; }; client.Authentication.UserNamePasswordHandlers += handler; try { SvnInfoArgs infoArgs = new SvnInfoArgs(); infoArgs.ThrowOnError = false; System.Collections.ObjectModel.Collection <SvnInfoEventArgs> info; if (client.GetInfo(SvnUriTarget.FromString(e.RepositoryUri), infoArgs, out info)) { } } finally { client.Authentication.UserNamePasswordHandlers -= handler; } } } }
public bool ReturnClient(SvnPoolClient poolClient) { AnkhSvnPoolClient pc = poolClient as AnkhSvnPoolClient; if (pc != null && pc.ReturnCookie == _returnCookie) { Stack <SvnPoolClient> stack = pc.UIEnabled ? _uiClients : _clients; lock (stack) { if (stack.Count < MaxPoolSize) { stack.Push(pc); return(true); } } } return(false); }
public bool ReturnClient(SvnPoolClient poolClient) { AnkhSvnPoolClient pc = poolClient as AnkhSvnPoolClient; if (pc != null && pc.ReturnCookie == _returnCookie) { Stack<SvnPoolClient> stack = pc.UIEnabled ? _uiClients : _clients; lock (stack) { if (stack.Count < MaxPoolSize) { stack.Push(pc); return true; } } } return false; }