From 8df4d68fc2f50debce968cb0023b245c579b8834 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Tue, 23 May 2023 16:35:53 +0200 Subject: [PATCH] Gestione cmp footer --- TestExtProc/Program.cs | 78 +++++++++++++++++++ TestExtProc/TestExtProc.csproj | 10 +++ WebDoorCreator.CamSrv.sln | 6 ++ .../Components/Gen/CmpFooter.razor | 2 +- WebDoorCreator.UI/Pages/_Layout.cshtml | 5 +- WebDoorCreator.UI/Shared/MainLayout.razor | 13 +--- 6 files changed, 102 insertions(+), 12 deletions(-) create mode 100644 TestExtProc/Program.cs create mode 100644 TestExtProc/TestExtProc.csproj diff --git a/TestExtProc/Program.cs b/TestExtProc/Program.cs new file mode 100644 index 0000000..0d1d158 --- /dev/null +++ b/TestExtProc/Program.cs @@ -0,0 +1,78 @@ +// See https://aka.ms/new-console-template for more information +using System.Diagnostics; +using System.Net.Security; +using System.Text; + +int lineCount = 0; +//StringBuilder output = new StringBuilder(); + + +void OutputHandler(object sender, DataReceivedEventArgs e) +{ + if (!string.IsNullOrEmpty(e.Data)) + { + Console.WriteLine($"RIPOSTA PROCESSO [{lineCount}] - {e.Data}"); + if (e.Data == "SUCCESS") + { + lineCount += 1; + } + } +}; + +var domanda = "Sai chi ti saluta tantissimo?"; + +Console.WriteLine(domanda); + +// Create a new process object +Process p = new Process(); + +// Specify the file name of the external exe +p.StartInfo.FileName = @"C:\Temp\TestEcho.bat"; +p.StartInfo.UseShellExecute = false; +p.StartInfo.RedirectStandardOutput = true; +p.StartInfo.RedirectStandardInput = true; +//var stdIn = p.StandardInput; +p.OutputDataReceived += (s, e) => OutputHandler(s, e); + +// Optionally, specify any arguments for the exe +//p.StartInfo.Arguments = domanda; + +// Start the process +p.Start(); + +p.StandardInput.WriteLine(domanda); + +p.BeginOutputReadLine(); + +while (!p.HasExited) +{ + //Console.WriteLine(output.ToString()); + Thread.Sleep(500); + //var inVar = Console.ReadLine(); + //// mando nuovo input... + //p.StandardInput.WriteLine(domanda); + Thread.Sleep(500); + // mando nuovo input... + p.StandardInput.WriteLine(domanda); + Thread.Sleep(500); + // mando nuovo input... + p.StandardInput.WriteLine(domanda); + Thread.Sleep(500); + // mando nuovo input... + p.StandardInput.WriteLine(domanda); + Thread.Sleep(500); + // mando nuovo input... + p.StandardInput.WriteLine("escape"); +} + + +// Optionally, wait for the process to exit +p.WaitForExit(); + + +p.Close(); + +Console.WriteLine("Ho finito..."); +Console.WriteLine("...press return to close"); + +Console.ReadLine(); \ No newline at end of file diff --git a/TestExtProc/TestExtProc.csproj b/TestExtProc/TestExtProc.csproj new file mode 100644 index 0000000..74abf5c --- /dev/null +++ b/TestExtProc/TestExtProc.csproj @@ -0,0 +1,10 @@ + + + + Exe + net6.0 + enable + enable + + + diff --git a/WebDoorCreator.CamSrv.sln b/WebDoorCreator.CamSrv.sln index ece10f0..9f221bd 100644 --- a/WebDoorCreator.CamSrv.sln +++ b/WebDoorCreator.CamSrv.sln @@ -7,6 +7,8 @@ Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "WebDoorCreator.CamSrv", "We EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebDoorCreator.SDK", "WebDoorCreator.SDK\WebDoorCreator.SDK.csproj", "{4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestExtProc", "TestExtProc\TestExtProc.csproj", "{88099151-7136-4825-9B5D-B5A6899FD0AF}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -21,6 +23,10 @@ Global {4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Debug|Any CPU.Build.0 = Debug|Any CPU {4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Release|Any CPU.ActiveCfg = Release|Any CPU {4A07ADFC-CA24-4135-BA97-3B8E5D49BC09}.Release|Any CPU.Build.0 = Release|Any CPU + {88099151-7136-4825-9B5D-B5A6899FD0AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {88099151-7136-4825-9B5D-B5A6899FD0AF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {88099151-7136-4825-9B5D-B5A6899FD0AF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {88099151-7136-4825-9B5D-B5A6899FD0AF}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/WebDoorCreator.UI/Components/Gen/CmpFooter.razor b/WebDoorCreator.UI/Components/Gen/CmpFooter.razor index d393ac8..93698f5 100644 --- a/WebDoorCreator.UI/Components/Gen/CmpFooter.razor +++ b/WebDoorCreator.UI/Components/Gen/CmpFooter.razor @@ -3,7 +3,7 @@ Web Door Creator @(DateTime.Today.Year) | v.@version
- @($"{DateTime.Now:HH:mm:ss}") | Egalware + @($"{DateTime.Now:HH:mm:ss}") | Egalware
diff --git a/WebDoorCreator.UI/Pages/_Layout.cshtml b/WebDoorCreator.UI/Pages/_Layout.cshtml index c553540..864d631 100644 --- a/WebDoorCreator.UI/Pages/_Layout.cshtml +++ b/WebDoorCreator.UI/Pages/_Layout.cshtml @@ -65,7 +65,7 @@ @RenderBody() -
+ @*
Web Door Creator @(DateTime.Today.Year) @@ -74,7 +74,8 @@ @($"{DateTime.Now:HH:mm:ss}") | Powered by: Egalware
-
+
*@ + @*