Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KenPanCS
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QCD
Tools
KenPanCS
Commits
1273d2ed
Commit
1273d2ed
authored
May 08, 2022
by
AP matsuo koji
😲
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HashFile不正時(古いなど)、HashFileを削除して再作成する
parent
5584ca82
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
2 deletions
+53
-2
CSRender.cs
CSRender/CSRender.cs
+19
-0
Program.cs
CSRender/Program.cs
+34
-2
No files found.
CSRender/CSRender.cs
View file @
1273d2ed
...
@@ -619,6 +619,8 @@ namespace CSRender {
...
@@ -619,6 +619,8 @@ namespace CSRender {
public
HashHead
Head
=
new
HashHead
();
public
HashHead
Head
=
new
HashHead
();
[
DataMember
(
Order
=
1
)]
[
DataMember
(
Order
=
1
)]
public
SortedDictionary
<
string
,
HashFile
>
Files
=
new
SortedDictionary
<
string
,
HashFile
>();
public
SortedDictionary
<
string
,
HashFile
>
Files
=
new
SortedDictionary
<
string
,
HashFile
>();
// temp value
string
loadedPath
;
// メソッド
// メソッド
static
public
string
GetHashFileName
(
string
baseName
,
string
dpi
,
string
box
,
string
imType
,
string
jq
)
{
static
public
string
GetHashFileName
(
string
baseName
,
string
dpi
,
string
box
,
string
imType
,
string
jq
)
{
var
h
=
new
HashHead
();
var
h
=
new
HashHead
();
...
@@ -651,6 +653,7 @@ namespace CSRender {
...
@@ -651,6 +653,7 @@ namespace CSRender {
using
(
var
rd
=
new
FileStream
(
hashPath
,
FileMode
.
Open
,
FileAccess
.
Read
,
FileShare
.
ReadWrite
))
{
using
(
var
rd
=
new
FileStream
(
hashPath
,
FileMode
.
Open
,
FileAccess
.
Read
,
FileShare
.
ReadWrite
))
{
var
a
=
(
HashData
)
serializer
.
ReadObject
(
rd
);
var
a
=
(
HashData
)
serializer
.
ReadObject
(
rd
);
a
.
Head
.
Dirty
=
false
;
// clear
a
.
Head
.
Dirty
=
false
;
// clear
a
.
loadedPath
=
hashPath
;
return
a
;
return
a
;
}
}
}
}
...
@@ -756,6 +759,22 @@ namespace CSRender {
...
@@ -756,6 +759,22 @@ namespace CSRender {
var
v
=
Files
[
fName
].
PageHashCode
;
var
v
=
Files
[
fName
].
PageHashCode
;
return
(
n
<
v
.
Count
)
?
v
[
n
]
:
""
;
return
(
n
<
v
.
Count
)
?
v
[
n
]
:
""
;
}
}
public
bool
IsValidHashFile
(
string
[]
fLst
){
// ハッシュファイルとPDFファイルの整合性確認。更新日付のみ確認。正常:true、異常:false
//
if
(
fLst
.
Count
()
!=
Files
.
Count
)
return
false
;
// pdfファイル数の不一致
foreach
(
var
f
in
Files
)
{
var
fPath
=
Path
.
Combine
(
Path
.
GetDirectoryName
(
loadedPath
)
,
f
.
Key
);
var
fi
=
new
FileInfo
(
fPath
);
// Console.WriteLine(fPath+": "+f.Value.UpdateTimeStr);
// Console.WriteLine(fPath+"->"+fi.LastWriteTime.ToString());
if
(
f
.
Value
.
UpdateTimeStr
!=
fi
.
LastWriteTime
.
ToString
()
)
return
false
;
// 1つでも異なっていたらすべてのファイルを異常とする
}
return
true
;
//正常
}
}
}
}
}
...
...
CSRender/Program.cs
View file @
1273d2ed
...
@@ -143,6 +143,7 @@ For more information,see /H /? or /?
...
@@ -143,6 +143,7 @@ For more information,see /H /? or /?
[ELSE ] その他のオプション
[ELSE ] その他のオプション
/Para <プロセス並行数>:本Exeの並行数を指定(デフォルト4)
/Para <プロセス並行数>:本Exeの並行数を指定(デフォルト4)
/ParaPage <ページ処理スレッド数>:ページ処理のスレッド数を指定(デフォルト4)
/ParaPage <ページ処理スレッド数>:ページ処理のスレッド数を指定(デフォルト4)
/Verbose : 詳細表示
[obs]/NoExeSepa :実行分離しない(遅い)
[obs]/NoExeSepa :実行分離しない(遅い)
/H or /? : This help"
);
/H or /? : This help"
);
...
@@ -614,10 +615,19 @@ For more information,see /H /? or /?
...
@@ -614,10 +615,19 @@ For more information,see /H /? or /?
}
else
if
(
pm
.
bExeSepa
&&(
pm
.
bFC
))
{
// セパのFCモード
}
else
if
(
pm
.
bExeSepa
&&(
pm
.
bFC
))
{
// セパのFCモード
/*
/*
refのハッシュが存在しなければWCFで作成
refのハッシュが存在しなければWCFで作成
tgtのハッシュは強制的にWCFで作成
tgtのハッシュは強制的にWCFで作成
->refと同様に存在しなければ作成
*/
*/
echo
(
$"****************セパのFCモード******
{
argsStr
}
************"
);
echo
(
$"****************セパのFCモード******
{
argsStr
}
************"
);
// リファレンス側のハッシュチェック
hashDataRef
=
HashData
.
load
(
pm
.
pdfPathRef
,
hashBaseName
,
pm
.
dpi
,
pm
.
boxSelect
,
pm
.
imageType
,
pm
.
jpegQ
,
ref
otHashPath2
);
hashDataRef
=
HashData
.
load
(
pm
.
pdfPathRef
,
hashBaseName
,
pm
.
dpi
,
pm
.
boxSelect
,
pm
.
imageType
,
pm
.
jpegQ
,
ref
otHashPath2
);
// ハッシュファイルとファイルとの日付を比較する
Console
.
WriteLine
(
otHashPath2
);
if
(
(
hashDataRef
!=
null
)
&&
!
hashDataRef
.
IsValidHashFile
(
pdfPathLst2
))
{
// ハッシュファイルが異常→ファイルを削除
File
.
Delete
(
otHashPath2
);
hashDataRef
=
null
;
}
if
(
hashDataRef
==
null
)
{
if
(
hashDataRef
==
null
)
{
var
myExePath
=
Assembly
.
GetExecutingAssembly
().
Location
;
var
myExePath
=
Assembly
.
GetExecutingAssembly
().
Location
;
var
proc
=
Ut
.
Ut
.
DoCmd
(
var
proc
=
Ut
.
Ut
.
DoCmd
(
...
@@ -633,7 +643,15 @@ For more information,see /H /? or /?
...
@@ -633,7 +643,15 @@ For more information,see /H /? or /?
}
else
{
}
else
{
echo
(
$" OK hash ref(already exist)"
);
echo
(
$" OK hash ref(already exist)"
);
}
}
if
(
true
){
// ターゲット側のハッシュチェック
hashDataTgt
=
HashData
.
load
(
pm
.
pdfPath
,
hashBaseName
,
pm
.
dpi
,
pm
.
boxSelect
,
pm
.
imageType
,
pm
.
jpegQ
,
ref
otHashPath
);
if
(
(
hashDataTgt
!=
null
)
&&
!
hashDataTgt
.
IsValidHashFile
(
pdfPathLst
))
{
// ハッシュファイルが異常→ファイルを削除
File
.
Delete
(
otHashPath
);
hashDataTgt
=
null
;
}
if
(
hashDataTgt
==
null
)
{
// ターゲット側のハッシュ計算
var
myExePath
=
Assembly
.
GetExecutingAssembly
().
Location
;
var
myExePath
=
Assembly
.
GetExecutingAssembly
().
Location
;
var
proc
=
Ut
.
Ut
.
DoCmd
(
var
proc
=
Ut
.
Ut
.
DoCmd
(
cmdAndArgs
:
new
string
[]
{
myExePath
,
"/MkHash"
,
pm
.
pdfPath
,
"/D"
,
pm
.
dpi
,
$"/
{
pm
.
imageType
}
"
,
$"/JPEGQ"
,
pm
.
jpegQ
}
cmdAndArgs
:
new
string
[]
{
myExePath
,
"/MkHash"
,
pm
.
pdfPath
,
"/D"
,
pm
.
dpi
,
$"/
{
pm
.
imageType
}
"
,
$"/JPEGQ"
,
pm
.
jpegQ
}
...
@@ -646,6 +664,20 @@ For more information,see /H /? or /?
...
@@ -646,6 +664,20 @@ For more information,see /H /? or /?
echo
(
$" OK hash tgt"
);
echo
(
$" OK hash tgt"
);
}
}
}
}
//if (false/*true*/){// 2022.5.7 なぜ常に作成していたか? K.Matsuo
// // ターゲット側のハッシュ計算
// var myExePath = Assembly.GetExecutingAssembly().Location;
// var proc = Ut.Ut.DoCmd(
// cmdAndArgs: new string[] { myExePath, "/MkHash",pm.pdfPath,"/D",pm.dpi, $"/{pm.imageType }",$"/JPEGQ",pm.jpegQ }
// , bEcho: true
// , bSameConsole: true
// );
// proc.WaitForExit();
// hashDataTgt = HashData.load(pm.pdfPath, hashBaseName, pm.dpi, pm.boxSelect, pm.imageType, pm.jpegQ, ref otHashPath);
// if ( hashDataTgt != null ) {
// echo($" OK hash tgt");
// }
//}
echo
(
$@"****************FC開始*****
{
argsStr
}
**************"
);
echo
(
$@"****************FC開始*****
{
argsStr
}
**************"
);
if
(
pm
.
resultPath
!=
""
)
{
// 初期化
if
(
pm
.
resultPath
!=
""
)
{
// 初期化
File
.
WriteAllText
(
Path
.
GetFullPath
(
pm
.
resultPath
),
""
);
File
.
WriteAllText
(
Path
.
GetFullPath
(
pm
.
resultPath
),
""
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment