Exemplo n.º 1
0
 private void Convert(string infile, string outfile, ILogger logger = null)
 {
     using (var chrome = new ChromeProcess())
     {
         chrome.EnsureRunning();
         ConvertWithProcess(chrome, infile, outfile);
     }
 }
Exemplo n.º 2
0
 public void StressTest()
 {
     using (var chrome = new ChromeProcess())
     {
         chrome.EnsureRunning();
         var infile = Guid.NewGuid() + ".xml";
         infile = Path.Combine(Path.GetTempPath(), infile);
         File.WriteAllText(infile, _xmlFileContent);
         for (var i = 0; i < 100; i++)
         {
             var outfile = Guid.NewGuid() + ".pdf";
             outfile = Path.Combine(Path.GetTempPath(), outfile);
             ConvertWithProcess(chrome, infile, outfile);
         }
     }
 }
Exemplo n.º 3
0
        public void TreadingStressTest()
        {
            using (var chrome = new ChromeProcess())
            {
                chrome.EnsureRunning();
                var infile = Guid.NewGuid() + ".xml";
                infile = Path.Combine(Path.GetTempPath(), infile);
                File.WriteAllText(infile, _xmlFileContent);
                var tasks = new List <Task>();
                for (var i = 0; i < 100; i++)
                {
                    tasks.Add(Task.Run(() =>
                    {
                        var outfile = Guid.NewGuid() + ".pdf";
                        outfile     = Path.Combine(Path.GetTempPath(), outfile);
                        ConvertWithProcess(chrome, infile, outfile);
                    }));
                }

                Task.WaitAll(tasks.ToArray());
            }
        }