public void TestImgCov2() { ImgCov cov = new ImgCov("test\\xx.jpg", "img2.jpg"); cov.Exec(); cov.Dispose(); Assert.AreEqual(0, cov.Fails.Count); }
public void TestImgCov3() { ImgCov cov = new ImgCov("F:/sdata_i/www/u_57330b08bc9a34219700001c.jpg","F:/sdata_o/www/u_57330b08bc9a34219700001c.jpg"); cov.Exec(); cov.Dispose(); //Console.WriteLine(cov.Fails[0]); Assert.AreEqual(0, cov.Fails.Count); }
static void Main(string[] args) { try { var cargs = Args.parseArgs(new string[] { "w", "e", "p", "l", "pdf","i" }, args, 0); var log = cargs.Exist("l"); var w = cargs.Exist("w"); var e = cargs.Exist("e"); var p = cargs.Exist("p"); var pdf = cargs.Exist("pdf"); var i = cargs.Exist("i"); int width, height; cargs.IntVal("W", out width, 768); cargs.IntVal("h", out height, 1024); double densityx, densityy; cargs.DoubleVal("dx", out densityx, 96); cargs.DoubleVal("dy", out densityy, 96); int beg = 0; cargs.IntVal("beg", out beg, 0); int maxc; cargs.IntVal("maxc", out maxc, 16); TaskPool.Shared.MaximumConcurrency = maxc; if (cargs.Vals.Count < 2) { Usage(); Environment.ExitCode = 1; return; } L.D("cswf-doc is starting..."); CovProc cov; if (w) { L.D("cswf-doc do doc converter"); cov = new WordCov(cargs.Vals[0], cargs.Vals[1], width, height, beg); } else if (e) { L.D("cswf-doc do xls converter"); cov = new ExcelCov(cargs.Vals[0], cargs.Vals[1], width, height, densityx, densityy, beg); } else if (p) { L.D("cswf-doc do ppt converter"); cov = new PowerPointCov(cargs.Vals[0], cargs.Vals[1], beg); } else if (pdf) { L.D("cswf-doc do pdf converter"); cov = new PdfCov(cargs.Vals[0], cargs.Vals[1], width, height, densityx, densityy, beg); } else if (i) { L.D("cswf-doc do image converter"); cov = new ImgCov(cargs.Vals[0], cargs.Vals[1], width, height, beg); } else { Usage(); Environment.ExitCode = 1; return; } cov.ShowLog = log; cov.Exec(); cov.Dispose(); if (cov.Result.Code != 0) { cov.PrintFails(); Environment.ExitCode = cov.Result.Code; } else { var res = cov.Result; string prefix = ""; if (cargs.StringVal("prefix", out prefix)) { res.Trim(prefix); } string json = ""; if (cargs.StringVal("o", out json)) { L.D("converter saving result to json file({0})", json); res.Save(json); } Environment.ExitCode = 0; } } catch (Exception e) { L.E(e, "do converter error by args({0})->", String.Join(",", args), e.Message); Environment.ExitCode = 1; } finally { WordCov.Cached.Clear(); ExcelCov.Cached.Clear(); } L.D("do converter done..."); }