System.Console.SetOut(System.IO.TextWriter)

Here are the examples of the csharp api System.Console.SetOut(System.IO.TextWriter) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

334 Examples 7

19 Source : Program.cs
with MIT License
from 0x0ade

private static void MainMain(string[] args) {
            LogHeader(Console.Out);
            Thread.CurrentThread.Name = "Main Thread";

            CelesteNetServerSettings settings = new();
            settings.Load();
            settings.Save();


            bool showHelp = false;
            string? logFile = "log-celestenet.txt";
            OptionSet options = new() {
                {
                    "v|loglevel:",
                    $"Change the log level, ranging from {LogLevel.CRI} ({(int) LogLevel.CRI}) to {LogLevel.DEV} ({(int) LogLevel.DEV}). Defaults to {LogLevel.INF} ({(int) LogLevel.INF}).",
                    v => {
                        if (Enum.TryParse(v, true, out LogLevel level)) {
                            Logger.Level = level;
                        } else {
                            Logger.Level--;
                        }

                        if (Logger.Level < LogLevel.DEV)
                            Logger.Level = LogLevel.DEV;
                        if (Logger.Level > LogLevel.CRI)
                            Logger.Level = LogLevel.CRI;

                        Console.WriteLine($"Log level changed to {Logger.Level}");
                    }
                },

                { "log", "Specify the file to log to.", v => { if (v != null) logFile = v; } },
                { "nolog", "Disable logging to a file.", v => { if (v != null) logFile = null; } },

                { "h|help", "Show this message and exit.", v => showHelp = v != null },
            };

            try {
                options.Parse(args);

            } catch (OptionException e) {
                Console.WriteLine(e.Message);
                Console.WriteLine("Use --help for argument info.");
                return;
            }

            if (showHelp) {
                options.WriteOptionDescriptions(Console.Out);
                return;
            }

            if (logFile == null) {
                MainRun(settings);
                return;
            }

            if (File.Exists(logFile))
                File.Delete(logFile);

            using FileStream fileStream = new(logFile, FileMode.OpenOrCreate, FileAccess.Write, FileShare.ReadWrite | FileShare.Delete);
            using StreamWriter fileWriter = new(fileStream, Console.OutputEncoding);
            using LogWriter logWriter = new() {
                STDOUT = Console.Out,
                File = fileWriter
            };
            LogHeader(fileWriter);

            try {
                Console.SetOut(logWriter);
                MainRun(settings);

            } finally {
                if (logWriter.STDOUT != null) {
                    Console.SetOut(logWriter.STDOUT);
                    logWriter.STDOUT = null;
                }
            }
        }

19 Source : EchoingCommands.cs
with Apache License 2.0
from adamralph

[Fact]
        public static void SuppressingCommandEcho()
        {
            // arrange
            Console.SetOut(Capture.Out);

            // act
            Command.Run("dotnet", $"exec {Tester.Path} {TestName()}", noEcho: true);

            // replacedert
            replacedert.DoesNotContain(TestName(), Capture.Out.ToString(), StringComparison.Ordinal);
        }

19 Source : EchoingCommands.cs
with Apache License 2.0
from adamralph

[Fact]
        public static void EchoingACommandWithASpecificPrefix()
        {
            // arrange
            Console.SetOut(Capture.Out);

            // act
            Command.Run("dotnet", $"exec {Tester.Path} {TestName()}", noEcho: false, echoPrefix: $"{TestName()} prefix");

            // replacedert
            var error = Capture.Out.ToString();

            replacedert.Contains(TestName(), error, StringComparison.Ordinal);
            replacedert.Contains($"{TestName()} prefix:", error, StringComparison.Ordinal);
        }

19 Source : EchoingCommands.cs
with Apache License 2.0
from adamralph

[Fact]
        public static void SuppressingCommandEchoWithASpecificPrefix()
        {
            // arrange
            Console.SetOut(Capture.Out);

            // act
            Command.Run("dotnet", $"exec {Tester.Path} {TestName()}", noEcho: true, echoPrefix: $"{TestName()} prefix");

            // replacedert
            var error = Capture.Out.ToString();

            replacedert.DoesNotContain(TestName(), error, StringComparison.Ordinal);
            replacedert.DoesNotContain($"{TestName()} prefix:", error, StringComparison.Ordinal);
        }

19 Source : EchoingCommands.cs
with Apache License 2.0
from adamralph

[Fact]
        public static void EchoingACommand()
        {
            // arrange
            Console.SetOut(Capture.Out);

            // act
            Command.Run("dotnet", $"exec {Tester.Path} {TestName()}");

            // replacedert
            replacedert.Contains(TestName(), Capture.Out.ToString(), StringComparison.Ordinal);
        }

19 Source : MainWindow.xaml.cs
with GNU General Public License v2.0
from adrifcastr

public async void carmdrm()
        {
            statuslbl.Content = "Converting File...";

            Extract("OSAC", AppDomain.CurrentDomain.BaseDirectory + "\\res", "res", "ffmpeg.exe");

            string ffdir = AppDomain.CurrentDomain.BaseDirectory + "\\res\\ffmpeg.exe";
            string arg = @"-y -activation_bytes ";
            string arg1 = @" -i ";
            string arg2 = @" -ab ";
            string arg3 = @"k -map_metadata 0 -id3v2_version 3 -vn ";
            string fileout = Path.Combine(outputdisplay.Text, Path.GetFileNameWithoutExtension(inputdisplay.Text) + GetOutExtension());
            string arguments = arg + abytes + arg1 + inputdisplay.Text + arg2 + qlabel.Content + arg3 + fileout;

            Process ffm = new Process();
            ffm.StartInfo.FileName = ffdir;
            ffm.StartInfo.Arguments = arguments;
            ffm.StartInfo.CreateNoWindow = true;
            ffm.StartInfo.RedirectStandardError = true;
            ffm.StartInfo.UseShellExecute = false;
            ffm.StartInfo.WorkingDirectory = Directory.GetCurrentDirectory();
            ffm.EnableRaisingEvents = true;
            Console.SetOut(new TextBoxWriter(txtConsole));
            ffm.ErrorDataReceived += (s, ea) =>
            {
                Console.WriteLine($"{ea.Data}");
            };

            scrolltimer.Tick += new EventHandler(scrolltimer_Tick);
            scrolltimer.Interval = new TimeSpan(0, 0, 1);

            ffm.Start();

            ffm.BeginErrorReadLine();
            scrolltimer.Start();

            await Task.Run(() => ffm.WaitForExit());

            ffm.Close();

            inpbutton.IsEnabled = true;

            convertbutton.IsEnabled = true;

            scrolltimer.Stop();
            scrolltimer.Tick -= new EventHandler(scrolltimer_Tick);

            enrb();
            enbslst();

            statuslbl.Content = "Conversion Complete!";

            stopbar();

            Directory.Delete(resdir, true);
        }

19 Source : PasswordInputTest.cs
with MIT License
from afucher

[Fact]
        public void ConsoleOutputShouldBeOnlyAsterisk()
        {
            using var consoleOutput = new StringWriter();
            var oldOutput = Console.Out;
            Console.SetOut(consoleOutput);
            var consoleRender = Subsreplacedute.For<IScreenManager>();
            var inputObservable = Subsreplacedute.For<IInputObservable>();
            ConsoleKeyInfo[] keys = ckiFactory.GetMultipleLetters("AB");
            
            inputObservable.TakeUntilEnter().Returns(keys.ToObservable());
            consoleRender.GetInputObservable().Returns(inputObservable);
            var input = new PreplacedwordInput("Name", "Message", consoleRender);
            
            input.Ask();
            
            consoleOutput.ToString().Should().Be("**");
            Console.SetOut(oldOutput);
        }

19 Source : PasswordInputTest.cs
with MIT License
from afucher

[Fact]
        public void ConsoleOutputShouldBeOnlyAsterisk()
        {
            using var consoleOutput = new StringWriter();
            var oldOutput = Console.Out;
            Console.SetOut(consoleOutput);
            var consoleRender = Subsreplacedute.For<IScreenManager>();
            var inputObservable = Subsreplacedute.For<IInputObservable>();
            ConsoleKeyInfo[] keys = ckiFactory.GetMultipleLetters("AB");
            
            inputObservable.TakeUntilEnter().Returns(keys.ToObservable());
            consoleRender.GetInputObservable().Returns(inputObservable);
            var input = new PreplacedwordInput("Name", "Message", consoleRender);
            
            input.Ask();
            
            consoleOutput.ToString().Should().Be("**");
            Console.SetOut(oldOutput);
        }

19 Source : Modules.cs
with BSD 3-Clause "New" or "Revised" License
from airzero24

public static string Invoke(string FileId, string[] args)
        {
            string output = "";
            try
            {
                string FullName = GetFullName(FileId);
                replacedembly[] replacedems = AppDomain.CurrentDomain.Getreplacedemblies();
                foreach (replacedembly replacedem in replacedems)
                {
                    if (replacedem.FullName == Encoding.UTF8.GetString(Convert.FromBase64String(FullName)))
                    {
                        MethodInfo entrypoint = replacedem.EntryPoint;
                        object[] arg = new object[] { args };

                        TextWriter realStdOut = Console.Out;
                        TextWriter realStdErr = Console.Error;
                        TextWriter stdOutWriter = new StringWriter();
                        TextWriter stdErrWriter = new StringWriter();
                        Console.SetOut(stdOutWriter);
                        Console.SetError(stdErrWriter);

                        entrypoint.Invoke(null, arg);

                        Console.Out.Flush();
                        Console.Error.Flush();
                        Console.SetOut(realStdOut);
                        Console.SetError(realStdErr);

                        output = stdOutWriter.ToString();
                        output += stdErrWriter.ToString();
                        break;
                    }
                }
                return output;
            }
            catch
            {
                return output;
            }
        }

19 Source : NativeMessagingEnvironment.cs
with MIT License
from alexwiese

public static void RedirectConsoleOutput(TextWriter textWriter)
        {
            Console.SetOut(textWriter);
        }

19 Source : ErcMain.cs
with MIT License
from Andy53

[DllExport("pluginit", CallingConvention.Cdecl)]
        public static bool pluginit(ref Plugins.PLUG_INITSTRUCT initStruct)
        {
            Plugins.pluginHandle = initStruct.pluginHandle;
            initStruct.sdkVersion = Plugins.PLUG_SDKVERSION;
            initStruct.pluginVersion = plugin_version;
            initStruct.pluginName = plugin_name;
            Console.SetOut(new TextWriterPLog());
            return ErcXdbg.PluginInit(initStruct);
        }

19 Source : BackupCommandTests.cs
with MIT License
from ANF-Studios

[Fact]
        [SupportedOSPlatform("windows")]
        public void ListAllBackups()
        {
            Console.SetOut(new OutputRedirector(output));
            Program.Main(new string[] {
                "add",
                "--user",
                "--backup",
                "--value",
                "BackupTests_ListAllBackups"
            });
            Program.Main(
                new string[] { "backup", "list", "--all" }
            );
            Console.SetOut(initialOutput);
        }

19 Source : BackupCommandTests.cs
with MIT License
from ANF-Studios

[Fact]
        [SupportedOSPlatform("windows")]
        public void ListAllBackups()
        {
            Console.SetOut(new OutputRedirector(output));
            Program.Main(new string[] {
                "add",
                "--user",
                "--backup",
                "--value",
                "BackupTests_ListAllBackups"
            });
            Program.Main(
                new string[] { "backup", "list", "--all" }
            );
            Console.SetOut(initialOutput);
        }

19 Source : BackupCommandTests.cs
with MIT License
from ANF-Studios

[Fact]
        [SupportedOSPlatform("windows")]
        public void ListLatestBackups()
        {
            Console.SetOut(new OutputRedirector(output));
            Program.Main(new string[] {
                "add",
                "--user",
                "--backup",
                "--value",
                "BackupTests_ListLatestBackups"
            });
            Program.Main(
                new string[] { "backup", "list", "--latest" }
            );
            Console.SetOut(initialOutput);
        }

19 Source : BackupCommandTests.cs
with MIT License
from ANF-Studios

[Fact]
        [SupportedOSPlatform("windows")]
        public void ListLatestBackups()
        {
            Console.SetOut(new OutputRedirector(output));
            Program.Main(new string[] {
                "add",
                "--user",
                "--backup",
                "--value",
                "BackupTests_ListLatestBackups"
            });
            Program.Main(
                new string[] { "backup", "list", "--latest" }
            );
            Console.SetOut(initialOutput);
        }

19 Source : BenchmarkTest.cs
with Apache License 2.0
from AutomateThePlanet

public void CoreTestInit(string testName)
        {
            if (ThrownException?.Value != null)
            {
                ThrownException.Value = null;
            }

            _stringWriter = new StringWriter();
            Console.SetOut(_stringWriter);

            var testClreplacedType = TestClreplacedType;
            var testMethodMemberInfo = GetCurrentExecutionMethodInfo(testName);
            Container = ServicesCollection.Current.FindCollection(testClreplacedType.FullName);
            _currentTestExecutionProvider = new PluginProvider();
            InitializeTestExecutionBehaviorObservers(_currentTestExecutionProvider);
            var categories = _categories;
            var authors = _authors;
            var descriptions = _descriptions;
            try
            {
                _currentTestExecutionProvider.PreTestInit(testName, testMethodMemberInfo, testClreplacedType, new List<object>(), categories, authors, descriptions);
                TestInit();
                _currentTestExecutionProvider.PostTestInit(testName, testMethodMemberInfo, testClreplacedType, new List<object>(), categories, authors, descriptions);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                _currentTestExecutionProvider.TestInitFailed(ex, testName, testMethodMemberInfo, testClreplacedType, new List<object>(), categories, authors, descriptions);
                throw;
            }
        }

19 Source : WriteLine_Should.cs
with Apache License 2.0
from AutomateThePlanet

[Test]
        public void PrintFormattedString_When_FormatAndOneArgumentAreSpecified()
        {
            // Arrange
            var fixture = new Fixture();
            var expectedText = fixture.Create<string>();
            var originalConsoleOut = System.Console.Out;
            string formattedStringToBePrinted;
            using (var writer = new StringWriter())
            {
                System.Console.SetOut(writer);

                // Act
                var consoleProvider = new ConsoleProvider();
                consoleProvider.WriteLine("{0}", expectedText);

                writer.Flush();

                formattedStringToBePrinted = writer.GetStringBuilder().ToString();
            }

            // replacedert
            replacedert.That(formattedStringToBePrinted, Is.EqualTo(string.Concat(expectedText, "\r\n")));

            // Clean-up
            System.Console.SetOut(originalConsoleOut);
        }

19 Source : WriteLine_Should.cs
with Apache License 2.0
from AutomateThePlanet

[Test]
        public void PrintFormattedString_When_FormatAndTwoArgumentAreSpecified()
        {
            // Arrange
            var fixture = new Fixture();
            var expectedText1 = fixture.Create<string>();
            var expectedText2 = fixture.Create<string>();
            var originalConsoleOut = System.Console.Out;
            string formattedStringToBePrinted;
            using (var writer = new StringWriter())
            {
                System.Console.SetOut(writer);

                // Act
                var consoleProvider = new ConsoleProvider();
                consoleProvider.WriteLine("{0}{1}", expectedText1, expectedText2);

                writer.Flush();

                formattedStringToBePrinted = writer.GetStringBuilder().ToString();
            }

            // replacedert
            replacedert.That(formattedStringToBePrinted, Is.EqualTo(string.Concat(expectedText1, expectedText2, "\r\n")));

            // Clean-up
            System.Console.SetOut(originalConsoleOut);
        }

19 Source : Write_Should.cs
with Apache License 2.0
from AutomateThePlanet

[Test]
        public void PrintFormattedString_When_OneArgumentIsSpecified()
        {
            // Arrange
            var originalConsoleOut = System.Console.Out;
            string formattedStringToBePrinted;
            var fixture = new Fixture();
            var expectedText = fixture.Create<string>();
            using (var writer = new StringWriter())
            {
                System.Console.SetOut(writer);

                // Act
                var consoleProvider = new ConsoleProvider();
                consoleProvider.Write(expectedText);

                writer.Flush();

                formattedStringToBePrinted = writer.GetStringBuilder().ToString();
            }

            // replacedert
            replacedert.That(formattedStringToBePrinted, Is.EqualTo(expectedText));

            // Clean-up
            System.Console.SetOut(originalConsoleOut);
        }

19 Source : Write_Should.cs
with Apache License 2.0
from AutomateThePlanet

[Test]
        public void PrintFormattedString_When_FormatAndOneArgumentAreSpecified()
        {
            // Arrange
            var fixture = new Fixture();
            var expectedText = fixture.Create<string>();
            var originalConsoleOut = System.Console.Out;
            string formattedStringToBePrinted;
            using (var writer = new StringWriter())
            {
                System.Console.SetOut(writer);

                // Act
                var consoleProvider = new ConsoleProvider();
                consoleProvider.Write("{0}", expectedText);

                writer.Flush();

                formattedStringToBePrinted = writer.GetStringBuilder().ToString();
            }

            // replacedert
            replacedert.That(formattedStringToBePrinted, Is.EqualTo(expectedText));

            // Clean-up
            System.Console.SetOut(originalConsoleOut);
        }

19 Source : Write_Should.cs
with Apache License 2.0
from AutomateThePlanet

[Test]
        public void PrintFormattedString_When_FormatAndTwoArgumentAreSpecified()
        {
            // Arrange
            var fixture = new Fixture();
            var expectedText1 = fixture.Create<string>();
            var expectedText2 = fixture.Create<string>();
            var originalConsoleOut = System.Console.Out;
            string formattedStringToBePrinted;
            using (var writer = new StringWriter())
            {
                System.Console.SetOut(writer);

                // Act
                var consoleProvider = new ConsoleProvider();
                consoleProvider.Write("{0}{1}", expectedText1, expectedText2);

                writer.Flush();

                formattedStringToBePrinted = writer.GetStringBuilder().ToString();
            }

            // replacedert
            replacedert.That(formattedStringToBePrinted, Is.EqualTo(string.Concat(expectedText1, expectedText2)));

            // Clean-up
            System.Console.SetOut(originalConsoleOut);
        }

19 Source : WriteLine_Should.cs
with Apache License 2.0
from AutomateThePlanet

[Test]
        public void PrintFormattedString_When_OneArgumentIsSpecified()
        {
            // Arrange
            var fixture = new Fixture();
            var expectedText = fixture.Create<string>();
            var originalConsoleOut = System.Console.Out; // preserve the original stream
            string formattedStringToBePrinted;
            using (var writer = new StringWriter())
            {
                System.Console.SetOut(writer);

                // Act
                var consoleProvider = new ConsoleProvider();
                consoleProvider.WriteLine(expectedText);

                writer.Flush();

                formattedStringToBePrinted = writer.GetStringBuilder().ToString();
            }

            // replacedert
            replacedert.That(formattedStringToBePrinted, Is.EqualTo(string.Concat(expectedText, "\r\n")));

            // Clean-up
            System.Console.SetOut(originalConsoleOut);
        }

19 Source : PSHelpGenerator.cs
with Apache License 2.0
from aws

protected override void GenerateHelper()
        {
            Console.WriteLine("Generating Native PowerShell help (Get-Help) doreplacedentation file");
            base.GenerateHelper();

            var buildLogsPath = Path.Combine(this.Options.RootPath, "logs");
            if (!Directory.Exists(buildLogsPath))
                Directory.CreateDirectory(buildLogsPath);

            var logFilename = Path.Combine(buildLogsPath, Name + ".dll-Help.log");
            var oldWriter = Console.Out;
            try
            {
                using (var consoleWriter = new StreamWriter(File.OpenWrite(logFilename)))
                {
                    Console.SetOut(consoleWriter);
                    var outputFile = Path.Combine(this.OutputFolder, Name + PsHelpFilenameTail);

                    var settings = new XmlWriterSettings
                    {
                        Indent = true
                    };

                    using (var psHelpWriter = new XmlTextWriter(outputFile, Encoding.UTF8))
                    {
                        psHelpWriter.Formatting = Formatting.Indented;

                        psHelpWriter.WriteStartElement("helpItems");
                        psHelpWriter.WriteAttributeString("schema", "maml");

                        Parallel.ForEach(CmdletTypes, (cmdletType) =>
                        {
                            CmdletInfo cmdletInfo = InspectCmdletAttributes(cmdletType);

                            using (StringWriter sectionWriter = new StringWriter())
                            using (var sectionXmlWriter = XmlWriter.Create(sectionWriter, new XmlWriterSettings()
                            {
                                OmitXmlDeclaration = true,
                                ConformanceLevel = ConformanceLevel.Fragment,
                                CloseOutput = true
                            }))
                            {
                                string synopsis = null;
                                if (cmdletInfo.AWSCmdletAttribute == null)
                                {
                                    Console.WriteLine("Unable to find AWSCmdletAttribute for type " + cmdletType.FullName);
                                }
                                else
                                {
                                    var cmdletReturnAttributeType = cmdletInfo.AWSCmdletAttribute.GetType();
                                    synopsis = cmdletReturnAttributeType.GetProperty("Synopsis").GetValue(cmdletInfo.AWSCmdletAttribute, null) as string;
                                }

                                foreach (var cmdletAttribute in cmdletInfo.CmdletAttributes)
                                {
                                    sectionXmlWriter.WriteStartElement("command");
                                    sectionXmlWriter.WriteAttributeString("xmlns", "maml", null, "http://schemas.microsoft.com/maml/2004/10");
                                    sectionXmlWriter.WriteAttributeString("xmlns", "command", null, "http://schemas.microsoft.com/maml/dev/command/2004/10");
                                    sectionXmlWriter.WriteAttributeString("xmlns", "dev", null, "http://schemas.microsoft.com/maml/dev/2004/10");
                                    {
                                        var typeDoreplacedentation = DoreplacedentationUtils.GetTypeDoreplacedentation(cmdletType, replacedemblyDoreplacedentation);
                                        typeDoreplacedentation = DoreplacedentationUtils.FormatXMLForPowershell(typeDoreplacedentation);
                                        Console.WriteLine($"Cmdlet = {cmdletType.FullName}");
                                        Console.WriteLine($"Doreplacedentation = {typeDoreplacedentation}");

                                        var cmdletName = cmdletAttribute.VerbName + "-" + cmdletAttribute.NounName;

                                        var allProperties = GetRootSimpleProperties(cmdletType);
                                        var parameterParreplacedioning = new CmdletParameterSetParreplacedions(allProperties, cmdletAttribute.DefaultParameterSetName);

                                        var serviceAbbreviation = GetServiceAbbreviation(cmdletType);

                                        WriteDetails(sectionXmlWriter, cmdletAttribute, typeDoreplacedentation, cmdletName, synopsis);
                                        WriteSyntax(sectionXmlWriter, cmdletName, parameterParreplacedioning);
                                        WriteParameters(sectionXmlWriter, cmdletName, allProperties);
                                        WriteReturnValues(sectionXmlWriter, cmdletInfo.AWSCmdletOutputAttributes);
                                        WriteRelatedLinks(sectionXmlWriter, serviceAbbreviation, cmdletName);
                                        WriteExamples(sectionXmlWriter, cmdletName);
                                    }
                                    sectionXmlWriter.WriteEndElement();
                                }

                                sectionXmlWriter.Close();
                                lock (psHelpWriter)
                                {
                                    psHelpWriter.WriteRaw(sectionWriter.ToString());
                                }
                            }
                        });

                        psHelpWriter.WriteEndElement();
                    }

                    Console.WriteLine($"Verifying help file {outputFile} using XmlDoreplacedent...");
                    try
                    {
                        var doreplacedent = new XmlDoreplacedent();
                        doreplacedent.Load(outputFile);
                    }
                    catch (Exception e)
                    {
                        Logger.LogError(e, $"Error when loading file {outputFile} as XmlDoreplacedent");
                    }
                }
            }
            finally
            {
                Console.SetOut(oldWriter);
            }
        }

19 Source : WebHelpGenerator.cs
with Apache License 2.0
from aws

protected override void GenerateHelper()
        {
            base.GenerateHelper();

            if (string.IsNullOrEmpty(SDKHelpRoot))
                SDKHelpRoot = "http://docs.aws.amazon.com/sdkfornet/v3/apidocs/";
            else if (!SDKHelpRoot.EndsWith("/"))
                SDKHelpRoot = SDKHelpRoot + "/";

            Console.WriteLine("Generating web help doreplacedentation:");
            Console.WriteLine(".... SDK help base URI set to {0}", SDKHelpRoot);
            Console.WriteLine(".... writing doc output to {0}", OutputFolder);

            var buildLogsPath = Path.Combine(this.Options.RootPath, "logs");
            if (!Directory.Exists(buildLogsPath))
                Directory.CreateDirectory(buildLogsPath);

            var logFile = Path.Combine(buildLogsPath, Name + ".dll-WebHelp.log");
            var oldWriter = Console.Out;
            
            try
            {
                using (var consoleWriter = new StreamWriter(File.OpenWrite(logFile)))
                {
                    Console.SetOut(consoleWriter);

                    CleanWebHelpOutputFolder(OutputFolder);
                    CopyWebHelpStaticFiles(OutputFolder);
                    CreateVersionInfoFile(Path.Combine(OutputFolder, "items"));

                    var tocWriter = new TOCWriter(Options, OutputFolder);
                    tocWriter.AddFixedSection();

                    Parallel.ForEach(CmdletTypes, (cmdletType) =>
                    {
                        var (moduleName, serviceName) = DetermineCmdletServiceOwner(cmdletType);
                        var cmdletInfo = InspectCmdletAttributes(cmdletType);

                        string synopsis = null;
                        if (cmdletInfo.AWSCmdletAttribute == null)
                        {
                            Console.WriteLine("Unable to find AWSCmdletAttribute for type " + cmdletType.FullName);
                        }
                        else
                        {
                            var cmdletReturnAttributeType = cmdletInfo.AWSCmdletAttribute.GetType();
                            synopsis =
                                cmdletReturnAttributeType.GetProperty("Synopsis").GetValue(cmdletInfo.AWSCmdletAttribute, null) as
                                string;
                        }

                        foreach (var cmdletAttribute in cmdletInfo.CmdletAttributes)
                        {
                            var typeDoreplacedentation = DoreplacedentationUtils.GetTypeDoreplacedentation(cmdletType,
                                                                                            replacedemblyDoreplacedentation);
                            typeDoreplacedentation = DoreplacedentationUtils.FormatXMLForPowershell(typeDoreplacedentation, true);
                            Console.WriteLine($"Cmdlet = {cmdletType.FullName}");
                            Console.WriteLine($"Doreplacedentation = {typeDoreplacedentation}");

                            var cmdletName = cmdletAttribute.VerbName + "-" + cmdletAttribute.NounName;

                            var allProperties = GetRootSimpleProperties(cmdletType);

                            var parameterParreplacedioning = new CmdletParameterSetParreplacedions(allProperties, cmdletAttribute.DefaultParameterSetName);

                            var serviceAbbreviation = GetServiceAbbreviation(cmdletType);

                            var cmdletPageWriter = new CmdletPageWriter(Options, OutputFolder, serviceName, moduleName, cmdletName);

                            WriteDetails(cmdletPageWriter, typeDoreplacedentation, synopsis, cmdletInfo.AWSCmdletAttribute);
                            WriteSyntax(cmdletPageWriter, cmdletName, parameterParreplacedioning);
                            WriteParameters(cmdletPageWriter, cmdletName, allProperties, false);
                            WriteParameters(cmdletPageWriter, cmdletName, allProperties, true);
                            WriteOutputs(cmdletPageWriter, cmdletInfo.AWSCmdletOutputAttributes);
                            WriteNotes(cmdletPageWriter);
                            WriteExamples(cmdletPageWriter, cmdletName);
                            WriteRelatedLinks(cmdletPageWriter, serviceAbbreviation, cmdletName);

                            cmdletPageWriter.Write();

                            lock (tocWriter)
                            {
                                var legacyAlias = InspectForLegacyAliasAttribution(moduleName, cmdletName, cmdletInfo.AWSCmdletAttribute);
                                tocWriter.AddServiceCmdlet(moduleName, serviceName, cmdletName, cmdletPageWriter.GetTOCID(), synopsis, legacyAlias);
                            }
                        }
                    });

                    tocWriter.Write();

                    WriteLegacyAliasesPage();
                }
            }
            finally
            {
                Console.SetOut(oldWriter);
            }
        }

19 Source : CommandExecuter.cs
with BSD 3-Clause "New" or "Revised" License
from b4rtik

public void ExecuteModuleManaged()
        {
            string output = "";
            try
            {
                StringBuilder myb = new StringBuilder();
                StringWriter sw = new StringWriter(myb);
                TextWriter oldOut = Console.Out;
                Console.SetOut(sw);
                Console.SetError(sw);

                string clreplacedname;
                string replacedembly;
                string method;
                string[] paramsv;

                switch (task.TaskType)
                {
                    case "standard":
                        clreplacedname = task.StandardTask.Moduleclreplaced;
                        replacedembly = task.StandardTask.replacedembly;
                        method = task.StandardTask.Method;
                        paramsv = task.StandardTask.Parameters;
                        RedPeanutAgent.Core.Utility.Runreplacedembly(replacedembly, clreplacedname, method, new object[] { paramsv });
                        break;
                    case "download":
                        clreplacedname = task.DownloadTask.Moduleclreplaced;
                        replacedembly = task.DownloadTask.replacedembly;
                        method = task.DownloadTask.Method;
                        paramsv = task.DownloadTask.Parameters;
                        RedPeanutAgent.Core.Utility.Runreplacedembly(replacedembly, clreplacedname, method, new object[] { paramsv });
                        break;
                    case "migrate":
                        clreplacedname = task.ModuleTask.Moduleclreplaced;
                        replacedembly = task.ModuleTask.replacedembly;
                        method = task.ModuleTask.Method;
                        paramsv = task.ModuleTask.Parameters;
                        RedPeanutAgent.Core.Utility.Runreplacedembly(replacedembly, clreplacedname, method, new object[] { paramsv });
                        break;
                    case "module":
                        clreplacedname = task.ModuleTask.Moduleclreplaced;
                        replacedembly = task.ModuleTask.replacedembly;
                        method = task.ModuleTask.Method;
                        paramsv = task.ModuleTask.Parameters;
                        RedPeanutAgent.Core.Utility.Runreplacedembly(replacedembly, clreplacedname, method, new object[] { paramsv });
                        break;
                }

                output = myb.ToString();

                Console.SetOut(oldOut);
                Console.SetError(oldOut);
                sw.Flush();
                sw.Close();

            }
            catch (Exception e)
            {
                if (e.InnerException != null)
                {
                    try
                    {
                        Type newextype = Type.GetType(e.InnerException.GetType().FullName);
                        RedPeanutAgent.Core.Utility.EndOfLifeException newex = (RedPeanutAgent.Core.Utility.EndOfLifeException)Activator.CreateInstance(newextype);
                        throw newex;
                    }
                    catch (InvalidCastException ex)
                    {
                    }
                    catch (ArgumentNullException ex)
                    {
                    }
                }
                output = e.Message;
            }
            SendResponse(output);
        }

19 Source : DebugConsole.cs
with The Unlicense
from BAndysc

void System.IDisposable.Dispose()
        {
            if (oldOut != null)
                System.Console.SetOut(oldOut);

            if (multiPlexer != null)
            {
                multiPlexer.Flush();
                multiPlexer.Close();
            }
        }

19 Source : DebugConsole.cs
with MIT License
from bbepis

private static bool TryEnableConsole()
      {
         try
         {
            var oldConsoleOut = Kernel32.GetStdHandle( -11 );
            if( !Kernel32.AllocConsole() ) return false;

            _consoleOut = Kernel32.CreateFile( "CONOUT$", 0x40000000, 2, IntPtr.Zero, 3, 0, IntPtr.Zero );
            if( !Kernel32.SetStdHandle( -11, _consoleOut ) ) return false;

            Stream stream = Console.OpenStandardOutput();
            StreamWriter writer = new StreamWriter( stream, Encoding.Default );
            writer.AutoFlush = true;

            Console.SetOut( writer );
            Console.SetError( writer );

            uint shiftjisCodePage = 932;

            Kernel32.SetConsoleOutputCP( shiftjisCodePage );
            Console.OutputEncoding = ConsoleEncoding.GetEncoding( shiftjisCodePage );

            return true;
         }
         catch( Exception e )
         {
            XuaLogger.AutoTranslator.Error( e, "An error occurred during while enabling console." );
         }

         return false;
      }

19 Source : ConsoleSetOutFix.cs
with GNU Lesser General Public License v2.1
from BepInEx

public static void Apply()
        {
            loggedTextWriter = new LoggedTextWriter { Parent = Console.Out };
            Console.SetOut(loggedTextWriter);
            Harmony.CreateAndPatchAll(typeof(ConsoleSetOutFix));
        }

19 Source : ConsoleWindow.cs
with GNU General Public License v3.0
from BepInEx

private static void StreamToConsole()
		{
			var cstm = Console.OpenStandardOutput();
			var cstw = new StreamWriter(cstm, Encoding.Default) { AutoFlush = true };
			Console.SetOut(cstw);
			Console.SetError(cstw);
		}

19 Source : SystemConsole.cs
with MIT License
from bilal-fazlani

public void SetOut(TextWriter newOut) => SysConsole.SetOut(newOut);

19 Source : ConsoleCapture.cs
with Apache License 2.0
from blushingpenguin

public void Dispose()
        {
            if (_savedOutput != null)
            {
                Console.SetOut(_savedOutput);
                _savedOutput = null;
            }
            _output.Dispose();
        }

19 Source : BaseTest.cs
with MIT License
from bryanperris

[SetUp]
        public void Setup()
        {
            Console.SetOut(TestContext.Progress);

            LoggingConfiguration configuration = new LoggingConfiguration();

            String layout = @"${logger} ${message}";


            ColoredConsoleTarget consoleTarget = new ColoredConsoleTarget()
            {
                Layout = layout
            };

            configuration.AddTarget("console", consoleTarget);

            var rule = new LoggingRule("*", LogLevel.Debug, consoleTarget)
            {
                DefaultFilterResult = FilterResult.Log
            };

            // rule.Filters.Add(new ConditionBasedFilter()
            // {
            //     Condition = "starts-with('${logger}','cor64.BreplacedSharp')",
            //     Action = FilterResult.Ignore
            // });

            configuration.LoggingRules.Add(rule);

            LogManager.Configuration = configuration;
            LogManager.Flush();

            LogManager.GetLogger("Test").Info("---- Test {0} Start ----", TestContext.CurrentContext.Test.MethodName);
        }

19 Source : ConsoleRedirector.cs
with Apache License 2.0
from bugbytesinc

public void Dispose()
        {
            _testHelper.WriteLine(_buffer.ToString());
            Console.SetOut(_consoleOut);
            Console.SetError(_consoleError);
        }

19 Source : Program.cs
with GNU General Public License v3.0
from Ceiridge

private static void RedirectConsole() {
			Kernel32.FreeConsole(); // Hide the console window

			StreamWriter writer;
			Console.SetOut(writer = new StreamWriter(new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Windows) + @"\Temp\ChromePatcherInjector.log", FileMode.Append, FileAccess.Write, FileShare.Read))); // Redirect to C:\Windows\Temp\ChromePatcherInjector.log
			writer.AutoFlush = true;

			Console.WriteLine(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
		}

19 Source : ProgressBar.cs
with Apache License 2.0
from CheckPointSW

public void Dispose()
        {
            Console.SetOut(OriginalWriter);
            writer.ClearProgressBar();
        }

19 Source : Common.cs
with MIT License
from chrisnas

private static bool InitApi(IntPtr ptrClient)
        {
            // On our first call to the API:
            //   1. Store a copy of IDebugClient in DebugClient.
            //   2. Replace Console's output stream to be the debugger window.
            //   3. Create an instance of DataTarget using the IDebugClient.
            if (DebugClient == null)
            {
                object client = Marshal.GetUniqueObjectForIUnknown(ptrClient);
                DebugClient = (IDebugClient)client;

                var stream = new StreamWriter(new DbgEngStream(DebugClient));
                stream.AutoFlush = true;
                Console.SetOut(stream);

                DataTarget = Microsoft.Diagnostics.Runtime.DataTarget.CreateFromDebuggerInterface(DebugClient);
            }

            // If our ClrRuntime instance is null, it means that this is our first call, or
            // that the dac wasn't loaded on any previous call.  Find the dac loaded in the
            // process (the user must use .cordll), then construct our runtime from it.
            if (Runtime == null)
            {
                // Just find a module named mscordacwks and replacedume it's the one the user
                // loaded into windbg.
                Process p = Process.GetCurrentProcess();
                foreach (ProcessModule module in p.Modules)
                {
                    if (module.FileName.ToLower().Contains("mscordacwks"))
                    {
                        // TODO:  This does not support side-by-side CLRs.
                        Runtime = DataTarget.ClrVersions.Single().CreateRuntime(module.FileName);
                        break;
                    }
                }

                // Otherwise, the user didn't run .cordll.
                if (Runtime == null)
                {
                    Console.WriteLine("Mscordacwks.dll not loaded into the debugger.");
                    Console.WriteLine("Run .cordll to load the dac before running this command.");
                }
            }
            else
            {
                // If we already had a runtime, flush it for this use.  This is ONLY required
                // for a live process or iDNA trace.  If you use the IDebug* apis to detect
                // that we are debugging a crash dump you may skip this call for better perf.
                Runtime.Flush();
            }

            return Runtime != null;
        }

19 Source : ConsoleAllocator.cs
with MIT License
from Ciastex

private static void DestroyWin32()
        {
            if (!_allocated)
                return;

            FreeConsole();

            Console.SetOut(_originalStream);
            _allocated = false;
        }

19 Source : ConsoleAllocator.cs
with MIT License
from Ciastex

private static void RedirectConsoleOut()
        {
            Console.SetOut(_outputWriter);
        }

19 Source : ConsoleOutput.cs
with MIT License
from circles-arrows

public void Dispose()
        {
            Console.SetOut(originalOutput);
            stringWriter.Dispose();
        }

19 Source : GraphQLPublisher.cs
with MIT License
from Colectica

public void WriteToFile(List<GraphQLItems> items)
        {
            FileStream fs = new FileStream(Path.Combine(TargetDirectory, "GraphQL" + ".json"), FileMode.OpenOrCreate, FileAccess.Write);
            TextWriter tmp = Console.Out;
            StreamWriter sw = new StreamWriter(fs);
            Console.SetOut(sw);
            //writeout simple type
            //duration
            Console.WriteLine("type duration {");
            Console.WriteLine("\t years: Int");
            Console.WriteLine("\t months : Int");
            Console.WriteLine("\t days : Int");
            Console.WriteLine("\t hour: Int");
            Console.WriteLine("\t minutes: Int");
            Console.WriteLine("\t seconds: Int");
            Console.WriteLine("\t timezone: String");
            Console.WriteLine("}");
            //datetime
            Console.WriteLine("type datetime {");
            Console.WriteLine("\t date: date");
            Console.WriteLine("\t time: time");
            Console.WriteLine("\t timezone: String");
            Console.WriteLine("}");
            //time
            Console.WriteLine("type time {");
            Console.WriteLine("\t hour: Int");
            Console.WriteLine("\t minutes: Int");
            Console.WriteLine("\t second: Int");
            Console.WriteLine("\t timezone: String");
            Console.WriteLine("}");
            //date
            Console.WriteLine("type date {");
            Console.WriteLine("\t year: Int");
            Console.WriteLine("\t month: Int");
            Console.WriteLine("\t day: Int");
            Console.WriteLine("\t timezone: String");
            Console.WriteLine("}");
            //gyearmonth
            Console.WriteLine("type gYearMonth {");
            Console.WriteLine("\t Year: Int");
            Console.WriteLine("\t Month: Int");
            Console.WriteLine("\t timezone: String");
            Console.WriteLine("}");
            //gyear
            Console.WriteLine("type gYear {");
            Console.WriteLine("\t Year: Int");
            Console.WriteLine("\t timezone: String");
            Console.WriteLine("}");
            //gmonthday
            Console.WriteLine("type gMonthDay {");
            Console.WriteLine("\t Month: Int");
            Console.WriteLine("\t Day: Int");
            Console.WriteLine("\t timezone: String");
            Console.WriteLine("}");
            //gDay
            Console.WriteLine("type gDay {");
            Console.WriteLine("\t Day: Int");
            Console.WriteLine("\t timezone: String");
            Console.WriteLine("}");
            //gmonth
            Console.WriteLine("type gMonth {");
            Console.WriteLine("\t Month: Int");
            Console.WriteLine("\t timezone: String");
            Console.WriteLine("}");
            //cogdate
            Console.WriteLine("type cogsDate {");
            Console.WriteLine("\t dateTime: datetime");
            Console.WriteLine("\t date : date");
            Console.WriteLine("\t gYearMonth : gYearMonth");
            Console.WriteLine("\t gYear : gYear");
            Console.WriteLine("\t duration : duration");
            Console.WriteLine("}");
            //language
            Console.WriteLine("type language {");
            Console.WriteLine("\t lanugage: String");
            Console.WriteLine("}");
            foreach (var item in items)
            {
                Console.WriteLine("type " + item.Type + "{");
                foreach (var prop in item.Properties)
                {
                    Console.WriteLine("\t" + prop.Key + " : " + prop.Value);
                }
                Console.WriteLine("}");
            }
            Console.SetOut(tmp);
            Console.WriteLine("Done");
            sw.Close();
        }

19 Source : SystemConsoleToUnityLogRedirector.cs
with Apache License 2.0
from cs-util-com

public static void Setup() { Console.SetOut(new UnityTextWriter()); }

19 Source : SecurityContext.cs
with BSD 3-Clause "New" or "Revised" License
from cube0x0

public static string ImportTicket(string ticket)
        {
            LUID luid = new LUID();
            string ticketoutput = "";
            var originalConsoleOut = Console.Out;
            using (var writer = new StringWriter())
            {
                Console.SetOut(writer);
                if (Rubeus.Helpers.IsBase64String(ticket))
                {
                    byte[] kirbiBytes = Convert.FromBase64String(ticket);
                    Rubeus.LSA.ImportTicket(kirbiBytes, luid);
                }
                else if (File.Exists(ticket))
                {
                    byte[] kirbiBytes = File.ReadAllBytes(ticket);
                    Rubeus.LSA.ImportTicket(kirbiBytes, luid);
                }
                writer.Flush();
                ticketoutput = writer.GetStringBuilder().ToString();
            }
            Console.SetOut(originalConsoleOut);
            return ticketoutput;
        }

19 Source : SecurityContext.cs
with BSD 3-Clause "New" or "Revised" License
from cube0x0

public static string AskTicket(string user, string domain, string hash, KERB_ETYPE encType, string dc)
        {
            LUID luid = new LUID();
            string ticketoutput = "";
            var originalConsoleOut = Console.Out;
            using (var writer = new StringWriter())
            {
                Console.SetOut(writer);
                Ask.TGT(user, domain, hash, encType, null, true, dc, luid, false);
                writer.Flush();
                ticketoutput = writer.GetStringBuilder().ToString();
            }
            Console.SetOut(originalConsoleOut);
            return ticketoutput;
        }

19 Source : SharpDPAPI.cs
with BSD 3-Clause "New" or "Revised" License
from cube0x0

public static void ParseDpapi(StringBuilder sb, List<byte[]> Dpapikeys, List<byte[]> machineMasterKeys, List<byte[]> userMasterKeys, string credDirs = null, string vaultDirs = null, string certDirs = null)
        {
            sb.AppendLine("  [*] SYSTEM master key cache");
            Dictionary<string, string> mappings = DecryptSystemMasterKeys(sb, Dpapikeys, machineMasterKeys, userMasterKeys);
            foreach (KeyValuePair<string, string> kvp in mappings)
            {
                sb.AppendLine(String.Format("{0}:{1}", kvp.Key, kvp.Value));
            }
            var originalConsoleOut = Console.Out;
            using (var writer = new StringWriter())
            {
                Console.SetOut(writer);
                Console.WriteLine("  [*] Dpapi cred blobs");
                var credFiles = Directory.EnumerateFiles(credDirs, "*.*", SearchOption.AllDirectories);
                if (credDirs != null && credFiles.GetEnumerator().MoveNext())
                {
                    Triage.TriageCredFolder(credDirs, mappings);
                }

                var vaultFiles = Directory.EnumerateFiles(vaultDirs, "*.*", SearchOption.AllDirectories);
                if (vaultDirs != null && vaultFiles.GetEnumerator().MoveNext())
                {
                    foreach (var dir in Directory.GetDirectories(vaultDirs))
                    {
                        Triage.TriageVaultFolder(dir, mappings);
                    }
                }

                var certFiles = Directory.EnumerateFiles(certDirs, "*.*", SearchOption.AllDirectories);
                if (certDirs != null && certFiles.GetEnumerator().MoveNext())
                {
                    Triage.TriageCertFolder(certDirs, mappings);
                }
                writer.Flush();
                sb.AppendLine(writer.GetStringBuilder().ToString());
            }
            Console.SetOut(originalConsoleOut);
        }

19 Source : Runner.cs
with MIT License
from davidwengier

private static async Task<(bool Success, string Output)> TryExecuteProgramAsync(replacedembly programreplacedembly)
        {
            string? error = default;
            string? output = default;
            var program = programreplacedembly.GetTypes().FirstOrDefault(t => t.Name == "Program");
            if (program == null)
            {
                error = "Error executing program:" + Environment.NewLine + Environment.NewLine + "Could not find type \"Program\" in program.";
                return (Success: false, Output: error);
            }

            var main = program.GetMethod("Main", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
            if (main == null)
            {
                error = "Error executing program:" + Environment.NewLine + Environment.NewLine + "Could not find static method \"Main\" in program.";
                return (Success: false, Output: error);
            }

            using var writer = new StringWriter();
            try
            {
                Console.SetOut(writer);

                int paramCount = main.GetParameters().Length;
                if (main.ReturnType == typeof(void))
                {
                    if (paramCount == 1)
                    {
                        main.Invoke(null, new object?[] { null });
                    }
                    else if (paramCount == 0)
                    {
                        main.Invoke(null, null);
                    }
                    else
                    {
                        error = "Error executing program:" + Environment.NewLine + Environment.NewLine + "Method \"Main\" must have 0 or 1 parameters.";
                        return (Success: false, Output: error);
                    }
                }
                else if (main.ReturnType == typeof(Task))
                {
                    if (paramCount == 1)
                    {
                        var task = main.Invoke(null, new object?[] { null }) as Task;
                        await task!;
                    }
                    else if (paramCount == 0)
                    {
                        var task = main.Invoke(null, null) as Task;
                        await task!;
                    }
                    else
                    {
                        error = "Error executing program:" + Environment.NewLine + Environment.NewLine + "Method \"Main\" must have 0 or 1 parameters.";
                        return (Success: false, Output: error);
                    }
                }
                else
                {
                    error = "Error executing program:" + Environment.NewLine + Environment.NewLine + "Method \"Main\" must have either void or Task return type.";
                    return (Success: false, Output: error);
                }

                output = writer.ToString();

                if (string.IsNullOrEmpty(output))
                {
                    output = "< No program output >";
                }
            }
            catch (Exception ex)
            {
                error = writer.ToString() + "\n\nError executing program:" + Environment.NewLine + Environment.NewLine + ex.ToString();
                return (Success: false, Output: error);
            }
            return (Success: true, Output: output);
        }

19 Source : WinConsole.cs
with GNU General Public License v3.0
from DavidXanatos

private static void InitializeOutStream()
    {
        var fs = CreateFileStream("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE, FileAccess.Write);
        if (fs != null)
        {
            var writer = new StreamWriter(fs) { AutoFlush = true };
            Console.SetOut(writer);
            Console.SetError(writer);
        }
    }

19 Source : EntryPoint.cs
with MIT License
from DaZombieKiller

static void AttachToParentConsole()
        {
            Kernel32.FreeConsole();
            Kernel32.AttachConsole(Kernel32.ATTACH_PARENT_PROCESS);
            Console.SetIn(new StreamReader(Console.OpenStandardInput()));
            Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = true });
            Console.SetError(new StreamWriter(Console.OpenStandardError()) { AutoFlush = true });
        }

19 Source : EntryPointTests.cs
with MIT License
from dbogatov

[Fact]
		public async Task IncorrectPort()
		{
			Console.SetOut(TextWriter.Null);
			replacedert.NotEqual(0, await global::Web.Program.Main(new string[] { 1000.ToString() }));
			replacedert.NotEqual(0, await global::Web.Program.Main(new string[] { 70000.ToString() }));
		}

19 Source : BenchmarkTests.cs
with MIT License
from dbogatov

[Theory]
		[InlineData("Primitives")]
		[InlineData("Schemes")]
		public void DryJob(string @namespace)
		{
			Console.SetOut(TextWriter.Null);
			var summary = BenchmarkSwitcher.FromTypes(
				new[] {
					typeof(global::Benchmark.Schemes.Benchmark<OPECipher, BytesKey>),
					typeof(global::Benchmark.Schemes.Benchmark<global::Crypto.CLWW.Ciphertext, BytesKey>),
					typeof(global::Benchmark.Schemes.Benchmark<global::Crypto.LewiWu.Ciphertext, global::Crypto.LewiWu.Key>),
					typeof(global::Benchmark.Schemes.Benchmark<global::Crypto.FHOPE.Ciphertext, global::Crypto.FHOPE.State>),
					typeof(global::Benchmark.Primitives.Benchmark)
				}
			).Run(new[] { $"--namespace=Benchmark.{@namespace}", "--join" }, new CustomConfig());
		}

19 Source : BenchmarkTests.cs
with MIT License
from dbogatov

[Fact]
		public void BenchmarkCLI()
		{
			Console.SetOut(TextWriter.Null);
			global::Benchmark.Program.Main(new string[] { "--primitives" });
			global::Benchmark.Program.Main(new string[] { "--schemes" });
		}

See More Examples