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
24fda800
Commit
24fda800
authored
Nov 11, 2021
by
tsuji
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
検査検版打合せで紹介した時点でのCSRenderGUIを登録
parent
6b3b9035
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1293 additions
and
0 deletions
+1293
-0
CSRender.sln
Code/CSRender/CSRender.sln
+25
-0
App.config
Code/CSRender/CSRender/App.config
+6
-0
App.xaml
Code/CSRender/CSRender/App.xaml
+10
-0
App.xaml.cs
Code/CSRender/CSRender/App.xaml.cs
+17
-0
CSRender.csproj
Code/CSRender/CSRender/CSRender.csproj
+114
-0
ComboBox.cs
Code/CSRender/CSRender/ComboBox.cs
+58
-0
CompareButtonSetting.cs
Code/CSRender/CSRender/CompareButtonSetting.cs
+135
-0
CustomMsgBox.cs
Code/CSRender/CSRender/CustomMsgBox.cs
+168
-0
FilePathSelect.cs
Code/CSRender/CSRender/FilePathSelect.cs
+145
-0
MainWindow.xaml
Code/CSRender/CSRender/MainWindow.xaml
+81
-0
MainWindow.xaml.cs
Code/CSRender/CSRender/MainWindow.xaml.cs
+73
-0
NumericUpDown.cs
Code/CSRender/CSRender/NumericUpDown.cs
+88
-0
AssemblyInfo.cs
Code/CSRender/CSRender/Properties/AssemblyInfo.cs
+55
-0
Resources.Designer.cs
Code/CSRender/CSRender/Properties/Resources.Designer.cs
+71
-0
Resources.resx
Code/CSRender/CSRender/Properties/Resources.resx
+117
-0
Settings.Designer.cs
Code/CSRender/CSRender/Properties/Settings.Designer.cs
+30
-0
Settings.settings
Code/CSRender/CSRender/Properties/Settings.settings
+7
-0
TIFFButtonsSetting.cs
Code/CSRender/CSRender/TIFFButtonsSetting.cs
+88
-0
packages.config
Code/CSRender/CSRender/packages.config
+5
-0
No files found.
Code/CSRender/CSRender.sln
0 → 100644
View file @
24fda800
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.1684
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSRender", "CSRender\CSRender.csproj", "{135D5283-7F43-4946-B3D8-786ED901D457}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{135D5283-7F43-4946-B3D8-786ED901D457}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{135D5283-7F43-4946-B3D8-786ED901D457}.Debug|Any CPU.Build.0 = Debug|Any CPU
{135D5283-7F43-4946-B3D8-786ED901D457}.Release|Any CPU.ActiveCfg = Release|Any CPU
{135D5283-7F43-4946-B3D8-786ED901D457}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {50369CFE-25D5-4DB7-B57F-A19F1248BD22}
EndGlobalSection
EndGlobal
Code/CSRender/CSRender/App.config
0 → 100644
View file @
24fda800
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
startup
>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.6.1"
/>
</
startup
>
</
configuration
>
\ No newline at end of file
Code/CSRender/CSRender/App.xaml
0 → 100644
View file @
24fda800
<Application x:Class="CSRender.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CSRender"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
StartupUri="MainWindow.xaml">
<Application.Resources>
</Application.Resources>
</Application>
Code/CSRender/CSRender/App.xaml.cs
0 → 100644
View file @
24fda800
using
System
;
using
System.Collections.Generic
;
using
System.Configuration
;
using
System.Data
;
using
System.Linq
;
using
System.Threading.Tasks
;
using
System.Windows
;
namespace
CSRender
{
/// <summary>
/// App.xaml の相互作用ロジック
/// </summary>
public
partial
class
App
:
Application
{
}
}
Code/CSRender/CSRender/CSRender.csproj
0 → 100644
View file @
24fda800
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"15.0"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<Import
Project=
"$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props"
Condition=
"Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')"
/>
<PropertyGroup>
<Configuration
Condition=
" '$(Configuration)' == '' "
>
Debug
</Configuration>
<Platform
Condition=
" '$(Platform)' == '' "
>
AnyCPU
</Platform>
<ProjectGuid>
{135D5283-7F43-4946-B3D8-786ED901D457}
</ProjectGuid>
<OutputType>
WinExe
</OutputType>
<RootNamespace>
CSRender
</RootNamespace>
<AssemblyName>
CSRender
</AssemblyName>
<TargetFrameworkVersion>
v4.6.1
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<ProjectTypeGuids>
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
<WarningLevel>
4
</WarningLevel>
<AutoGenerateBindingRedirects>
true
</AutoGenerateBindingRedirects>
<Deterministic>
true
</Deterministic>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DebugSymbols>
true
</DebugSymbols>
<DebugType>
full
</DebugType>
<Optimize>
false
</Optimize>
<OutputPath>
bin\Debug\
</OutputPath>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<DebugType>
pdbonly
</DebugType>
<Optimize>
true
</Optimize>
<OutputPath>
bin\Release\
</OutputPath>
<DefineConstants>
TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"Microsoft.WindowsAPICodePack, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Microsoft.WindowsAPICodePack-Core.1.1.0.2\lib\Microsoft.WindowsAPICodePack.dll
</HintPath>
</Reference>
<Reference
Include=
"Microsoft.WindowsAPICodePack.Shell, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll
</HintPath>
</Reference>
<Reference
Include=
"Microsoft.WindowsAPICodePack.ShellExtensions, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Microsoft.WindowsAPICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.ShellExtensions.dll
</HintPath>
</Reference>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Data"
/>
<Reference
Include=
"System.Xml"
/>
<Reference
Include=
"Microsoft.CSharp"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Xml.Linq"
/>
<Reference
Include=
"System.Data.DataSetExtensions"
/>
<Reference
Include=
"System.Net.Http"
/>
<Reference
Include=
"System.Xaml"
>
<RequiredTargetFramework>
4.0
</RequiredTargetFramework>
</Reference>
<Reference
Include=
"WindowsBase"
/>
<Reference
Include=
"PresentationCore"
/>
<Reference
Include=
"PresentationFramework"
/>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition
Include=
"App.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</ApplicationDefinition>
<Page
Include=
"MainWindow.xaml"
>
<Generator>
MSBuild:Compile
</Generator>
<SubType>
Designer
</SubType>
</Page>
<Compile
Include=
"App.xaml.cs"
>
<DependentUpon>
App.xaml
</DependentUpon>
<SubType>
Code
</SubType>
</Compile>
<Compile
Include=
"CompareButtonSetting.cs"
/>
<Compile
Include=
"CustomMsgBox.cs"
/>
<Compile
Include=
"TIFFButtonsSetting.cs"
/>
<Compile
Include=
"ComboBox.cs"
/>
<Compile
Include=
"FilePathSelect.cs"
/>
<Compile
Include=
"MainWindow.xaml.cs"
>
<DependentUpon>
MainWindow.xaml
</DependentUpon>
<SubType>
Code
</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<Compile
Include=
"NumericUpDown.cs"
/>
<Compile
Include=
"Properties\AssemblyInfo.cs"
>
<SubType>
Code
</SubType>
</Compile>
<Compile
Include=
"Properties\Resources.Designer.cs"
>
<AutoGen>
True
</AutoGen>
<DesignTime>
True
</DesignTime>
<DependentUpon>
Resources.resx
</DependentUpon>
</Compile>
<Compile
Include=
"Properties\Settings.Designer.cs"
>
<AutoGen>
True
</AutoGen>
<DependentUpon>
Settings.settings
</DependentUpon>
<DesignTimeSharedInput>
True
</DesignTimeSharedInput>
</Compile>
<EmbeddedResource
Include=
"Properties\Resources.resx"
>
<Generator>
ResXFileCodeGenerator
</Generator>
<LastGenOutput>
Resources.Designer.cs
</LastGenOutput>
</EmbeddedResource>
<None
Include=
"packages.config"
/>
<None
Include=
"Properties\Settings.settings"
>
<Generator>
SettingsSingleFileGenerator
</Generator>
<LastGenOutput>
Settings.Designer.cs
</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<None
Include=
"App.config"
/>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
</Project>
\ No newline at end of file
Code/CSRender/CSRender/ComboBox.cs
0 → 100644
View file @
24fda800
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
System.Windows.Controls.Primitives
;
using
System.Text.RegularExpressions
;
namespace
CSRender
{
public
partial
class
MainWindow
:
Window
{
//コンボボックスの要素
public
class
ComboBoxSet
{
public
int
Id
{
get
;
set
;
}
public
string
Item
{
get
;
set
;
}
}
//クリックしたときに全体を選択
private
void
PageBox_GotFocusSelectAll
(
object
sender
,
RoutedEventArgs
e
)
{
TextBox
box
=
(
TextBox
)
sender
;
//box.SelectAll();
this
.
Dispatcher
.
InvokeAsync
(()
=>
{
Task
.
Delay
(
10
);
box
.
SelectAll
();
});
}
//ページ指定のプルダウンに応じてテキストボックスを活性化/非活性化
private
void
PageRange_SelectionChanged
(
object
sender
,
SelectionChangedEventArgs
e
)
{
var
SelectedItem
=
(
ComboBoxSet
)
PageRange
.
SelectedItem
;
if
(
SelectedItem
==
null
)
return
;
string
PageType
=
(
string
)
SelectedItem
.
Item
;
if
(
PageType
==
"指定"
)
{
pageBox
.
IsEnabled
=
true
;
pageLabel
.
IsEnabled
=
true
;
}
else
{
pageBox
.
IsEnabled
=
false
;
pageLabel
.
IsEnabled
=
false
;
}
}
}
}
Code/CSRender/CSRender/CompareButtonSetting.cs
0 → 100644
View file @
24fda800
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
System.Windows.Controls.Primitives
;
using
System.Text.RegularExpressions
;
using
System.Diagnostics
;
using
System.IO
;
namespace
CSRender
{
public
partial
class
MainWindow
:
Window
{
private
void
CompareButtonClick
(
object
sender
,
RoutedEventArgs
e
)
{
ProcessStartInfo
processStartInfo
=
new
ProcessStartInfo
();
string
stCurrentDir
=
System
.
IO
.
Directory
.
GetCurrentDirectory
();
string
exePath
=
System
.
IO
.
Path
.
Combine
(
"PureVerify.Data"
,
"RipVerify"
,
"bin"
,
"x64"
);
processStartInfo
.
FileName
=
System
.
IO
.
Path
.
Combine
(
stCurrentDir
,
exePath
,
"PureVerify.exe"
);
processStartInfo
.
CreateNoWindow
=
true
;
// コマンドプロンプトを非表示
processStartInfo
.
UseShellExecute
=
false
;
// シェル機能オフ
processStartInfo
.
RedirectStandardOutput
=
true
;
//標準出力をリダイレクト
//引数設定
//指定ファイル
processStartInfo
.
Arguments
=
"/tar "
;
if
(!
Directory
.
Exists
(
targetBox
.
Text
)
&&
!
File
.
Exists
(
targetBox
.
Text
))
//pathのチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定されたファイルあるいはフォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
processStartInfo
.
Arguments
+=
targetBox
.
Text
;
//リファレンスファイル
if
(!
Directory
.
Exists
(
referenceBox
.
Text
)
&&
!
File
.
Exists
(
referenceBox
.
Text
))
//pathのチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定されたリファレンスファイルあるいはフォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
processStartInfo
.
Arguments
+=
" /ref "
;
processStartInfo
.
Arguments
+=
referenceBox
.
Text
;
//EquiosCenterの場所
string
EquiosCenter
=
System
.
IO
.
Path
.
Combine
(
stCurrentDir
,
"PureVerify.Data"
,
"EquiosCenter_small"
);
processStartInfo
.
Arguments
+=
" /equios "
;
processStartInfo
.
Arguments
+=
EquiosCenter
;
//出力ファイル形式の引数
processStartInfo
.
Arguments
+=
" /work "
;
if
(!
Directory
.
Exists
(
workBox
.
Text
)
&&
!
File
.
Exists
(
workBox
.
Text
))
//pathのチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定された作業フォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
//processStartInfo.Arguments += workBox.Text;
string
workDir
=
System
.
IO
.
Path
.
Combine
(
stCurrentDir
,
"PureVerify.Data"
,
"RipVerify"
);
processStartInfo
.
Arguments
+=
workDir
;
//検版の指定(2だとNGログ検版(LOG-Diff)になる)
processStartInfo
.
Arguments
+=
" /operation \"1\""
;
//差異箇所マークのサイズを指定
processStartInfo
.
Arguments
+=
" /markdis \"50\""
;
//PDFReportの画像の圧縮形式(0:ZLIB、1:LZW、2:JPEG、3:JPEG2000、4:RUN_LENGTH)
processStartInfo
.
Arguments
+=
" /encode \"1\""
;
//検版結果OKとなったファイルリストをPDFレポートの最後に記載(0:記載しない、1:記載する)
processStartInfo
.
Arguments
+=
" /show \"1\""
;
//検版品質ファイルの選択(0:弱、1:中、2:強、3:カスタム)
processStartInfo
.
Arguments
+=
" /quality \"2\""
;
//CSRender.exeを実行
Process
process
=
Process
.
Start
(
processStartInfo
);
//ResultConsole.Text = process.StandardOutput.ReadToEnd();
process
.
OutputDataReceived
+=
process_DataReceived
;
process
.
BeginOutputReadLine
();
//ResultConsole.ScrollToEnd();
process
.
WaitForExit
();
process
.
Close
();
//指定先にレポートを移動
string
reportPath
=
System
.
IO
.
Path
.
Combine
(
workBox
.
Text
,
"report"
);
if
(!
Directory
.
Exists
(
reportPath
))
//指定先にreportフォルダがあるか
{
Directory
.
CreateDirectory
(
reportPath
);
//なければ新規でreportフォルダを作成
}
var
allReport
=
Directory
.
EnumerateFiles
(
System
.
IO
.
Path
.
Combine
(
workDir
,
"report"
)
,
"*"
,
SearchOption
.
TopDirectoryOnly
);
//reportフォルダ内の全てのファイルを取得
foreach
(
string
file
in
allReport
)
{
string
fileTarget
=
System
.
IO
.
Path
.
GetFileName
(
file
);
File
.
Move
(
file
,
System
.
IO
.
Path
.
Combine
(
reportPath
,
fileTarget
));
//指定先に移動
}
}
//コンソール出力を読み取りする関数
public
void
process_DataReceived
(
object
sender
,
DataReceivedEventArgs
e
)
{
string
VerifyResult
=
e
.
Data
;
Dispatcher
.
BeginInvoke
(
new
Action
(()
=>
{
ResultConsole
.
Text
=
VerifyResult
;
ResultConsole
.
ScrollToEnd
();
}));
}
private
string
outputLog
(
string
workDir
)
{
StreamReader
logString
=
new
StreamReader
(
System
.
IO
.
Path
.
Combine
(
workDir
,
"report"
+
"hironimo.txt"
));
string
toString
=
""
;
string
tranceString
=
logString
+
toString
;
string
cutString
=
"*****************************************************"
+
"\r\n"
+
"Number of Processors = 8"
+
"\r\n"
+
"HostName = I-N-21-00008"
+
"\r\n"
+
"PlatformId = 0"
+
"\r\n"
+
"PureVerifyMainSetUp.txt"
+
"\r\n"
+
" MakeThreadNums = 0"
+
" PDFREPORT_SPLIT_PAGENUM = 32"
+
"\r\n"
+
"*****************************************************"
;
string
outputString
=
tranceString
.
Replace
(
cutString
,
""
);
return
outputString
;
}
}
}
Code/CSRender/CSRender/CustomMsgBox.cs
0 → 100644
View file @
24fda800
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Interop
;
using
System.Runtime.InteropServices
;
namespace
CSRender
{
class
CustomMsgBox
{
/// <summary>
/// 親ウィンドウ
/// </summary>
private
Window
ownerWindow
=
null
;
/// <summary>
/// フックハンドル
/// </summary>
private
IntPtr
hHook
=
IntPtr
.
Zero
;
/// <summary>
/// メッセージボックスを表示する
/// </summary>
/// <param name="owner"></param>
/// <param name="messageBoxText"></param>
/// <param name="caption"></param>
/// <param name="button"></param>
/// <param name="icon"></param>
/// <returns></returns>
public
static
MessageBoxResult
Show
(
Window
owner
,
string
messageBoxText
,
string
caption
,
MessageBoxButton
button
,
MessageBoxImage
icon
)
{
if
(
owner
.
WindowState
==
WindowState
.
Minimized
)
{
return
MessageBox
.
Show
(
owner
,
messageBoxText
,
caption
,
button
,
icon
);
}
else
{
CustomMsgBox
mbox
=
new
CustomMsgBox
(
owner
);
return
mbox
.
Show
(
messageBoxText
,
caption
,
button
,
icon
);
}
}
/// <summary>
/// コンストラクタ
/// </summary>
/// <param name="window">Owner Window</param>
private
CustomMsgBox
(
Window
window
)
{
ownerWindow
=
window
;
}
/// <summary>
/// メッセージボックスを表示する
/// </summary>
/// <param name="messageBoxText"></param>
/// <param name="caption"></param>
/// <param name="button"></param>
/// <param name="icon"></param>
/// <returns></returns>
private
MessageBoxResult
Show
(
string
messageBoxText
,
string
caption
,
MessageBoxButton
button
,
MessageBoxImage
icon
)
{
// フックを設定する。
HwndSource
hwndSource
=
(
HwndSource
)
HwndSource
.
FromVisual
(
ownerWindow
);
IntPtr
hInstance
=
WinAPI
.
GetWindowLong
(
hwndSource
.
Handle
,
WinAPI
.
GWL_HINSTANCE
);
IntPtr
threadId
=
WinAPI
.
GetCurrentThreadId
();
hHook
=
WinAPI
.
SetWindowsHookEx
(
WinAPI
.
WH_CBT
,
new
WinAPI
.
HOOKPROC
(
HookProc
),
hInstance
,
threadId
);
return
MessageBox
.
Show
(
ownerWindow
,
messageBoxText
,
caption
,
button
,
icon
);
}
/// <summary>
/// フックプロシージャ
/// </summary>
/// <param name="nCode"></param>
/// <param name="wParam"></param>
/// <param name="lParam"></param>
/// <returns></returns>
private
IntPtr
HookProc
(
int
nCode
,
IntPtr
wParam
,
IntPtr
lParam
)
{
if
(
nCode
==
WinAPI
.
HCBT_ACTIVATE
)
{
WinAPI
.
RECT
rcForm
=
new
WinAPI
.
RECT
(
0
,
0
,
0
,
0
);
WinAPI
.
RECT
rcMsgBox
=
new
WinAPI
.
RECT
(
0
,
0
,
0
,
0
);
HwndSource
hwndSource
=
(
HwndSource
)
HwndSource
.
FromVisual
(
ownerWindow
);
WinAPI
.
GetWindowRect
(
hwndSource
.
Handle
,
out
rcForm
);
WinAPI
.
GetWindowRect
(
wParam
,
out
rcMsgBox
);
// センター位置を計算する。
int
x
=
(
rcForm
.
Left
+
(
rcForm
.
Right
-
rcForm
.
Left
)
/
2
)
-
((
rcMsgBox
.
Right
-
rcMsgBox
.
Left
)
/
2
);
int
y
=
(
rcForm
.
Top
+
(
rcForm
.
Bottom
-
rcForm
.
Top
)
/
2
)
-
((
rcMsgBox
.
Bottom
-
rcMsgBox
.
Top
)
/
2
);
WinAPI
.
SetWindowPos
(
wParam
,
0
,
x
,
y
,
0
,
0
,
WinAPI
.
SWP_NOSIZE
|
WinAPI
.
SWP_NOZORDER
|
WinAPI
.
SWP_NOACTIVATE
);
IntPtr
result
=
WinAPI
.
CallNextHookEx
(
hHook
,
nCode
,
wParam
,
lParam
);
// フックを解除する。
WinAPI
.
UnhookWindowsHookEx
(
hHook
);
hHook
=
IntPtr
.
Zero
;
return
result
;
}
else
{
return
WinAPI
.
CallNextHookEx
(
hHook
,
nCode
,
wParam
,
lParam
);
}
}
}
internal
class
WinAPI
{
[
DllImport
(
"user32.dll"
)]
public
static
extern
IntPtr
GetWindowLong
(
IntPtr
hWnd
,
int
nIndex
);
[
DllImport
(
"kernel32.dll"
)]
public
static
extern
IntPtr
GetCurrentThreadId
();
[
DllImport
(
"user32.dll"
)]
public
static
extern
IntPtr
SetWindowsHookEx
(
int
idHook
,
HOOKPROC
lpfn
,
IntPtr
hInstance
,
IntPtr
threadId
);
[
DllImport
(
"user32.dll"
)]
public
static
extern
bool
UnhookWindowsHookEx
(
IntPtr
hHook
);
[
DllImport
(
"user32.dll"
)]
public
static
extern
IntPtr
CallNextHookEx
(
IntPtr
hHook
,
int
nCode
,
IntPtr
wParam
,
IntPtr
lParam
);
[
DllImport
(
"user32.dll"
)]
public
static
extern
bool
SetWindowPos
(
IntPtr
hWnd
,
int
hWndInsertAfter
,
int
X
,
int
Y
,
int
cx
,
int
cy
,
uint
uFlags
);
[
DllImport
(
"user32.dll"
)]
public
static
extern
bool
GetWindowRect
(
IntPtr
hWnd
,
out
RECT
lpRect
);
public
delegate
IntPtr
HOOKPROC
(
int
nCode
,
IntPtr
wParam
,
IntPtr
lParam
);
public
const
int
GWL_HINSTANCE
=
(-
6
);
public
const
int
WH_CBT
=
5
;
public
const
int
HCBT_ACTIVATE
=
5
;
public
const
int
SWP_NOSIZE
=
0x0001
;
public
const
int
SWP_NOZORDER
=
0x0004
;
public
const
int
SWP_NOACTIVATE
=
0x0010
;
public
struct
RECT
{
public
RECT
(
int
inLeft
,
int
inTop
,
int
inRight
,
int
inBottom
)
{
Left
=
inLeft
;
Top
=
inTop
;
Right
=
inRight
;
Bottom
=
inBottom
;
}
public
int
Left
;
public
int
Top
;
public
int
Right
;
public
int
Bottom
;
}
}
}
Code/CSRender/CSRender/FilePathSelect.cs
0 → 100644
View file @
24fda800
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
System.Windows.Controls.Primitives
;
using
System.Text.RegularExpressions
;
using
Microsoft.Win32
;
using
MSAPI
=
Microsoft
.
WindowsAPICodePack
;
namespace
CSRender
{
public
partial
class
MainWindow
:
Window
{
//フォルダ指定のためにファイルをドラッグ
private
void
textBox_PreviewDragOver
(
object
sender
,
System
.
Windows
.
DragEventArgs
e
)
{
if
(
e
.
Data
.
GetDataPresent
(
System
.
Windows
.
DataFormats
.
FileDrop
,
true
))
{
e
.
Effects
=
System
.
Windows
.
DragDropEffects
.
Copy
;
}
else
{
e
.
Effects
=
System
.
Windows
.
DragDropEffects
.
None
;
}
e
.
Handled
=
true
;
}
//エクスプローラーからテキストボックスにドロップして指定フォルダの場所をペースト
private
void
TargetBox_Drop
(
object
sender
,
System
.
Windows
.
DragEventArgs
e
)
{
var
dropFiles
=
e
.
Data
.
GetData
(
System
.
Windows
.
DataFormats
.
FileDrop
)
as
string
[];
if
(
dropFiles
==
null
)
return
;
//カーソルを終端に置く
targetBox
.
Text
=
dropFiles
[
0
];
targetBox
.
Focus
();
targetBox
.
Select
(
this
.
targetBox
.
Text
.
Length
,
0
);
}
private
void
RefBox_Drop
(
object
sender
,
System
.
Windows
.
DragEventArgs
e
)
{
var
dropFiles
=
e
.
Data
.
GetData
(
System
.
Windows
.
DataFormats
.
FileDrop
)
as
string
[];
if
(
dropFiles
==
null
)
return
;
//カーソルを終端に置く
referenceBox
.
Text
=
dropFiles
[
0
];
referenceBox
.
Focus
();
referenceBox
.
Select
(
this
.
referenceBox
.
Text
.
Length
,
0
);
}
private
void
WorkBox_Drop
(
object
sender
,
System
.
Windows
.
DragEventArgs
e
)
{
var
dropFiles
=
e
.
Data
.
GetData
(
System
.
Windows
.
DataFormats
.
FileDrop
)
as
string
[];
if
(
dropFiles
==
null
)
return
;
//カーソルを終端に置く
workBox
.
Text
=
dropFiles
[
0
];
workBox
.
Focus
();
workBox
.
Select
(
this
.
workBox
.
Text
.
Length
,
0
);
}
//参照ボタンClickでフォルダ選択のダイアログを表示(対象フォルダ)
private
void
TagetButton_Click
(
object
sender
,
RoutedEventArgs
e
)
{
//ファイル選択の場合
//var selectFile = new OpenFileDialog();
//selectFile.Title = "ファイルを選択してください";
//selectFile.InitialDirectory = @"C:";
//if ((bool)selectFile.ShowDialog())
//{
//FileName = selectFile.FileName;
//FileSelected(this, new EventArgs());
//}
//フォルダ選択の場合
var
selectFile
=
new
MSAPI
::
Dialogs
.
CommonOpenFileDialog
();
selectFile
.
IsFolderPicker
=
true
;
selectFile
.
Title
=
"フォルダを選択してください"
;
selectFile
.
InitialDirectory
=
@"C:"
;
if
(
selectFile
.
ShowDialog
()
!=
MSAPI
::
Dialogs
.
CommonFileDialogResult
.
Ok
)
{
return
;
}
//共通部分
targetBox
.
Text
=
selectFile
.
FileName
;
}
//参照ボタンClickでフォルダ選択のダイアログを表示(リファレンスフォルダ)
private
void
ReferenceButton_Click
(
object
sender
,
RoutedEventArgs
e
)
{
//ファイル選択の場合
//var selectFile = new OpenFileDialog();
//selectFile.Title = "ファイルを選択してください";
//selectFile.InitialDirectory = @"C:";
//if ((bool)selectFile.ShowDialog())
//{
//FileName = selectFile.FileName;
//FileSelected(this, new EventArgs());
//}
//フォルダ選択の場合
var
selectFile
=
new
MSAPI
::
Dialogs
.
CommonOpenFileDialog
();
selectFile
.
IsFolderPicker
=
true
;
selectFile
.
Title
=
"フォルダを選択してください"
;
selectFile
.
InitialDirectory
=
@"C:"
;
if
(
selectFile
.
ShowDialog
()
!=
MSAPI
::
Dialogs
.
CommonFileDialogResult
.
Ok
)
{
return
;
}
//共通部分
referenceBox
.
Text
=
selectFile
.
FileName
;
}
//参照ボタンClickでフォルダ選択のダイアログを表示(作業フォルダ)
private
void
WorkButton_Click
(
object
sender
,
RoutedEventArgs
e
)
{
//ファイル選択の場合
//var selectFile = new OpenFileDialog();
//selectFile.Title = "ファイルを選択してください";
//selectFile.InitialDirectory = @"C:";
//if ((bool)selectFile.ShowDialog())
//{
//FileName = selectFile.FileName;
//FileSelected(this, new EventArgs());
//}
//フォルダ選択の場合
var
selectFile
=
new
MSAPI
::
Dialogs
.
CommonOpenFileDialog
();
selectFile
.
IsFolderPicker
=
true
;
selectFile
.
Title
=
"フォルダを選択してください"
;
selectFile
.
InitialDirectory
=
@"C:"
;
if
(
selectFile
.
ShowDialog
()
!=
MSAPI
::
Dialogs
.
CommonFileDialogResult
.
Ok
)
{
return
;
}
//共通部分
workBox
.
Text
=
selectFile
.
FileName
;
}
}
}
Code/CSRender/CSRender/MainWindow.xaml
0 → 100644
View file @
24fda800
<Window x:Name="mainWindow" x:Class="CSRender.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CSRender"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="CSRender" Height="450" Width="600" Background="#FFF3F4F4" MinWidth="600" MinHeight="250">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="138"/>
<ColumnDefinition Width="357*"/>
<ColumnDefinition Width="98*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="13*"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="28"/>
<RowDefinition Height="33"/>
<RowDefinition Height="229*"/>
<RowDefinition Height="23"/>
<RowDefinition Height="10*"/>
</Grid.RowDefinitions>
<Label Content="対象フォルダ :" Margin="10,0,3,2.333" VerticalAlignment="Bottom" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.RowSpan="2" Height="28"/>
<Label Content="リファレンスフォルダ:" Margin="10,26.667,3,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="1" Height="29" Grid.RowSpan="2"/>
<Label Content="作業フォルダ :" Margin="10,27.667,3,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="2" Height="29" Grid.RowSpan="3"/>
<TextBox x:Name="targetBox" Grid.Column="1" Margin="10,2.667,9.333,0" FontSize="14" Grid.Row="1" Height="24" VerticalAlignment="Top" AllowDrop="True" Drop="TargetBox_Drop" DragOver="textBox_PreviewDragOver"/>
<TextBox x:Name="referenceBox" Grid.Column="1" Margin="10,2.667,9.333,0" FontSize="14" Grid.Row="2" Height="24" VerticalAlignment="Top" AllowDrop="True" Drop="RefBox_Drop" DragOver="textBox_PreviewDragOver"/>
<TextBox x:Name="workBox" Grid.Column="1" Margin="10,2.667,9.333,0" FontSize="14" Grid.Row="3" Height="24" VerticalAlignment="Top" AllowDrop="True" Drop="WorkBox_Drop" DragOver="textBox_PreviewDragOver"/>
<Button x:Name="targetButton" Content="参照" Grid.Column="2" HorizontalAlignment="Left" Margin="6.667,4.667,0,0" VerticalAlignment="Top" Width="75" Grid.Row="1" Height="20" Click="TagetButton_Click"/>
<Button x:Name="referenceButton" Content="参照" Grid.Column="2" HorizontalAlignment="Left" Margin="6.667,4.667,0,0" VerticalAlignment="Top" Width="75" Grid.Row="2" Height="20" Click="ReferenceButton_Click"/>
<Button x:Name="workButton" Content="参照" Grid.Column="2" HorizontalAlignment="Left" Margin="6.667,4.667,0,0" VerticalAlignment="Top" Width="75" Grid.Row="3" Height="20" Click="WorkButton_Click"/>
<Label Content="解像度(9 - 300):" Margin="17,0.667,3,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="4" Height="29" Grid.RowSpan="2"/>
<Label Content="検査範囲:" Margin="55,1.667,7,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="5" Height="29"/>
<StackPanel Grid.Column="1" Grid.Row="4" Orientation="Horizontal" HorizontalAlignment="Left" Margin="13,6.667,0,0.333" Grid.RowSpan="1" Width="47" Background="Black">
<TextBox x:Name="ResolutionBox" Width="30" HorizontalContentAlignment="Right"
Text="{Binding Value, ElementName=NumericScroll1}" VerticalContentAlignment="Center" FontSize="14"/>
<ScrollBar x:Name="NumericScroll1" Value="72" SmallChange="1" LargeChange="1" Maximum="300" Minimum="1" RenderTransformOrigin="0.5,0.5" Cursor="Arrow" Background="#FF3E3E3E" BorderBrush="#FF060606" Foreground="#FF030303" >
<ScrollBar.RenderTransform>
<TransformGroup>
<RotateTransform Angle="180"/>
</TransformGroup>
</ScrollBar.RenderTransform>
</ScrollBar>
</StackPanel>
<StackPanel Grid.Column="1" HorizontalAlignment="Left" Margin="10,4.667,0,4.667" Grid.Row="5" Width="75" >
<ComboBox x:Name="PageRange" SelectedValuePath="Id" DisplayMemberPath="Item" Height="21" SelectedValue="1" SelectionChanged="PageRange_SelectionChanged">
<ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFF0F0F0" Offset="0"/>
<GradientStop Color="Gainsboro" Offset="1"/>
</LinearGradientBrush>
</ComboBox.Background>
</ComboBox>
</StackPanel>
<Label Content="出力形式:" Margin="107,0.667,168.333,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="4" Height="29" Grid.RowSpan="2" Grid.Column="1"/>
<Label x:Name="pageLabel" Content="指定ページ:" Margin="103,1.667,170.333,0" VerticalAlignment="Top" RenderTransformOrigin="0.544,1.949" FontSize="14" Grid.Row="5" Height="29" Grid.Column="1" IsEnabled="{Binding PageRange_SelectionChanged}"/>
<StackPanel Grid.Column="1" HorizontalAlignment="Left" Margin="192,5.667,0,31.667" Grid.Row="4" Width="75" Grid.RowSpan="2" >
<ComboBox x:Name="FileSelect" SelectedValuePath="Id" DisplayMemberPath="Item" Height="21" SelectedValue="1" >
<ComboBox.Background>
<LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
<GradientStop Color="#FFF0F0F0" Offset="0"/>
<GradientStop Color="Gainsboro" Offset="1"/>
</LinearGradientBrush>
</ComboBox.Background>
</ComboBox>
</StackPanel>
<TextBox x:Name="pageBox" Grid.Column="1" Height="23" Margin="192,3.667,11.333,0" Grid.Row="5"
TextWrapping="Wrap" Text="1,2,4-6" VerticalAlignment="Top" FontSize="14" IsEnabled="{Binding PageRange_SelectionChanged}"/>
<TextBox x:Name="ResultConsole" Margin="55,10.333,55.333,10" Grid.Row="6" TextWrapping="Wrap" Grid.ColumnSpan="3" VerticalScrollBarVisibility="Auto" FontSize="14" IsReadOnly="True"/>
<Button x:Name="TIFFButton" Content="TIFF出力" HorizontalAlignment="Left" Height="22" Margin="54,1,0,0" Grid.Row="7" VerticalAlignment="Top" Width="82" Grid.RowSpan="2" Click="TIFFButtonClick"/>
<Button x:Name="CompareButton" Content="比較" HorizontalAlignment="Left" Height="22" Margin="13,1,0,0" Grid.Row="7" VerticalAlignment="Top" Width="82" Grid.Column="1" Grid.RowSpan="2" Click="CompareButtonClick"/>
<Button x:Name="closeButton" Content="Close" Height="22" Margin="0,1,55.333,0" Grid.Row="7" VerticalAlignment="Top" Grid.Column="1" Grid.ColumnSpan="2" Grid.RowSpan="2" HorizontalAlignment="Right" Width="77" Click="CloseButton_Click"/>
</Grid>
</Window>
Code/CSRender/CSRender/MainWindow.xaml.cs
0 → 100644
View file @
24fda800
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
System.Windows.Controls.Primitives
;
using
System.Text.RegularExpressions
;
using
System.Collections.ObjectModel
;
namespace
CSRender
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public
partial
class
MainWindow
:
Window
{
//comboBoxのインスタンス
private
ObservableCollection
<
ComboBoxSet
>
PagePattern
=
new
ObservableCollection
<
ComboBoxSet
>();
private
ObservableCollection
<
ComboBoxSet
>
FilePattern
=
new
ObservableCollection
<
ComboBoxSet
>();
public
MainWindow
()
{
InitializeComponent
();
//解像度選択UpDownバーの設定
this
.
Title
=
this
.
ToString
();
ResolutionBox
.
MouseWheel
+=
NumericTextBox_MouseWheel
;
ResolutionBox
.
GotFocus
+=
NumericTextBox_GotFocusSelectAll
;
ResolutionBox
.
TextChanged
+=
NumericTextBox_TextChanged
;
ResolutionBox
.
TextChanged
+=
NumericTextBox_NumChanged
;
NumericScroll1
.
MouseWheel
+=
NumericScroll1_MouseWheel
;
//ページ入力メニューの設定
PagePattern
.
Add
((
new
ComboBoxSet
{
Id
=
1
,
Item
=
"全ページ"
}));
PagePattern
.
Add
((
new
ComboBoxSet
{
Id
=
2
,
Item
=
"指定"
}));
PageRange
.
ItemsSource
=
PagePattern
;
pageBox
.
GotFocus
+=
PageBox_GotFocusSelectAll
;
//出力ファイル形式メニューの設定
FilePattern
.
Add
((
new
ComboBoxSet
{
Id
=
1
,
Item
=
"JPG"
}));
FilePattern
.
Add
((
new
ComboBoxSet
{
Id
=
2
,
Item
=
"JPEG"
}));
FilePattern
.
Add
((
new
ComboBoxSet
{
Id
=
3
,
Item
=
"PNG"
}));
FilePattern
.
Add
((
new
ComboBoxSet
{
Id
=
4
,
Item
=
"TIF"
}));
FilePattern
.
Add
((
new
ComboBoxSet
{
Id
=
5
,
Item
=
"TIFF"
}));
FilePattern
.
Add
((
new
ComboBoxSet
{
Id
=
6
,
Item
=
"GIF"
}));
FilePattern
.
Add
((
new
ComboBoxSet
{
Id
=
7
,
Item
=
"BMP"
}));
FileSelect
.
ItemsSource
=
FilePattern
;
//ドラッグ&ドロップイベントの追加
targetBox
.
AddHandler
(
TextBox
.
DragOverEvent
,
new
DragEventHandler
(
textBox_PreviewDragOver
),
true
);
targetBox
.
AddHandler
(
TextBox
.
DropEvent
,
new
DragEventHandler
(
TargetBox_Drop
),
true
);
referenceBox
.
AddHandler
(
TextBox
.
DragOverEvent
,
new
DragEventHandler
(
textBox_PreviewDragOver
),
true
);
referenceBox
.
AddHandler
(
TextBox
.
DropEvent
,
new
DragEventHandler
(
RefBox_Drop
),
true
);
workBox
.
AddHandler
(
TextBox
.
DragOverEvent
,
new
DragEventHandler
(
textBox_PreviewDragOver
),
true
);
workBox
.
AddHandler
(
TextBox
.
DropEvent
,
new
DragEventHandler
(
WorkBox_Drop
),
true
);
}
//Closeボタン
private
void
CloseButton_Click
(
object
sender
,
RoutedEventArgs
e
)
=>
Close
();
}
}
Code/CSRender/CSRender/NumericUpDown.cs
0 → 100644
View file @
24fda800
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
System.Windows.Controls.Primitives
;
using
System.Text.RegularExpressions
;
namespace
CSRender
{
public
partial
class
MainWindow
:
Window
{
////////////////////////////////////////////////////////////////////////////
// 解像度のUpDownメニュー昨日の記述
////////////////////////////////////////////////////////////////////////////
//TextBoxフォーカス時にテキスト全選択
private
void
NumericTextBox_GotFocusSelectAll
(
object
sender
,
RoutedEventArgs
e
)
{
TextBox
box
=
(
TextBox
)
sender
;
//box.SelectAll();
this
.
Dispatcher
.
InvokeAsync
(()
=>
{
Task
.
Delay
(
10
);
box
.
SelectAll
();
});
}
//正規表現で数値以外は削除using System.Text.RegularExpressions;
private
void
NumericTextBox_TextChanged
(
object
sender
,
TextChangedEventArgs
e
)
{
TextBox
box
=
(
TextBox
)
sender
;
double
d
;
if
(!
double
.
TryParse
(
box
.
Text
,
out
d
))
{
box
.
Text
=
Regex
.
Replace
(
box
.
Text
,
"[^0-9-]"
,
""
);
}
}
//数字の下限;
private
void
NumericTextBox_NumChanged
(
object
sender
,
TextChangedEventArgs
e
)
{
TextBox
box
=
(
TextBox
)
sender
;
if
(
box
.
Text
==
""
)
{
box
.
Text
=
"72"
;
}
NumericScroll1
.
Value
=
Int32
.
Parse
(
box
.
Text
);
}
//TextBox上でマウスホイールを回転させた時にスクロールバーの値を上下させる
private
void
NumericTextBox_MouseWheel
(
object
sender
,
MouseWheelEventArgs
e
)
{
TextBox
textBox
=
(
TextBox
)
sender
;
Binding
binding
=
BindingOperations
.
GetBinding
(
textBox
,
TextBox
.
TextProperty
);
ScrollBar
scrollBar
=
(
ScrollBar
)
this
.
FindName
(
binding
.
ElementName
);
//名前から取得
scrollBar
.
Value
=
Int32
.
Parse
(
textBox
.
Text
);
if
(
e
.
Delta
>
0
)
{
scrollBar
.
Value
++;
}
else
{
scrollBar
.
Value
--;
}
}
//ScrollBar上でマウスホイールを回転させた時にScrollBarの値を上下させる
private
void
NumericScroll1_MouseWheel
(
object
sender
,
MouseWheelEventArgs
e
)
{
ScrollBar
sb
=
(
ScrollBar
)
sender
;
sb
.
Value
=
Int32
.
Parse
(
ResolutionBox
.
Text
);
if
(
e
.
Delta
>
0
)
{
sb
.
Value
++;
}
else
{
sb
.
Value
--;
}
}
}
}
Code/CSRender/CSRender/Properties/AssemblyInfo.cs
0 → 100644
View file @
24fda800
using
System.Reflection
;
using
System.Resources
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Windows
;
// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
// アセンブリに関連付けられている情報を変更するには、
// これらの属性値を変更してください。
[
assembly
:
AssemblyTitle
(
"CSRender"
)]
[
assembly
:
AssemblyDescription
(
""
)]
[
assembly
:
AssemblyConfiguration
(
""
)]
[
assembly
:
AssemblyCompany
(
""
)]
[
assembly
:
AssemblyProduct
(
"CSRender"
)]
[
assembly
:
AssemblyCopyright
(
"Copyright © 2021"
)]
[
assembly
:
AssemblyTrademark
(
""
)]
[
assembly
:
AssemblyCulture
(
""
)]
// ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから
// 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、
// その型の ComVisible 属性を true に設定してください。
[
assembly
:
ComVisible
(
false
)]
//ローカライズ可能なアプリケーションのビルドを開始するには、
//.csproj ファイルの <UICulture>CultureYouAreCodingWith</UICulture> を
//<PropertyGroup> 内部で設定します。たとえば、
//ソース ファイルで英語を使用している場合、<UICulture> を en-US に設定します。次に、
//下の NeutralResourceLanguage 属性のコメントを解除します。下の行の "en-US" を
//プロジェクト ファイルの UICulture 設定と一致するよう更新します。
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[
assembly
:
ThemeInfo
(
ResourceDictionaryLocation
.
None
,
//テーマ固有のリソース ディクショナリが置かれている場所
//(リソースがページ、
//またはアプリケーション リソース ディクショナリに見つからない場合に使用されます)
ResourceDictionaryLocation
.
SourceAssembly
//汎用リソース ディクショナリが置かれている場所
//(リソースがページ、
//アプリケーション、またはいずれのテーマ固有のリソース ディクショナリにも見つからない場合に使用されます)
)]
// アセンブリのバージョン情報は次の 4 つの値で構成されています:
//
// メジャー バージョン
// マイナー バージョン
// ビルド番号
// Revision
//
// すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
// 既定値にすることができます:
// [assembly: AssemblyVersion("1.0.*")]
[
assembly
:
AssemblyVersion
(
"1.0.0.0"
)]
[
assembly
:
AssemblyFileVersion
(
"1.0.0.0"
)]
Code/CSRender/CSRender/Properties/Resources.Designer.cs
0 → 100644
View file @
24fda800
//------------------------------------------------------------------------------
// <auto-generated>
// このコードはツールによって生成されました。
// ランタイム バージョン:4.0.30319.42000
//
// このファイルへの変更は、以下の状況下で不正な動作の原因になったり、
// コードが再生成されるときに損失したりします
// </auto-generated>
//------------------------------------------------------------------------------
namespace
CSRender.Properties
{
/// <summary>
/// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。
/// </summary>
// このクラスは StronglyTypedResourceBuilder クラスによって ResGen
// または Visual Studio のようなツールを使用して自動生成されました。
// メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に
// ResGen を実行し直すか、または VS プロジェクトをリビルドします。
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"System.Resources.Tools.StronglyTypedResourceBuilder"
,
"4.0.0.0"
)]
[
global
::
System
.
Diagnostics
.
DebuggerNonUserCodeAttribute
()]
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
internal
class
Resources
{
private
static
global
::
System
.
Resources
.
ResourceManager
resourceMan
;
private
static
global
::
System
.
Globalization
.
CultureInfo
resourceCulture
;
[
global
::
System
.
Diagnostics
.
CodeAnalysis
.
SuppressMessageAttribute
(
"Microsoft.Performance"
,
"CA1811:AvoidUncalledPrivateCode"
)]
internal
Resources
()
{
}
/// <summary>
/// このクラスで使用されるキャッシュされた ResourceManager インスタンスを返します。
/// </summary>
[
global
::
System
.
ComponentModel
.
EditorBrowsableAttribute
(
global
::
System
.
ComponentModel
.
EditorBrowsableState
.
Advanced
)]
internal
static
global
::
System
.
Resources
.
ResourceManager
ResourceManager
{
get
{
if
((
resourceMan
==
null
))
{
global
::
System
.
Resources
.
ResourceManager
temp
=
new
global
::
System
.
Resources
.
ResourceManager
(
"CSRender.Properties.Resources"
,
typeof
(
Resources
).
Assembly
);
resourceMan
=
temp
;
}
return
resourceMan
;
}
}
/// <summary>
/// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします
/// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。
/// </summary>
[
global
::
System
.
ComponentModel
.
EditorBrowsableAttribute
(
global
::
System
.
ComponentModel
.
EditorBrowsableState
.
Advanced
)]
internal
static
global
::
System
.
Globalization
.
CultureInfo
Culture
{
get
{
return
resourceCulture
;
}
set
{
resourceCulture
=
value
;
}
}
}
}
Code/CSRender/CSRender/Properties/Resources.resx
0 → 100644
View file @
24fda800
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema
id=
"root"
xmlns=
""
xmlns:xsd=
"http://www.w3.org/2001/XMLSchema"
xmlns:msdata=
"urn:schemas-microsoft-com:xml-msdata"
>
<xsd:element
name=
"root"
msdata:IsDataSet=
"true"
>
<xsd:complexType>
<xsd:choice
maxOccurs=
"unbounded"
>
<xsd:element
name=
"metadata"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"assembly"
>
<xsd:complexType>
<xsd:attribute
name=
"alias"
type=
"xsd:string"
/>
<xsd:attribute
name=
"name"
type=
"xsd:string"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"data"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
<xsd:element
name=
"comment"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"2"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
msdata:Ordinal=
"1"
/>
<xsd:attribute
name=
"type"
type=
"xsd:string"
msdata:Ordinal=
"3"
/>
<xsd:attribute
name=
"mimetype"
type=
"xsd:string"
msdata:Ordinal=
"4"
/>
</xsd:complexType>
</xsd:element>
<xsd:element
name=
"resheader"
>
<xsd:complexType>
<xsd:sequence>
<xsd:element
name=
"value"
type=
"xsd:string"
minOccurs=
"0"
msdata:Ordinal=
"1"
/>
</xsd:sequence>
<xsd:attribute
name=
"name"
type=
"xsd:string"
use=
"required"
/>
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader
name=
"resmimetype"
>
<value>
text/microsoft-resx
</value>
</resheader>
<resheader
name=
"version"
>
<value>
2.0
</value>
</resheader>
<resheader
name=
"reader"
>
<value>
System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
<resheader
name=
"writer"
>
<value>
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</value>
</resheader>
</root>
\ No newline at end of file
Code/CSRender/CSRender/Properties/Settings.Designer.cs
0 → 100644
View file @
24fda800
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace
CSRender.Properties
{
[
global
::
System
.
Runtime
.
CompilerServices
.
CompilerGeneratedAttribute
()]
[
global
::
System
.
CodeDom
.
Compiler
.
GeneratedCodeAttribute
(
"Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator"
,
"11.0.0.0"
)]
internal
sealed
partial
class
Settings
:
global
::
System
.
Configuration
.
ApplicationSettingsBase
{
private
static
Settings
defaultInstance
=
((
Settings
)(
global
::
System
.
Configuration
.
ApplicationSettingsBase
.
Synchronized
(
new
Settings
())));
public
static
Settings
Default
{
get
{
return
defaultInstance
;
}
}
}
}
Code/CSRender/CSRender/Properties/Settings.settings
0 → 100644
View file @
24fda800
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile
xmlns=
"uri:settings"
CurrentProfile=
"(Default)"
>
<Profiles>
<Profile
Name=
"(Default)"
/>
</Profiles>
<Settings
/>
</SettingsFile>
\ No newline at end of file
Code/CSRender/CSRender/TIFFButtonsSetting.cs
0 → 100644
View file @
24fda800
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows.Controls
;
using
System.Windows.Data
;
using
System.Windows.Documents
;
using
System.Windows.Input
;
using
System.Windows.Media
;
using
System.Windows.Media.Imaging
;
using
System.Windows.Navigation
;
using
System.Windows.Shapes
;
using
System.Windows.Controls.Primitives
;
using
System.Text.RegularExpressions
;
using
System.Diagnostics
;
using
System.IO
;
namespace
CSRender
{
public
partial
class
MainWindow
:
Window
{
private
void
TIFFButtonClick
(
object
sender
,
RoutedEventArgs
e
)
{
ProcessStartInfo
processStartInfo
=
new
ProcessStartInfo
();
string
stCurrentDir
=
System
.
IO
.
Directory
.
GetCurrentDirectory
();
processStartInfo
.
FileName
=
System
.
IO
.
Path
.
Combine
(
stCurrentDir
,
"CSRender.Data"
,
"CSRender.exe"
);
processStartInfo
.
CreateNoWindow
=
true
;
// コマンドプロンプトを非表示
processStartInfo
.
UseShellExecute
=
false
;
// シェル機能オフ
processStartInfo
.
RedirectStandardOutput
=
true
;
//標準出力をリダイレクト
//解像度の引数
if
(
NumericScroll1
.
Value
<
9
)
{
CustomMsgBox
.
Show
(
mainWindow
,
"解像度が正しく設定されていません。"
+
"\nもう一度設定してください。"
,
"The resolution value is not set correctly"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
ResolutionBox
.
Text
=
"9"
;
return
;
}
processStartInfo
.
Arguments
=
"/D "
;
processStartInfo
.
Arguments
+=
ResolutionBox
.
Text
;
//出力ファイル形式の引数
processStartInfo
.
Arguments
+=
" /"
;
processStartInfo
.
Arguments
+=
FileSelect
.
Text
;
processStartInfo
.
Arguments
+=
" "
;
//必要に応じてページ引数を指定
if
(
PageRange
.
Text
==
"指定"
)
{
processStartInfo
.
Arguments
+=
"/P \""
;
processStartInfo
.
Arguments
+=
pageBox
.
Text
;
processStartInfo
.
Arguments
+=
"\" "
;
}
//指定ファイル
if
(!
Directory
.
Exists
(
targetBox
.
Text
)
&&
!
File
.
Exists
(
targetBox
.
Text
))
//pathが存在するかチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定されたファイルあるいはフォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
processStartInfo
.
Arguments
+=
"/F "
;
processStartInfo
.
Arguments
+=
targetBox
.
Text
;
//出力フォルダ
if
(
workBox
.
Text
!=
""
)
{
if
(!
Directory
.
Exists
(
workBox
.
Text
)
&&
!
File
.
Exists
(
workBox
.
Text
))
//pathのチェック
{
CustomMsgBox
.
Show
(
mainWindow
,
"指定された作業フォルダが存在しません。"
+
"\nもう一度設定してください。"
,
"The specified reference file or folder does not exist"
,
MessageBoxButton
.
OK
,
MessageBoxImage
.
Information
);
return
;
}
processStartInfo
.
Arguments
+=
" /O "
;
processStartInfo
.
Arguments
+=
workBox
.
Text
;
}
//CSRender.exeを実行
Process
process
=
Process
.
Start
(
processStartInfo
);
ResultConsole
.
Text
=
process
.
StandardOutput
.
ReadToEnd
();
ResultConsole
.
ScrollToEnd
();
process
.
WaitForExit
();
process
.
Close
();
}
}
}
Code/CSRender/CSRender/packages.config
0 → 100644
View file @
24fda800
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
package
id
=
"Microsoft.WindowsAPICodePack-Core"
version
=
"1.1.0.2"
targetFramework
=
"net461"
/>
<
package
id
=
"Microsoft.WindowsAPICodePack-Shell"
version
=
"1.1.0.0"
targetFramework
=
"net461"
/>
</
packages
>
\ No newline at end of file
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