Exemple #1
0
 public WordToPdfThread(string name, WordViewPdfParams parameters)
 {
     _wordApiFunctions = new WordApiFunctions();
     thread            = new Thread(Func);
     thread.Name       = name;
     thread.Start(parameters);
 }
Exemple #2
0
 public WordViewPdfParams(WordViewPdfParams parameters)
 {
     Config         = parameters.Config;
     SourceFileName = parameters.SourceFileName;
     SourceFileType = parameters.SourceFileType;
     ResultFileName = parameters.ResultFileName;
     ResultFileType = parameters.ResultFileType;
     Offset         = parameters.Offset;
     Count          = parameters.Count;
     FileNumber     = parameters.FileNumber;
 }
Exemple #3
0
        void Func(object parameters)
        {
            var timer = new Stopwatch();

            if (!Directory.Exists(ConfigurationManager.AppSettings["SourcePath"] + "metrics/"))
            {
                Directory.CreateDirectory(ConfigurationManager.AppSettings["SourcePath"] + "metrics/");
            }

            Stream outFileStream = new FileStream("C:/docconversion/metrics/" + Thread.CurrentThread.Name + ".txt", FileMode.OpenOrCreate, FileAccess.ReadWrite);
            var    outFile       = new StreamWriter(outFileStream);
            var    data          = new WordViewPdfParams((WordViewPdfParams)parameters);

            timer = Stopwatch.StartNew();
            _wordApiFunctions.PdfViewer(data.Config, data.SourceFileName, data.SourceFileType, data.ResultFileName, data.ResultFileType, data.Offset, data.Count);
            timer.Stop();
            outFile.Write(Thread.CurrentThread.Name + " executing time: " + timer.ElapsedMilliseconds + " \n\n");
            outFile.Write("Average upload time for file: " + timer.ElapsedMilliseconds / data.Count + "\n");
            Thread.Sleep(0);
            outFile.Close();
            //outFileStream.Close();
        }