internal static bool Fetch(IRepository aRepository, string aUri)
{
Repository repository = aRepository as Repository;
if (repository == null)
{
throw (new GitException("Invalid repository"));
}
Uri uri;
try
{
uri = new Uri(aUri);
}
catch (Exception e)
{
throw (new GitException("Invalid uri", e));
}
if (uri.Scheme != "git")
{
throw (new GitException("Invalid transfer protocol"));
}
int port = 9418;
if (!uri.IsDefaultPort)
{
port = uri.Port;
}
try
{
TcpClient client = new TcpClient(uri.Host, port);
using (client)
{
return (Fetch(repository, uri, client.GetStream()));
}
}
catch
{
}
return (false);
}