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

WriteFetchRequest() public static method

public static WriteFetchRequest ( Uri aUri, BinaryWriter aWriter ) : void
aUri System.Uri
aWriter System.IO.BinaryWriter
return void
        public static void WriteFetchRequest(Uri aUri, BinaryWriter aWriter)
        {
            byte[] command = ASCIIEncoding.ASCII.GetBytes("git-upload-pack " + aUri.PathAndQuery);

            byte[] host = ASCIIEncoding.ASCII.GetBytes("host=" + aUri.Host);

            int len = command.Length + host.Length + 6;

            byte[] length = ASCIIEncoding.ASCII.GetBytes(len.ToString("x4"));

            byte[] request = new byte[len];

            Array.Copy(length, 0, request, 0, length.Length);

            Array.Copy(command, 0, request, length.Length, command.Length);

            request[length.Length + command.Length] = 0;

            Array.Copy(host, 0, request, length.Length + command.Length + 1, host.Length);

            request[length.Length + command.Length + host.Length + 1] = 0;

            aWriter.Write(request);
        }