Ejemplo n.º 1
0
 protected virtual CovProc RunSupported(String tid, SupportedL sp, FCfg cfg, Args args, String src, String dst_f)
 {
     CovProc cov = null;
     String prefix = "";
     int maxw, maxh;
     switch (sp)
     {
         case SupportedL.Word:
             args.IntVal(3, out maxw, 768);
             args.IntVal(4, out maxh, 1024);
             args.StringVal(5, out prefix, "");
             cov = new WordCov(src, dst_f, maxw, maxh);
             break;
         case SupportedL.Excel:
             args.IntVal(3, out maxw, 768);
             args.IntVal(4, out maxh, 1024);
             args.StringVal(5, out prefix, "");
             cov = new ExcelCov(src, dst_f, maxw, maxh, cfg.Val("density_x", 96), cfg.Val("density_y", 96));
             break;
         case SupportedL.PowerPoint:
             args.StringVal(3, out prefix, "");
             cov = new PowerPointCov(src, dst_f);
             break;
         case SupportedL.Pdf:
             args.IntVal(3, out maxw, 768);
             args.IntVal(4, out maxh, 1024);
             args.StringVal(5, out prefix, "");
             cov = new PdfCov(src, dst_f, maxw, maxh, cfg.Val("density_x", 96), cfg.Val("density_y", 96));
             break;
         case SupportedL.Img:
             args.IntVal(3, out maxw, 768);
             args.IntVal(4, out maxh, 1024);
             args.StringVal(5, out prefix, "");
             cov = new ImgCov(src, dst_f, maxw, maxh);
             break;
         default:
             throw new ArgumentException("the not supported command", "sp");
     }
     cov.State = tid;
     cov.Proc = this.OnCovProc;
     cov.ShowLog = cfg.Val("showlog", 0) == 1;
     cov.Exec();
     cov.Dispose();
     if (prefix.Length > 0)
     {
         cov.Result.Trim(prefix);
     }
     return cov;
 }
Ejemplo n.º 2
0
 protected virtual void RunSupported(String tid, SupportedL sp, FCfg cfg, Args args, String cmds)
 {
     String src, dst_f;
     if (!(args.StringVal(1, out src) && args.StringVal(2, out dst_f)))
     {
         throw new ArgumentException("Word argument is invalid, please confirm arguments using by <src dst_f maxw maxh>");
     }
     ThreadPool.QueueUserWorkItem(this.RunSupportedProc_, new object[] { tid, sp, cfg, args, cmds, src, dst_f });
 }