WriteToStream() 공개 메소드

Writes the UTF-8 encoded value of ToString directly to a Stream.
public WriteToStream ( Stream writableStream ) : void
writableStream Stream The to write to.
리턴 void
예제 #1
0
        internal void Get()
        {
            // parse the operations arguments from stdin (this is how git sends commands)
            // see: https://www.kernel.org/pub/software/scm/git/docs/technical/api-credentials.html
            // see: https://www.kernel.org/pub/software/scm/git/docs/git-credential.html
            using (var stdin = Console.OpenStandardInput())
            {
                OperationArguments operationArguments = new OperationArguments(stdin);

                LoadOperationArguments(operationArguments);
                EnableTraceLogging(operationArguments);

                Credential credentials;
                if ((credentials = QueryCredentials(operationArguments)) == null)
                {
                    Exit(-1, "Logon failed, use ctrl+c to cancel basic credential prompt.");
                }
                else
                {
                    using (var stdout = Console.OpenStandardOutput())
                    {
                        operationArguments.WriteToStream(stdout);
                    }
                }
            }
        }
예제 #2
0
        private static void Get()
        {
            // parse the operations arguments from stdin (this is how git sends commands)
            // see: https://www.kernel.org/pub/software/scm/git/docs/technical/api-credentials.html
            // see: https://www.kernel.org/pub/software/scm/git/docs/git-credential.html
            var stdin = Console.OpenStandardInput();
            OperationArguments operationArguments = new OperationArguments(stdin);

            if (ReferenceEquals(operationArguments, null))
            {
                throw new ArgumentNullException("operationArguments");
            }
            if (ReferenceEquals(operationArguments.TargetUri, null))
            {
                throw new ArgumentNullException("operationArguments.TargetUri");
            }

            Trace.WriteLine("Program::Get");
            Trace.WriteLine("   targetUri = " + operationArguments.TargetUri);

            LoadOperationArguments(operationArguments);
            EnableTraceLogging(operationArguments);

            QueryCredentials(operationArguments);

            var stdout = Console.OpenStandardOutput();

            operationArguments.WriteToStream(stdout);
        }
        internal void Get()
        {
            // parse the operations arguments from stdin (this is how git sends commands)
            // see: https://www.kernel.org/pub/software/scm/git/docs/technical/api-credentials.html
            // see: https://www.kernel.org/pub/software/scm/git/docs/git-credential.html
            using (var stdin = InStream)
            {
                OperationArguments operationArguments = new OperationArguments(_context, stdin);

                Task.Run(async() =>
                {
                    await LoadOperationArguments(operationArguments);
                    EnableTraceLogging(operationArguments);

                    Credential credentials;
                    if ((credentials = await QueryCredentials(operationArguments)) == null)
                    {
                        Exit(-1, "Logon failed, use ctrl+c to cancel basic credential prompt.");
                    }
                    else
                    {
                        using (var stdout = OutStream)
                        {
                            operationArguments.WriteToStream(stdout);
                        }
                    }
                }).Wait();
            }
        }
        internal void Get()
        {
            // Parse the operations arguments from stdin (this is how git sends commands)
            // see: https://www.kernel.org/pub/software/scm/git/docs/technical/api-credentials.html
            // see: https://www.kernel.org/pub/software/scm/git/docs/git-credential.html
            using (var stdin = InStream)
            {
                var operationArguments = new OperationArguments(_context);

                Task.Run(async() =>
                {
                    await operationArguments.ReadInput(stdin);

                    if (operationArguments.TargetUri is null)
                    {
                        var inner = new ArgumentNullException(nameof(operationArguments.TargetUri));
                        throw new ArgumentException(inner.Message, nameof(operationArguments), inner);
                    }

                    // Load operation arguments.
                    await LoadOperationArguments(operationArguments);
                    EnableTraceLogging(operationArguments);

                    // Read the details of any git-remote-http(s).exe parent process, but only if
                    // an override hasn't been set which would override the git-remote details.
                    if (string.IsNullOrEmpty(operationArguments.UrlOverride))
                    {
                        ReadGitRemoteDetails(operationArguments);
                    }

                    // Set the parent window handle.
                    ParentHwnd = operationArguments.ParentHwnd;

                    Credential credentials;
                    if ((credentials = await QueryCredentials(operationArguments)) == null)
                    {
                        Exit(-1, LogonFailedMessage);
                    }
                    else
                    {
                        using (var stdout = OutStream)
                        {
                            operationArguments.WriteToStream(stdout);
                        }
                    }
                }).Wait();
            }
        }
        private static void Get()
        {
            // parse the operations arguments from stdin (this is how git sends commands)
            // see: https://www.kernel.org/pub/software/scm/git/docs/technical/api-credentials.html
            // see: https://www.kernel.org/pub/software/scm/git/docs/git-credential.html
            using (var stdin = Console.OpenStandardInput())
            {
                OperationArguments operationArguments = new OperationArguments(stdin);

                LoadOperationArguments(operationArguments);
                EnableTraceLogging(operationArguments);

                QueryCredentials(operationArguments);

                using (var stdout = Console.OpenStandardOutput())
                {
                    operationArguments.WriteToStream(stdout);
                }
            }
        }
예제 #6
0
        internal void Get()
        {
            // Parse the operations arguments from stdin (this is how git sends commands)
            // see: https://www.kernel.org/pub/software/scm/git/docs/technical/api-credentials.html
            // see: https://www.kernel.org/pub/software/scm/git/docs/git-credential.html
            using (var stdin = InStream)
            {
                OperationArguments operationArguments = new OperationArguments(_context);

                Task.Run(async() =>
                {
                    await operationArguments.ReadInput(stdin);

                    if (operationArguments.TargetUri is null)
                    {
                        var inner = new ArgumentNullException(nameof(operationArguments.TargetUri));
                        throw new ArgumentException(inner.Message, nameof(operationArguments), inner);
                    }

                    await LoadOperationArguments(operationArguments);
                    EnableTraceLogging(operationArguments);

                    // Set the parent window handle.
                    ParentHwnd = operationArguments.ParentHwnd;

                    Credential credentials;
                    if ((credentials = await QueryCredentials(operationArguments)) == null)
                    {
                        Exit(-1, "Logon failed, use ctrl+c to cancel basic credential prompt.");
                    }
                    else
                    {
                        using (var stdout = OutStream)
                        {
                            operationArguments.WriteToStream(stdout);
                        }
                    }
                }).Wait();
            }
        }