OpenHome.Git.Fetcher.Fetch C# (CSharp) Method

Fetch() static private method

static private Fetch ( IRepository aRepository, string aUri ) : bool
aRepository IRepository
aUri string
return bool
        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);
        }

Same methods

Fetcher::Fetch ( Repository aRepository, Uri aUri, BinaryWriter aWriter, BinaryReader aReader ) : bool
Fetcher::Fetch ( Repository aRepository, Uri aUri, NetworkStream aStream ) : bool