Commit a4d7afb4 authored by AP matsuo koji's avatar AP matsuo koji 😲

Verify modeの追加

parent c95477a8
......@@ -318,7 +318,8 @@ namespace CSRender {
UtHash.HashData inHashDataTgt = null,
UtHash.HashData inHashDataRef = null,
bool bPDFium = false,
int nPageThreadNum = 4
int nPageThreadNum = 4,
bool bVerify = false
// 比較結果を返す ページ番号とメッセージ
) {
var bDump = Check.bDump;
......@@ -389,7 +390,6 @@ namespace CSRender {
var strm = RenderPageStream(docG:docGRef, index:(int)i-1, pm:pm);
return strm;
}
// ターゲット処理
if (tgtHf == null) {
tgtStrm = RendPageTGT();// Render
......@@ -413,7 +413,14 @@ namespace CSRender {
var dateStr = DateTime.Now.ToString();
//Console.WriteLine($@"tgt={i}:{tgtHash}");
//Console.WriteLine($@"ref={i}:{refHash}");
//bool bVerify=true;
if (bVerify){
String p=null;
p=Path.Combine( otDir,"TGT");
if (!Directory.Exists(p)) Directory.CreateDirectory(p);
p=Path.Combine( otDir,"REF");
if (!Directory.Exists(p)) Directory.CreateDirectory(p);
}
if (tgtHash != refHash) {
// no match
// nRet = 1;
......@@ -427,7 +434,10 @@ namespace CSRender {
// diffのjpegを書き出してみる(tgt)
if (tgtStrm == null)
tgtStrm = RendPageTGT();
var otPath = Path.Combine(otDir, $"{otBaseName}.{i}.tgt.{otExtention}");
var otPath = bVerify ?
Path.Combine(otDir, "TGT",$"{otBaseName}.{i}.{otExtention}")
:
Path.Combine(otDir, $"{otBaseName}.{i}.tgt.{otExtention}");
using(var bmp = new System.Drawing.Bitmap(tgtStrm)){
var imEnc = new UtImage.Enc(pm.ImageType) { JpegQuality = pm.JpegQ };// Init membrers.
bmp.SetResolution((float)pm.Dpi, (float)pm.Dpi);
......@@ -437,7 +447,11 @@ namespace CSRender {
// diffのjpegを書き出してみる(ref)
if (refStrm == null)
refStrm = RendPageREF();
otPath = Path.Combine(otDir, $"{otBaseName}.{i}.ref.{otExtention}");
otPath = bVerify ?
Path.Combine(otDir, "REF",$"{otBaseName}.{i}.{otExtention}")
:
Path.Combine(otDir, $"{otBaseName}.{i}.ref.{otExtention}");
using(var bmp = new System.Drawing.Bitmap(refStrm)){
var imEnc = new UtImage.Enc(pm.ImageType) { JpegQuality = pm.JpegQ };// Init membrers.
bmp.SetResolution((float)pm.Dpi, (float)pm.Dpi);
......
......@@ -69,6 +69,8 @@ namespace CSRenderMain {
// データはWCFの通信データを使う。引数はPipeName:PortAddressNameとする
[DataMember]
public bool bVerbose = false;// 詳細デバッグ
[DataMember]
public bool bVerify = false;// 詳細デバッグ
public ParamData Clone() {
return (ParamData)MemberwiseClone();
......@@ -137,6 +139,7 @@ For more information,see /H /? or /?
事前に/MkHashを実行しておくことで高速に処理できる
/Tgt|Target <<Target PDF|PDF dir>> : ターゲットファイル指定
/Ref|Reference <<Reference PDF|PDF dir>> : リファレンスファイル指定(比較先)
/Verify : PureVerify mode. Diff画像をTGTとREFのサブ階層に出力する
/Result <result file> : 比較結果を格納するファイルパス
/FCコマンドを指定すると一致したら0,不一致なら1を返却するようになる
<result file>は、<pageNum(1始まり)>,<[OK] or [@Difference]>の行で構成される
......@@ -302,6 +305,8 @@ For more information,see /H /? or /?
pm.bExeSepa = false;
} else if (isOpt("/RESULT")) {
pm.resultPath = getValue(""); // next value.
} else if (isOpt("/Verify")) {
pm.bVerify = true;
} else if (wd.First() == '/') {
// 処理の無いオプションを明示的に無視する
Console.WriteLine($"Warning::Ignore opt:{wd}");
......@@ -470,7 +475,8 @@ For more information,see /H /? or /?
inHashDataTgt: hashDataTgt,
inHashDataRef: hashDataRef,
bPDFium : pm.bPDFium,
nPageThreadNum: pm.paraPage
nPageThreadNum: pm.paraPage,
bVerify : pm.bVerify
);
} else {
// Sync version.
......@@ -711,7 +717,8 @@ For more information,see /H /? or /?
inHashDataTgt: hashDataTgt,
inHashDataRef: hashDataRef,
bPDFium: pm.bPDFium,
nPageThreadNum:pm.paraPage
nPageThreadNum:pm.paraPage,
bVerify : pm.bVerify
);
if ( ret > 0 ) {
// retは不一致ページ数
......@@ -762,7 +769,8 @@ For more information,see /H /? or /?
inHashDataTgt: hashDataTgt,
inHashDataRef: hashDataRef,
bPDFium: pm.bPDFium,
nPageThreadNum:pm.paraPage
nPageThreadNum:pm.paraPage,
bVerify : pm.bVerify
);
} else { // Sync version(Paralles).
......
......@@ -19,6 +19,7 @@ include::config.adoc[]
* V1.3.2.x:2022/05/08 :
- /fc時のhashFile異常時にhashFileを再作成する。PDFファイル更新をチェック
- /fc時のターゲットとリファレンスの同一パスを禁止
- /fc時のVerifyMode追加
* V1.3.2.0:2021/12/20 :aRGB4チャンネル保存からRGB3チャンネルに変更
* V1.3.1.0:2021/10/04 :UWP用、Data.pdfの削除、整理
- UWP用コード削除。通常のファイルアクセスやMemoryStreamに変更
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment