This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| namespace RunProcessAsTask | |
| { | |
| public static partial class ProcessEx | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading.Tasks; | |
| using Microsoft.AspNetCore.Builder; | |
| using Microsoft.AspNetCore.Hosting; | |
| using Microsoft.AspNetCore.HttpsPolicy; | |
| using Microsoft.AspNetCore.Mvc; | |
| using Microsoft.Extensions.Configuration; | |
| using Microsoft.Extensions.DependencyInjection; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private async Task<DtoEst> LoadEinkommenssteuerAsync() | |
| { | |
| await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision); | |
| DtoEst dto = new DtoEst(); | |
| var url = "https://www.bmf-steuerrechner.de/ekst/eingabeformekst.xhtml"; | |
| #region SELECTORS | |
| // https://stackoverflow.com/questions/45110893/select-elements-by-attributes-with-colon | |
| // use css escapes: https://mothereff.in/css-escapes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private async Task<DtoEst> LoadXXXAsync() | |
| { | |
| // downloads chromium to the local project, needed by Puppeteer Sharp for execution, takes about 2 min! | |
| await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision); | |
| DtoEst dto = new DtoEst(); | |
| var url = "https://www.xxxxxx.xhtml"; | |
| #region SELECTORS | |
| // https://stackoverflow.com/questions/45110893/select-elements-by-attributes-with-colon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var path = @"C:\Users\Admin\Documents\Visual Studio 2019\Projects\PuppeteerCSarpTest\bin\Debug\PuppeteerCSarpTest.exe"; | |
| AssemblyName an = AssemblyName.GetAssemblyName(path); | |
| byte[] pt = an.GetPublicKeyToken(); | |
| pt = an.GetPublicKeyToken(); | |
| var length = pt.GetLength(0); | |
| Console.WriteLine("9ad46d957f307217".Length); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Server.exe: | |
| var s = new Semaphore(0, 1, Constants.SemaphoreName); // public static readonly string SemaphoreName = @"Global\semName"; | |
| var p = Process.Start(@"C:\Users\...\Debug\IpcChannelClient.exe"); | |
| p.EnableRaisingEvents = true; | |
| p.Exited += P_Exited; | |
| //p.WaitForExit(); | |
| Console.WriteLine("Entering waitone at: " + DateTime.Now.ToLocalTime()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // If you are using **IIS Express** as host, then use `Server features` to increase the `MaxRequestBodySize` | |
| public void Configure(IApplicationBuilder app, IWebHostEnvironment env) | |
| { | |
| app.Use(async (context, next) => | |
| { | |
| context.Features.Get<IHttpMaxRequestBodySizeFeature>().MaxRequestBodySize = null; // unlimited I guess | |
| await next.Invoke(); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // UploadController Action: | |
| [HttpPost] | |
| [DisableFormValueModelBinding] | |
| [ValidateAntiForgeryToken] | |
| [DisableRequestSizeLimit] | |
| public async Task<IActionResult> UploadPhysicalStreamed() | |
| { | |
| if (!MultipartRequestHelper.IsMultipartContentType(Request.ContentType)) | |
| { | |
| ModelState.AddModelError("File", $"The request couldn't be processed (Error 1)."); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Upload string base64 encoded image to MVC action | |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| base64 = (() => { | |
| const encodeAsync = async (str, mimeType = { type: 'text/html' }) => { | |
| return new Promise((resolve, reject) => { | |
| // Create the Blob object (of course, it can be of any type and defined in any way) | |
| var blob = new Blob([str], mimeType); // , { type: 'text/html' } is default if not specified | |
| // Define the FileReader which is able to read the contents of Blob | |
| var reader = new FileReader(); | |
| // The magic always begins after the Blob is successfully loaded | |
| reader.onload = () => { | |
| // Since it contains the Data URI, we should remove the prefix and keep only Base64 string |
OlderNewer