예제 #1
0
        static async Task Main(string[] args)
        {
            var server = new TFPluginServer();

            server.Prepare(args);

            var log = server.Services.GetRequiredService <ILogger <PluginMain> >();

            log.LogInformation("TF Plugin Server prepared");

            log.LogInformation("Running Plugin Server...");
            await server.RunAsync();

            log.LogInformation("Plugin Server exited");
        }
예제 #2
0
        static async Task Main(string[] args)
        {
            var server = new TFPluginServer();

            server.Prepare(args);

            var log = server.Services.GetRequiredService <ILogger <PluginMain> >();

            log.LogInformation("TF Plugin Server prepared");

            var logFactory = server.Services.GetRequiredService <ILoggerFactory>();

            MsgPackSharp.Logging.Factory = new MPLogFactory(logFactory);

            log.LogInformation("Running Plugin Server...");
            await server.RunAsync();

            log.LogInformation("Plugin Server exited");

            // var rs = System.Management.Automation.Runspaces.Runspace.DefaultRunspace;
            // var rs2 = System.Management.Automation.Runspaces.RunspaceFactory.CreateRunspace();
            // var init = System.Management.Automation.Runspaces.InitialSessionState.Create();

            // using var ps = PowerShell.Create();
            // ps.Runspace.SessionStateProxy.SetVariable("foo", "FOOVALUE");

            // if (args?.Length > 0)
            // {
            //     foreach (var a in args)
            //     {
            //         var result = ps.AddScript(a).Invoke();

            //         foreach (var e in ps.Streams.Error)
            //             Console.Error.WriteLine(e.ToString());

            //         foreach (var w in ps.Streams.Warning)
            //             Console.Error.WriteLine(w.ToString());

            //         foreach (var r in result)
            //             Console.WriteLine("Result: {0}",
            //                 (r ?? "(NULL)").ToString()); //JsonSerializer.Serialize());

            //     }
            // }
        }