Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
Ftt_Common
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
Administrator
Ftt_Common
Commits
7a63ecf0
Commit
7a63ecf0
authored
Aug 15, 2025
by
罗显健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【编号:21348】项目打包升级
parent
44ef276f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
290 additions
and
151 deletions
+290
-151
FrmMain.Designer.cs
Ftt.PatchPack/FrmMain.Designer.cs
+157
-77
FrmMain.cs
Ftt.PatchPack/FrmMain.cs
+53
-38
FrmProject.cs
Ftt.PatchPack/FrmProject.cs
+11
-25
Project.cs
Ftt.PatchPack/Project.cs
+69
-11
No files found.
Ftt.PatchPack/FrmMain.Designer.cs
View file @
7a63ecf0
...
@@ -35,25 +35,35 @@
...
@@ -35,25 +35,35 @@
this
.
lstProject
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
lstProject
=
new
System
.
Windows
.
Forms
.
ListView
();
this
.
lblNotes
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
lblNotes
=
new
System
.
Windows
.
Forms
.
Label
();
this
.
pnlTop
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
pnlTop
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
ckbPackTemplate
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
btnCopy
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
cmbPeriod
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
ckbMergeSql
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
ckbMergeSql
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
ckbShowLog
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
ckbDelHisPack
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
btnOpenDirectory
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnOpenDirectory
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnDel
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
btnDel
=
new
System
.
Windows
.
Forms
.
Button
();
this
.
ckbDelHisPack
=
new
System
.
Windows
.
Forms
.
CheckBox
();
this
.
pnlLeft
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
pnlLeft
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
gpbLog
=
new
System
.
Windows
.
Forms
.
GroupBox
();
this
.
pnlMIddle
=
new
System
.
Windows
.
Forms
.
Panel
();
this
.
tabControl1
=
new
System
.
Windows
.
Forms
.
TabControl
();
this
.
tabPageRemark
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
tabPageLog
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
txtLog
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
txtLog
=
new
System
.
Windows
.
Forms
.
TextBox
();
this
.
cmbPeriod
=
new
System
.
Windows
.
Forms
.
ComboBox
();
this
.
tabPageConfig
=
new
System
.
Windows
.
Forms
.
TabPage
();
this
.
pnlTop
.
SuspendLayout
();
this
.
pnlTop
.
SuspendLayout
();
this
.
pnlLeft
.
SuspendLayout
();
this
.
pnlLeft
.
SuspendLayout
();
this
.
gpbLog
.
SuspendLayout
();
this
.
pnlMIddle
.
SuspendLayout
();
this
.
tabControl1
.
SuspendLayout
();
this
.
tabPageRemark
.
SuspendLayout
();
this
.
tabPageLog
.
SuspendLayout
();
this
.
tabPageConfig
.
SuspendLayout
();
this
.
SuspendLayout
();
this
.
SuspendLayout
();
//
//
// btnAdd
// btnAdd
//
//
this
.
btnAdd
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
btnAdd
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnAdd
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnAdd
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnAdd
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnAdd
.
Location
=
new
System
.
Drawing
.
Point
(
12
,
1
5
);
this
.
btnAdd
.
Location
=
new
System
.
Drawing
.
Point
(
656
,
5
);
this
.
btnAdd
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnAdd
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnAdd
.
Name
=
"btnAdd"
;
this
.
btnAdd
.
Name
=
"btnAdd"
;
this
.
btnAdd
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
27
);
this
.
btnAdd
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
27
);
...
@@ -66,10 +76,10 @@
...
@@ -66,10 +76,10 @@
//
//
this
.
btnPatch
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnPatch
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnPatch
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnPatch
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnPatch
.
Location
=
new
System
.
Drawing
.
Point
(
358
,
4
);
this
.
btnPatch
.
Location
=
new
System
.
Drawing
.
Point
(
6
,
3
);
this
.
btnPatch
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnPatch
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnPatch
.
Name
=
"btnPatch"
;
this
.
btnPatch
.
Name
=
"btnPatch"
;
this
.
btnPatch
.
Size
=
new
System
.
Drawing
.
Size
(
122
,
27
);
this
.
btnPatch
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
27
);
this
.
btnPatch
.
TabIndex
=
9
;
this
.
btnPatch
.
TabIndex
=
9
;
this
.
btnPatch
.
Text
=
"项目打包"
;
this
.
btnPatch
.
Text
=
"项目打包"
;
this
.
btnPatch
.
UseVisualStyleBackColor
=
false
;
this
.
btnPatch
.
UseVisualStyleBackColor
=
false
;
...
@@ -77,9 +87,10 @@
...
@@ -77,9 +87,10 @@
//
//
// btnEdit
// btnEdit
//
//
this
.
btnEdit
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
btnEdit
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnEdit
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnEdit
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnEdit
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnEdit
.
Location
=
new
System
.
Drawing
.
Point
(
116
,
1
5
);
this
.
btnEdit
.
Location
=
new
System
.
Drawing
.
Point
(
760
,
5
);
this
.
btnEdit
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnEdit
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnEdit
.
Name
=
"btnEdit"
;
this
.
btnEdit
.
Name
=
"btnEdit"
;
this
.
btnEdit
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
27
);
this
.
btnEdit
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
27
);
...
@@ -95,34 +106,34 @@
...
@@ -95,34 +106,34 @@
this
.
lstProject
.
FullRowSelect
=
true
;
this
.
lstProject
.
FullRowSelect
=
true
;
this
.
lstProject
.
HideSelection
=
false
;
this
.
lstProject
.
HideSelection
=
false
;
this
.
lstProject
.
ImeMode
=
System
.
Windows
.
Forms
.
ImeMode
.
NoControl
;
this
.
lstProject
.
ImeMode
=
System
.
Windows
.
Forms
.
ImeMode
.
NoControl
;
this
.
lstProject
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
58
);
this
.
lstProject
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
lstProject
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
lstProject
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
lstProject
.
Name
=
"lstProject"
;
this
.
lstProject
.
Name
=
"lstProject"
;
this
.
lstProject
.
RightToLeft
=
System
.
Windows
.
Forms
.
RightToLeft
.
No
;
this
.
lstProject
.
RightToLeft
=
System
.
Windows
.
Forms
.
RightToLeft
.
No
;
this
.
lstProject
.
RightToLeftLayout
=
true
;
this
.
lstProject
.
RightToLeftLayout
=
true
;
this
.
lstProject
.
ShowGroups
=
false
;
this
.
lstProject
.
ShowGroups
=
false
;
this
.
lstProject
.
Size
=
new
System
.
Drawing
.
Size
(
1024
,
231
);
this
.
lstProject
.
Size
=
new
System
.
Drawing
.
Size
(
862
,
359
);
this
.
lstProject
.
TabIndex
=
10
;
this
.
lstProject
.
TabIndex
=
10
;
this
.
lstProject
.
UseCompatibleStateImageBehavior
=
false
;
this
.
lstProject
.
UseCompatibleStateImageBehavior
=
false
;
this
.
lstProject
.
View
=
System
.
Windows
.
Forms
.
View
.
List
;
this
.
lstProject
.
View
=
System
.
Windows
.
Forms
.
View
.
List
;
//
//
// lblNotes
// lblNotes
//
//
this
.
lblNotes
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Bottom
;
this
.
lblNotes
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
lblNotes
.
ForeColor
=
System
.
Drawing
.
Color
.
DarkGoldenrod
;
this
.
lblNotes
.
ForeColor
=
System
.
Drawing
.
Color
.
DarkGoldenrod
;
this
.
lblNotes
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
289
);
this
.
lblNotes
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
lblNotes
.
Name
=
"lblNotes"
;
this
.
lblNotes
.
Name
=
"lblNotes"
;
this
.
lblNotes
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
12
,
8
,
0
,
0
);
this
.
lblNotes
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
12
,
8
,
0
,
0
);
this
.
lblNotes
.
Size
=
new
System
.
Drawing
.
Size
(
1024
,
52
);
this
.
lblNotes
.
Size
=
new
System
.
Drawing
.
Size
(
854
,
88
);
this
.
lblNotes
.
TabIndex
=
11
;
this
.
lblNotes
.
TabIndex
=
11
;
this
.
lblNotes
.
Text
=
"注意:本工具只打包项目设定文件夹内通用文件。
。。。。详细内容见源代码
"
;
this
.
lblNotes
.
Text
=
"注意:本工具只打包项目设定文件夹内通用文件。
如需其他文件请手动打包。
"
;
//
//
// pnlTop
// pnlTop
//
//
this
.
pnlTop
.
Controls
.
Add
(
this
.
ckbPackTemplate
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
btnCopy
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
cmbPeriod
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
cmbPeriod
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
ckbMergeSql
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
ckbMergeSql
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
ckbShowLog
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
ckbDelHisPack
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
btnOpenDirectory
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
btnOpenDirectory
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
btnDel
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
btnDel
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
btnEdit
);
this
.
pnlTop
.
Controls
.
Add
(
this
.
btnEdit
);
...
@@ -132,56 +143,65 @@
...
@@ -132,56 +143,65 @@
this
.
pnlTop
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
pnlTop
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
pnlTop
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
pnlTop
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
pnlTop
.
Name
=
"pnlTop"
;
this
.
pnlTop
.
Name
=
"pnlTop"
;
this
.
pnlTop
.
Size
=
new
System
.
Drawing
.
Size
(
1024
,
58
);
this
.
pnlTop
.
Size
=
new
System
.
Drawing
.
Size
(
862
,
63
);
this
.
pnlTop
.
TabIndex
=
12
;
this
.
pnlTop
.
TabIndex
=
12
;
//
//
// ckbPackTemplate
//
this
.
ckbPackTemplate
.
AutoSize
=
true
;
this
.
ckbPackTemplate
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
ckbPackTemplate
.
ForeColor
=
System
.
Drawing
.
Color
.
Blue
;
this
.
ckbPackTemplate
.
Location
=
new
System
.
Drawing
.
Point
(
113
,
36
);
this
.
ckbPackTemplate
.
Name
=
"ckbPackTemplate"
;
this
.
ckbPackTemplate
.
Size
=
new
System
.
Drawing
.
Size
(
99
,
21
);
this
.
ckbPackTemplate
.
TabIndex
=
17
;
this
.
ckbPackTemplate
.
Text
=
"打包模版文件"
;
this
.
ckbPackTemplate
.
UseVisualStyleBackColor
=
false
;
this
.
ckbPackTemplate
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
ckbPackTemplate_CheckedChanged
);
//
// btnCopy
//
this
.
btnCopy
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
btnCopy
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnCopy
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnCopy
.
Location
=
new
System
.
Drawing
.
Point
(
657
,
33
);
this
.
btnCopy
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnCopy
.
Name
=
"btnCopy"
;
this
.
btnCopy
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
27
);
this
.
btnCopy
.
TabIndex
=
16
;
this
.
btnCopy
.
Text
=
"复制项目"
;
this
.
btnCopy
.
UseVisualStyleBackColor
=
false
;
this
.
btnCopy
.
Click
+=
new
System
.
EventHandler
(
this
.
btnCopy_Click
);
//
// cmbPeriod
//
this
.
cmbPeriod
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
this
.
cmbPeriod
.
FormattingEnabled
=
true
;
this
.
cmbPeriod
.
Location
=
new
System
.
Drawing
.
Point
(
113
,
3
);
this
.
cmbPeriod
.
Name
=
"cmbPeriod"
;
this
.
cmbPeriod
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
25
);
this
.
cmbPeriod
.
TabIndex
=
15
;
//
// ckbMergeSql
// ckbMergeSql
//
//
this
.
ckbMergeSql
.
AutoSize
=
true
;
this
.
ckbMergeSql
.
AutoSize
=
true
;
this
.
ckbMergeSql
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
ckbMergeSql
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
ckbMergeSql
.
ForeColor
=
System
.
Drawing
.
Color
.
Blue
;
this
.
ckbMergeSql
.
ForeColor
=
System
.
Drawing
.
Color
.
Blue
;
this
.
ckbMergeSql
.
Location
=
new
System
.
Drawing
.
Point
(
573
,
33
);
this
.
ckbMergeSql
.
Location
=
new
System
.
Drawing
.
Point
(
8
,
36
);
this
.
ckbMergeSql
.
Name
=
"ckbMergeSql"
;
this
.
ckbMergeSql
.
Name
=
"ckbMergeSql"
;
this
.
ckbMergeSql
.
Size
=
new
System
.
Drawing
.
Size
(
93
,
21
);
this
.
ckbMergeSql
.
Size
=
new
System
.
Drawing
.
Size
(
93
,
21
);
this
.
ckbMergeSql
.
TabIndex
=
14
;
this
.
ckbMergeSql
.
TabIndex
=
14
;
this
.
ckbMergeSql
.
Text
=
"合并Sql脚本"
;
this
.
ckbMergeSql
.
Text
=
"合并Sql脚本"
;
this
.
ckbMergeSql
.
UseVisualStyleBackColor
=
false
;
this
.
ckbMergeSql
.
UseVisualStyleBackColor
=
false
;
//
//
// ckbShowLog
//
this
.
ckbShowLog
.
AutoSize
=
true
;
this
.
ckbShowLog
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
ckbShowLog
.
ForeColor
=
System
.
Drawing
.
Color
.
Blue
;
this
.
ckbShowLog
.
Location
=
new
System
.
Drawing
.
Point
(
488
,
34
);
this
.
ckbShowLog
.
Name
=
"ckbShowLog"
;
this
.
ckbShowLog
.
Size
=
new
System
.
Drawing
.
Size
(
75
,
21
);
this
.
ckbShowLog
.
TabIndex
=
13
;
this
.
ckbShowLog
.
Text
=
"显示日志"
;
this
.
ckbShowLog
.
UseVisualStyleBackColor
=
false
;
this
.
ckbShowLog
.
CheckedChanged
+=
new
System
.
EventHandler
(
this
.
ckbShowLog_CheckedChanged
);
//
// ckbDelHisPack
//
this
.
ckbDelHisPack
.
AutoSize
=
true
;
this
.
ckbDelHisPack
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
ckbDelHisPack
.
Checked
=
true
;
this
.
ckbDelHisPack
.
CheckState
=
System
.
Windows
.
Forms
.
CheckState
.
Checked
;
this
.
ckbDelHisPack
.
ForeColor
=
System
.
Drawing
.
Color
.
Blue
;
this
.
ckbDelHisPack
.
Location
=
new
System
.
Drawing
.
Point
(
362
,
34
);
this
.
ckbDelHisPack
.
Name
=
"ckbDelHisPack"
;
this
.
ckbDelHisPack
.
Size
=
new
System
.
Drawing
.
Size
(
111
,
21
);
this
.
ckbDelHisPack
.
TabIndex
=
12
;
this
.
ckbDelHisPack
.
Text
=
"删除项目历史包"
;
this
.
ckbDelHisPack
.
UseVisualStyleBackColor
=
false
;
//
// btnOpenDirectory
// btnOpenDirectory
//
//
this
.
btnOpenDirectory
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnOpenDirectory
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnOpenDirectory
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnOpenDirectory
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnOpenDirectory
.
Location
=
new
System
.
Drawing
.
Point
(
486
,
4
);
this
.
btnOpenDirectory
.
Location
=
new
System
.
Drawing
.
Point
(
226
,
3
);
this
.
btnOpenDirectory
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnOpenDirectory
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnOpenDirectory
.
Name
=
"btnOpenDirectory"
;
this
.
btnOpenDirectory
.
Name
=
"btnOpenDirectory"
;
this
.
btnOpenDirectory
.
Size
=
new
System
.
Drawing
.
Size
(
81
,
27
);
this
.
btnOpenDirectory
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
27
);
this
.
btnOpenDirectory
.
TabIndex
=
11
;
this
.
btnOpenDirectory
.
TabIndex
=
11
;
this
.
btnOpenDirectory
.
Text
=
"打开目录"
;
this
.
btnOpenDirectory
.
Text
=
"打开目录"
;
this
.
btnOpenDirectory
.
UseVisualStyleBackColor
=
false
;
this
.
btnOpenDirectory
.
UseVisualStyleBackColor
=
false
;
...
@@ -189,9 +209,10 @@
...
@@ -189,9 +209,10 @@
//
//
// btnDel
// btnDel
//
//
this
.
btnDel
.
Anchor
=
((
System
.
Windows
.
Forms
.
AnchorStyles
)((
System
.
Windows
.
Forms
.
AnchorStyles
.
Top
|
System
.
Windows
.
Forms
.
AnchorStyles
.
Right
)));
this
.
btnDel
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnDel
.
BackColor
=
System
.
Drawing
.
SystemColors
.
Control
;
this
.
btnDel
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnDel
.
ForeColor
=
System
.
Drawing
.
SystemColors
.
WindowText
;
this
.
btnDel
.
Location
=
new
System
.
Drawing
.
Point
(
220
,
15
);
this
.
btnDel
.
Location
=
new
System
.
Drawing
.
Point
(
760
,
33
);
this
.
btnDel
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnDel
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
3
,
4
,
3
,
4
);
this
.
btnDel
.
Name
=
"btnDel"
;
this
.
btnDel
.
Name
=
"btnDel"
;
this
.
btnDel
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
27
);
this
.
btnDel
.
Size
=
new
System
.
Drawing
.
Size
(
97
,
27
);
...
@@ -200,52 +221,101 @@
...
@@ -200,52 +221,101 @@
this
.
btnDel
.
UseVisualStyleBackColor
=
false
;
this
.
btnDel
.
UseVisualStyleBackColor
=
false
;
this
.
btnDel
.
Click
+=
new
System
.
EventHandler
(
this
.
btnDel_Click
);
this
.
btnDel
.
Click
+=
new
System
.
EventHandler
(
this
.
btnDel_Click
);
//
//
// ckbDelHisPack
//
this
.
ckbDelHisPack
.
AutoSize
=
true
;
this
.
ckbDelHisPack
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
this
.
ckbDelHisPack
.
Checked
=
true
;
this
.
ckbDelHisPack
.
CheckState
=
System
.
Windows
.
Forms
.
CheckState
.
Checked
;
this
.
ckbDelHisPack
.
ForeColor
=
System
.
Drawing
.
Color
.
Black
;
this
.
ckbDelHisPack
.
Location
=
new
System
.
Drawing
.
Point
(
9
,
8
);
this
.
ckbDelHisPack
.
Name
=
"ckbDelHisPack"
;
this
.
ckbDelHisPack
.
Size
=
new
System
.
Drawing
.
Size
(
111
,
21
);
this
.
ckbDelHisPack
.
TabIndex
=
12
;
this
.
ckbDelHisPack
.
Text
=
"删除项目历史包"
;
this
.
ckbDelHisPack
.
UseVisualStyleBackColor
=
false
;
//
// pnlLeft
// pnlLeft
//
//
this
.
pnlLeft
.
Controls
.
Add
(
this
.
lstProject
);
this
.
pnlLeft
.
Controls
.
Add
(
this
.
pnlMIddle
);
this
.
pnlLeft
.
Controls
.
Add
(
this
.
lblNotes
);
this
.
pnlLeft
.
Controls
.
Add
(
this
.
tabControl1
);
this
.
pnlLeft
.
Controls
.
Add
(
this
.
pnlTop
);
this
.
pnlLeft
.
Controls
.
Add
(
this
.
pnlTop
);
this
.
pnlLeft
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
pnlLeft
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
pnlLeft
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
pnlLeft
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
0
);
this
.
pnlLeft
.
Name
=
"pnlLeft"
;
this
.
pnlLeft
.
Name
=
"pnlLeft"
;
this
.
pnlLeft
.
Size
=
new
System
.
Drawing
.
Size
(
1024
,
341
);
this
.
pnlLeft
.
Size
=
new
System
.
Drawing
.
Size
(
862
,
540
);
this
.
pnlLeft
.
TabIndex
=
13
;
this
.
pnlLeft
.
TabIndex
=
13
;
//
//
// gpbLog
// pnlMIddle
//
//
this
.
gpbLog
.
Controls
.
Add
(
this
.
txtLog
);
this
.
pnlMIddle
.
Controls
.
Add
(
this
.
lstProject
);
this
.
gpbLog
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Right
;
this
.
pnlMIddle
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
gpbLog
.
Location
=
new
System
.
Drawing
.
Point
(
672
,
0
);
this
.
pnlMIddle
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
63
);
this
.
gpbLog
.
Name
=
"gpbLog"
;
this
.
pnlMIddle
.
Name
=
"pnlMIddle"
;
this
.
gpbLog
.
Size
=
new
System
.
Drawing
.
Size
(
352
,
341
);
this
.
pnlMIddle
.
Size
=
new
System
.
Drawing
.
Size
(
862
,
359
);
this
.
gpbLog
.
TabIndex
=
0
;
this
.
pnlMIddle
.
TabIndex
=
13
;
this
.
gpbLog
.
TabStop
=
false
;
//
this
.
gpbLog
.
Text
=
"************** 操作日志 **************"
;
// tabControl1
//
this
.
tabControl1
.
Controls
.
Add
(
this
.
tabPageRemark
);
this
.
tabControl1
.
Controls
.
Add
(
this
.
tabPageLog
);
this
.
tabControl1
.
Controls
.
Add
(
this
.
tabPageConfig
);
this
.
tabControl1
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Bottom
;
this
.
tabControl1
.
Location
=
new
System
.
Drawing
.
Point
(
0
,
422
);
this
.
tabControl1
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
tabControl1
.
Name
=
"tabControl1"
;
this
.
tabControl1
.
SelectedIndex
=
0
;
this
.
tabControl1
.
Size
=
new
System
.
Drawing
.
Size
(
862
,
118
);
this
.
tabControl1
.
TabIndex
=
11
;
//
// tabPageRemark
//
this
.
tabPageRemark
.
Controls
.
Add
(
this
.
lblNotes
);
this
.
tabPageRemark
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
26
);
this
.
tabPageRemark
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
tabPageRemark
.
Name
=
"tabPageRemark"
;
this
.
tabPageRemark
.
Size
=
new
System
.
Drawing
.
Size
(
854
,
88
);
this
.
tabPageRemark
.
TabIndex
=
0
;
this
.
tabPageRemark
.
Text
=
"说明"
;
this
.
tabPageRemark
.
UseVisualStyleBackColor
=
true
;
//
// tabPageLog
//
this
.
tabPageLog
.
Controls
.
Add
(
this
.
txtLog
);
this
.
tabPageLog
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
26
);
this
.
tabPageLog
.
Name
=
"tabPageLog"
;
this
.
tabPageLog
.
Padding
=
new
System
.
Windows
.
Forms
.
Padding
(
3
);
this
.
tabPageLog
.
Size
=
new
System
.
Drawing
.
Size
(
854
,
88
);
this
.
tabPageLog
.
TabIndex
=
1
;
this
.
tabPageLog
.
Text
=
"日志"
;
this
.
tabPageLog
.
UseVisualStyleBackColor
=
true
;
//
//
// txtLog
// txtLog
//
//
this
.
txtLog
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
txtLog
.
Dock
=
System
.
Windows
.
Forms
.
DockStyle
.
Fill
;
this
.
txtLog
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
19
);
this
.
txtLog
.
Location
=
new
System
.
Drawing
.
Point
(
3
,
3
);
this
.
txtLog
.
Margin
=
new
System
.
Windows
.
Forms
.
Padding
(
0
);
this
.
txtLog
.
Multiline
=
true
;
this
.
txtLog
.
Multiline
=
true
;
this
.
txtLog
.
Name
=
"txtLog"
;
this
.
txtLog
.
Name
=
"txtLog"
;
this
.
txtLog
.
Size
=
new
System
.
Drawing
.
Size
(
346
,
319
);
this
.
txtLog
.
ReadOnly
=
true
;
this
.
txtLog
.
Size
=
new
System
.
Drawing
.
Size
(
848
,
82
);
this
.
txtLog
.
TabIndex
=
0
;
this
.
txtLog
.
TabIndex
=
0
;
//
//
//
cmbPeriod
//
tabPageConfig
//
//
this
.
cmbPeriod
.
DropDownStyle
=
System
.
Windows
.
Forms
.
ComboBoxStyle
.
DropDownList
;
this
.
tabPageConfig
.
Controls
.
Add
(
this
.
ckbDelHisPack
);
this
.
cmbPeriod
.
FormattingEnabled
=
true
;
this
.
tabPageConfig
.
Location
=
new
System
.
Drawing
.
Point
(
4
,
26
);
this
.
cmbPeriod
.
Location
=
new
System
.
Drawing
.
Point
(
573
,
4
);
this
.
tabPageConfig
.
Name
=
"tabPageConfig"
;
this
.
cmbPeriod
.
Name
=
"cmbPeriod"
;
this
.
tabPageConfig
.
Size
=
new
System
.
Drawing
.
Size
(
854
,
88
);
this
.
cmbPeriod
.
Size
=
new
System
.
Drawing
.
Size
(
90
,
25
);
this
.
tabPageConfig
.
TabIndex
=
2
;
this
.
cmbPeriod
.
TabIndex
=
15
;
this
.
tabPageConfig
.
Text
=
"配置"
;
this
.
tabPageConfig
.
UseVisualStyleBackColor
=
true
;
//
//
// FrmMain
// FrmMain
//
//
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
17F
);
this
.
AutoScaleDimensions
=
new
System
.
Drawing
.
SizeF
(
7F
,
17F
);
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
AutoScaleMode
=
System
.
Windows
.
Forms
.
AutoScaleMode
.
Font
;
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
1024
,
341
);
this
.
ClientSize
=
new
System
.
Drawing
.
Size
(
862
,
540
);
this
.
Controls
.
Add
(
this
.
gpbLog
);
this
.
Controls
.
Add
(
this
.
pnlLeft
);
this
.
Controls
.
Add
(
this
.
pnlLeft
);
this
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
Font
=
new
System
.
Drawing
.
Font
(
"微软雅黑"
,
9F
,
System
.
Drawing
.
FontStyle
.
Regular
,
System
.
Drawing
.
GraphicsUnit
.
Point
,
((
byte
)(
134
)));
this
.
FormBorderStyle
=
System
.
Windows
.
Forms
.
FormBorderStyle
.
FixedSingle
;
this
.
FormBorderStyle
=
System
.
Windows
.
Forms
.
FormBorderStyle
.
FixedSingle
;
...
@@ -260,8 +330,13 @@
...
@@ -260,8 +330,13 @@
this
.
pnlTop
.
ResumeLayout
(
false
);
this
.
pnlTop
.
ResumeLayout
(
false
);
this
.
pnlTop
.
PerformLayout
();
this
.
pnlTop
.
PerformLayout
();
this
.
pnlLeft
.
ResumeLayout
(
false
);
this
.
pnlLeft
.
ResumeLayout
(
false
);
this
.
gpbLog
.
ResumeLayout
(
false
);
this
.
pnlMIddle
.
ResumeLayout
(
false
);
this
.
gpbLog
.
PerformLayout
();
this
.
tabControl1
.
ResumeLayout
(
false
);
this
.
tabPageRemark
.
ResumeLayout
(
false
);
this
.
tabPageLog
.
ResumeLayout
(
false
);
this
.
tabPageLog
.
PerformLayout
();
this
.
tabPageConfig
.
ResumeLayout
(
false
);
this
.
tabPageConfig
.
PerformLayout
();
this
.
ResumeLayout
(
false
);
this
.
ResumeLayout
(
false
);
}
}
...
@@ -277,11 +352,16 @@
...
@@ -277,11 +352,16 @@
private
System
.
Windows
.
Forms
.
Button
btnOpenDirectory
;
private
System
.
Windows
.
Forms
.
Button
btnOpenDirectory
;
private
System
.
Windows
.
Forms
.
CheckBox
ckbDelHisPack
;
private
System
.
Windows
.
Forms
.
CheckBox
ckbDelHisPack
;
private
System
.
Windows
.
Forms
.
Panel
pnlLeft
;
private
System
.
Windows
.
Forms
.
Panel
pnlLeft
;
private
System
.
Windows
.
Forms
.
CheckBox
ckbShowLog
;
private
System
.
Windows
.
Forms
.
GroupBox
gpbLog
;
private
System
.
Windows
.
Forms
.
CheckBox
ckbMergeSql
;
private
System
.
Windows
.
Forms
.
CheckBox
ckbMergeSql
;
private
System
.
Windows
.
Forms
.
ComboBox
cmbPeriod
;
private
System
.
Windows
.
Forms
.
ComboBox
cmbPeriod
;
private
System
.
Windows
.
Forms
.
TextBox
txtLog
;
private
System
.
Windows
.
Forms
.
TextBox
txtLog
;
private
System
.
Windows
.
Forms
.
Button
btnCopy
;
private
System
.
Windows
.
Forms
.
Panel
pnlMIddle
;
private
System
.
Windows
.
Forms
.
TabControl
tabControl1
;
private
System
.
Windows
.
Forms
.
TabPage
tabPageRemark
;
private
System
.
Windows
.
Forms
.
TabPage
tabPageLog
;
private
System
.
Windows
.
Forms
.
TabPage
tabPageConfig
;
private
System
.
Windows
.
Forms
.
CheckBox
ckbPackTemplate
;
}
}
}
}
Ftt.PatchPack/FrmMain.cs
View file @
7a63ecf0
...
@@ -33,12 +33,9 @@ namespace Ftt.PatchPack
...
@@ -33,12 +33,9 @@ namespace Ftt.PatchPack
private
void
FrmMain_Load
(
object
sender
,
EventArgs
e
)
private
void
FrmMain_Load
(
object
sender
,
EventArgs
e
)
{
{
InitForm
();
InitForm
();
}
}
private
void
InitForm
()
private
void
InitForm
()
{
{
LogVisible
(
false
);
projects
=
ProjectHelp
.
Read
();
projects
=
ProjectHelp
.
Read
();
if
(
projects
==
null
)
projects
=
new
Dictionary
<
string
,
Project
>();
if
(
projects
==
null
)
projects
=
new
Dictionary
<
string
,
Project
>();
foreach
(
var
cli
in
projects
)
foreach
(
var
cli
in
projects
)
...
@@ -79,8 +76,7 @@ namespace Ftt.PatchPack
...
@@ -79,8 +76,7 @@ namespace Ftt.PatchPack
}
}
#
endregion
#
endregion
#
region
按钮操作
#
region
【项目】添加、复制、修改、删除
private
void
btnAdd_Click
(
object
sender
,
EventArgs
e
)
private
void
btnAdd_Click
(
object
sender
,
EventArgs
e
)
{
{
Project
project
=
new
Project
();
Project
project
=
new
Project
();
...
@@ -92,6 +88,28 @@ namespace Ftt.PatchPack
...
@@ -92,6 +88,28 @@ namespace Ftt.PatchPack
}
}
}
}
}
}
private
void
btnCopy_Click
(
object
sender
,
EventArgs
e
)
{
if
(
lstProject
.
SelectedItems
.
Count
==
0
)
{
MessageBox
.
Show
(
"请选择需要复制的项目"
);
return
;
}
if
(!
projects
.
TryGetValue
(
lstProject
.
SelectedItems
[
0
].
Text
,
out
Project
project
))
{
MessageBox
.
Show
(
"复制项目失败!"
);
return
;
}
var
newProject
=
project
.
Copy
();
using
(
FrmProject
frmProject
=
new
FrmProject
(
projects
,
ref
newProject
))
{
if
(
frmProject
.
ShowDialog
()
==
DialogResult
.
Yes
)
{
lstProject
.
Items
.
Add
(
newProject
.
Name
);
}
}
}
private
void
btnEdit_Click
(
object
sender
,
EventArgs
e
)
private
void
btnEdit_Click
(
object
sender
,
EventArgs
e
)
{
{
...
@@ -113,9 +131,12 @@ namespace Ftt.PatchPack
...
@@ -113,9 +131,12 @@ namespace Ftt.PatchPack
private
void
btnDel_Click
(
object
sender
,
EventArgs
e
)
private
void
btnDel_Click
(
object
sender
,
EventArgs
e
)
{
{
var
items
=
lstProject
.
CheckedItems
;
var
items
=
lstProject
.
CheckedItems
;
if
(
items
.
Count
==
0
)
return
;
if
(
items
.
Count
==
0
)
{
if
(
MessageBox
.
Show
(
"确定要删除选择的项目?"
,
""
,
MessageBoxButtons
.
YesNo
)
!=
DialogResult
.
Yes
)
return
;
MessageBox
.
Show
(
"请选择需要删除的项目!"
);
return
;
}
if
(
MessageBox
.
Show
(
$"是否确定要删除勾选的
{
items
.
Count
}
个项目?"
,
"询问"
,
MessageBoxButtons
.
YesNo
)
!=
DialogResult
.
Yes
)
return
;
for
(
int
index
=
items
.
Count
-
1
;
index
>=
0
;
index
--)
for
(
int
index
=
items
.
Count
-
1
;
index
>=
0
;
index
--)
{
{
...
@@ -130,7 +151,9 @@ namespace Ftt.PatchPack
...
@@ -130,7 +151,9 @@ namespace Ftt.PatchPack
ProjectHelp
.
Save
(
projects
);
// 删除后,需要保存
ProjectHelp
.
Save
(
projects
);
// 删除后,需要保存
}
}
#
endregion
#
region
按钮操作
private
void
btnPatch_Click
(
object
sender
,
EventArgs
e
)
private
void
btnPatch_Click
(
object
sender
,
EventArgs
e
)
{
{
var
items
=
lstProject
.
CheckedItems
;
var
items
=
lstProject
.
CheckedItems
;
...
@@ -153,10 +176,11 @@ namespace Ftt.PatchPack
...
@@ -153,10 +176,11 @@ namespace Ftt.PatchPack
item
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
item
.
BackColor
=
System
.
Drawing
.
Color
.
White
;
}
}
tabControl1
.
SelectTab
(
tabPageLog
);
//打包的时候,切换到日志页签
int
success
=
0
;
int
success
=
0
;
Cursor
.
Current
=
Cursors
.
WaitCursor
;
Cursor
.
Current
=
Cursors
.
WaitCursor
;
Project
.
MergeSqlFile
=
ckbMergeSql
.
Checked
;
InitProjectPackCfg
();
foreach
(
ListViewItem
item
in
items
)
foreach
(
ListViewItem
item
in
items
)
{
{
if
(
projects
.
TryGetValue
(
item
.
Text
,
out
Project
project
)
&&
project
!=
null
)
if
(
projects
.
TryGetValue
(
item
.
Text
,
out
Project
project
)
&&
project
!=
null
)
...
@@ -181,7 +205,7 @@ namespace Ftt.PatchPack
...
@@ -181,7 +205,7 @@ namespace Ftt.PatchPack
}
}
finally
finally
{
{
ProjectHelp
.
DeleteDirectoryIfExists
(
project
.
MergeSqlTempFullPath
);
ProjectHelp
.
DeleteDirectoryIfExists
(
project
.
MergeSqlTempFullPath
);
//删除合并脚本的临时目录
Application
.
DoEvents
();
Application
.
DoEvents
();
}
}
}
}
...
@@ -189,7 +213,6 @@ namespace Ftt.PatchPack
...
@@ -189,7 +213,6 @@ namespace Ftt.PatchPack
Cursor
.
Current
=
Cursors
.
Default
;
Cursor
.
Current
=
Cursors
.
Default
;
int
fail
=
totalCount
-
success
;
int
fail
=
totalCount
-
success
;
if
(
fail
>
0
)
ckbShowLog
.
Checked
=
true
;
string
strFail
=
fail
==
0
?
""
:
$",失败
{
fail
}
个"
;
string
strFail
=
fail
==
0
?
""
:
$",失败
{
fail
}
个"
;
MessageBox
.
Show
(
$"打包项目
{
totalCount
}
个,成功
{
success
}
个
{
strFail
}
。"
);
MessageBox
.
Show
(
$"打包项目
{
totalCount
}
个,成功
{
success
}
个
{
strFail
}
。"
);
...
@@ -208,36 +231,19 @@ namespace Ftt.PatchPack
...
@@ -208,36 +231,19 @@ namespace Ftt.PatchPack
System
.
Diagnostics
.
Process
.
Start
(
PackageFileDirectory
);
System
.
Diagnostics
.
Process
.
Start
(
PackageFileDirectory
);
}
}
/// <summary>
private
void
ckbPackTemplate_CheckedChanged
(
object
sender
,
EventArgs
e
)
/// 显示日志
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private
void
ckbShowLog_CheckedChanged
(
object
sender
,
EventArgs
e
)
{
{
LogVisible
(
ckbShowLog
.
Checked
);
if
(
ckbPackTemplate
.
Checked
)
}
#
endregion
#
region
内部方法
private
void
LogVisible
(
bool
visible
)
{
if
(
this
.
InvokeRequired
)
{
{
this
.
BeginInvoke
(
new
Action
<
bool
>(
LogVisible
),
visible
);
if
(
MessageBox
.
Show
(
"Template模版文件一般由项目组自己维护,是否确定打包?"
,
"警告"
,
MessageBoxButtons
.
OKCancel
,
MessageBoxIcon
.
Warning
)
==
DialogResult
.
Cancel
)
}
{
else
ckbPackTemplate
.
Checked
=
false
;
{
}
if
(
visible
)
this
.
Width
+=
gpbLog
.
Width
;
else
this
.
Width
-=
gpbLog
.
Width
;
gpbLog
.
Visible
=
visible
;
}
}
}
}
#
endregion
#
region
内部方法
/// <summary>
/// <summary>
/// 写日志
/// 写日志
/// </summary>
/// </summary>
...
@@ -253,6 +259,15 @@ namespace Ftt.PatchPack
...
@@ -253,6 +259,15 @@ namespace Ftt.PatchPack
txtLog
.
AppendText
(
content
+
"\r\n"
);
txtLog
.
AppendText
(
content
+
"\r\n"
);
}
}
}
}
/// <summary>
/// 初始化项目打包配置
/// </summary>
private
void
InitProjectPackCfg
()
{
Project
.
MergeSqlFile
=
ckbMergeSql
.
Checked
;
Project
.
PackTemplate
=
ckbPackTemplate
.
Checked
;
}
#
endregion
#
endregion
}
}
}
}
Ftt.PatchPack/FrmProject.cs
View file @
7a63ecf0
...
@@ -120,47 +120,33 @@ namespace Ftt.PatchPack
...
@@ -120,47 +120,33 @@ namespace Ftt.PatchPack
project
.
RelativeAppFilePath
=
txtRelativeAppFilePath
.
Text
.
Trim
();
project
.
RelativeAppFilePath
=
txtRelativeAppFilePath
.
Text
.
Trim
();
project
.
ExeName
=
this
.
txtExeName
.
Text
.
Trim
();
project
.
ExeName
=
this
.
txtExeName
.
Text
.
Trim
();
project
.
RelativeDbFilePath
=
txtRelativeDbFilePath
.
Text
.
Trim
();
project
.
RelativeDbFilePath
=
txtRelativeDbFilePath
.
Text
.
Trim
();
project
.
Name
=
txtProjectName
.
Text
.
Trim
();
if
(
project
.
Name
==
null
)
// 新增
if
(
this
.
dictionary
.
ContainsKey
(
project
.
Name
))
{
{
project
.
Name
=
txtProjectName
.
Text
.
Trim
();
if
(
dictionary
[
project
.
Name
]
!=
project
//如果是同一个对象,则不需要提示
&&
MessageBox
.
Show
(
null
,
$"项目【
{
project
.
Name
}
】已存在,是否替换?"
,
"提示"
,
MessageBoxButtons
.
YesNo
)
!=
DialogResult
.
Yes
)
if
(
this
.
dictionary
.
ContainsKey
(
project
.
Name
))
return
;
{
if
(
MessageBox
.
Show
(
null
,
"已存在,是否替换"
,
"提示"
,
MessageBoxButtons
.
YesNo
)
==
DialogResult
.
Yes
)
dictionary
[
project
.
Name
]
=
project
;
dictionary
[
project
.
Name
]
=
project
;
this
.
DialogResult
=
DialogResult
.
No
;
//替换项目无需添加,返回No
else
return
;
}
else
{
dictionary
.
Add
(
project
.
Name
,
project
);
}
}
}
else
else
{
{
// 移除原始的,再添加新的
dictionary
.
Remove
(
this
.
project
.
Name
);
project
.
Name
=
txtProjectName
.
Text
.
Trim
();
dictionary
.
Add
(
project
.
Name
,
project
);
dictionary
.
Add
(
project
.
Name
,
project
);
base
.
DialogResult
=
DialogResult
.
Yes
;
//需要添加到列表,返回Yes
}
}
ProjectHelp
.
Save
(
dictionary
);
ProjectHelp
.
Save
(
dictionary
);
MessageBox
.
Show
(
"保存成功!"
);
MessageBox
.
Show
(
"保存成功!"
);
base
.
DialogResult
=
DialogResult
.
Yes
;
this
.
Close
();
this
.
Close
();
}
}
catch
(
Exception
exception
)
catch
(
Exception
exception
)
{
{
base
.
DialogResult
=
DialogResult
.
None
;
MessageBox
.
Show
(
exception
.
ToString
());
MessageBox
.
Show
(
exception
.
ToString
());
}
}
}
}
private
void
btnCancle_Click
(
object
sender
,
EventArgs
e
)
private
void
btnCancle_Click
(
object
sender
,
EventArgs
e
)
...
...
Ftt.PatchPack/Project.cs
View file @
7a63ecf0
...
@@ -12,6 +12,18 @@ namespace Ftt.PatchPack
...
@@ -12,6 +12,18 @@ namespace Ftt.PatchPack
{
{
public
class
Project
public
class
Project
{
{
#
region
静态属性
/// <summary>
/// 是否合并sql文件,默认:否.
/// </summary>
public
static
bool
MergeSqlFile
=
false
;
/// <summary>
/// 是否打包模板文件,默认:否。
/// </summary>
public
static
bool
PackTemplate
=
false
;
#
endregion
#
region
属性定义
#
region
属性定义
/// <summary>
/// <summary>
...
@@ -53,10 +65,6 @@ namespace Ftt.PatchPack
...
@@ -53,10 +65,6 @@ namespace Ftt.PatchPack
/// </summary>
/// </summary>
public
string
RelativeDbFilePath
{
get
;
set
;
}
=
@"开发文档\数据库脚本"
;
public
string
RelativeDbFilePath
{
get
;
set
;
}
=
@"开发文档\数据库脚本"
;
/// <summary>
/// 是否合并sql文件.
/// </summary>
public
static
bool
MergeSqlFile
=
false
;
/// <summary>
/// <summary>
/// 合并Sql文件的临时目录,在<see cref="RelativeDbFilePath"/>目录下。
/// 合并Sql文件的临时目录,在<see cref="RelativeDbFilePath"/>目录下。
...
@@ -68,10 +76,16 @@ namespace Ftt.PatchPack
...
@@ -68,10 +76,16 @@ namespace Ftt.PatchPack
/// </summary>
/// </summary>
static
string
MergeSqlRelativePath
=
"MergeTemp"
;
static
string
MergeSqlRelativePath
=
"MergeTemp"
;
/// <summary>
/// 永久有效的年份标记:2099
/// <para>该年份文件夹内的文件、在有效期内的需要打包</para>
/// </summary>
static
int
ForeverValidYear
=
2099
;
#
endregion
#
endregion
/// <summary>
/// <summary>
/// 额外打包的文件(存在且更
更
新时间符合Dll的更新时间)。比如:更新 2021-11-26 17:30:39 lxj
/// 额外打包的文件(存在且更新时间符合Dll的更新时间)。比如:更新 2021-11-26 17:30:39 lxj
/// </summary>
/// </summary>
static
List
<
string
>
ContainFiles
=
new
List
<
string
>
{
"Notice.xml"
};
static
List
<
string
>
ContainFiles
=
new
List
<
string
>
{
"Notice.xml"
};
static
List
<
string
>
ExceptFiles
=
new
List
<
string
>
{
"U.Memopad.dll"
};
static
List
<
string
>
ExceptFiles
=
new
List
<
string
>
{
"U.Memopad.dll"
};
...
@@ -173,7 +187,12 @@ namespace Ftt.PatchPack
...
@@ -173,7 +187,12 @@ namespace Ftt.PatchPack
valid
.
AddRange
(
GetValidPatchFile
(
imgPath
,
"*.*"
,
SearchOption
.
TopDirectoryOnly
,
imgPath
,
$"
{
ExeName
}
\\Image"
,
PatchTimeFrame_Xml
));
valid
.
AddRange
(
GetValidPatchFile
(
imgPath
,
"*.*"
,
SearchOption
.
TopDirectoryOnly
,
imgPath
,
$"
{
ExeName
}
\\Image"
,
PatchTimeFrame_Xml
));
}
}
//当需要打包模板文件时,打包Template目录下的所有文件(时间范围同xml)
var
templatePath
=
Path
.
Combine
(
AbsoluteRootDirectory
,
RelativeAppFilePath
,
"Template"
);
if
(
PackTemplate
&&
System
.
IO
.
Directory
.
Exists
(
templatePath
))
{
valid
.
AddRange
(
GetValidPatchFile
(
templatePath
,
"*.*"
,
SearchOption
.
TopDirectoryOnly
,
templatePath
,
$"
{
ExeName
}
\\Template"
,
PatchTimeFrame_Xml
));
}
#
endregion
#
endregion
...
@@ -208,7 +227,10 @@ namespace Ftt.PatchPack
...
@@ -208,7 +227,10 @@ namespace Ftt.PatchPack
foreach
(
var
dire
in
dires
)
foreach
(
var
dire
in
dires
)
{
{
valid
.
AddRange
(
GetValidPatchFile
(
dire
.
FullName
,
"*.sql"
,
SearchOption
.
AllDirectories
,
path
,
"DB"
,
-
1
));
// 脚本文件夹里的文件永久有效。
// 2099-xx-xx文件内的脚本需要取有效期内的。其他日期的文件夹为增量脚本已通过校验,需要取所有。
var
hours
=
ParseToDateTime
(
dire
.
Name
).
Year
==
ForeverValidYear
?
PatchTimeFrame_Sql
:
-
1
;
valid
.
AddRange
(
GetValidPatchFile
(
dire
.
FullName
,
"*.sql"
,
SearchOption
.
AllDirectories
,
path
,
"DB"
,
hours
));
// 脚本文件夹里的文件永久有效。
}
}
}
}
...
@@ -254,6 +276,23 @@ namespace Ftt.PatchPack
...
@@ -254,6 +276,23 @@ namespace Ftt.PatchPack
Int32
.
TryParse
(
ConfigurationManager
.
AppSettings
[
"PatchTimeFrame_Xml"
],
out
PatchTimeFrame_Xml
);
Int32
.
TryParse
(
ConfigurationManager
.
AppSettings
[
"PatchTimeFrame_Xml"
],
out
PatchTimeFrame_Xml
);
}
}
/// <summary>
/// 复制项目
/// </summary>
/// <returns></returns>
public
Project
Copy
()
{
return
new
Project
{
Name
=
"请输入新项目名称"
,
ExeName
=
this
.
ExeName
,
AbsoluteRootDirectory
=
this
.
AbsoluteRootDirectory
,
RelativeAppFilePath
=
this
.
RelativeAppFilePath
,
RelativeDbFilePath
=
this
.
RelativeDbFilePath
,
MergeSqlTempFullPath
=
this
.
MergeSqlTempFullPath
};
}
#
endregion
#
endregion
#
region
私有方法
#
region
私有方法
...
@@ -276,9 +315,7 @@ namespace Ftt.PatchPack
...
@@ -276,9 +315,7 @@ namespace Ftt.PatchPack
{
{
DirectoryInfo
directoryInfo
=
new
DirectoryInfo
(
dir
);
DirectoryInfo
directoryInfo
=
new
DirectoryInfo
(
dir
);
var
dtFile
=
ParseToDateTime
(
directoryInfo
.
Name
);
// 文件夹的命名规则,必须是日期格式
if
(!
IsValidDBScriptFolderName
(
directoryInfo
.
Name
,
hours
))
continue
;
// 文件夹的命名规则,必须是日期格式
if
(!
IsValid
(
dtFile
,
hours
))
continue
;
validPath
.
Add
(
directoryInfo
);
validPath
.
Add
(
directoryInfo
);
}
}
...
@@ -305,8 +342,15 @@ namespace Ftt.PatchPack
...
@@ -305,8 +342,15 @@ namespace Ftt.PatchPack
FileInfo
destMergeFile
=
null
;
//合并文件锚点
FileInfo
destMergeFile
=
null
;
//合并文件锚点
foreach
(
var
sourceFile
in
sqlFiles
)
foreach
(
var
sourceFile
in
sqlFiles
)
{
{
//2099-xx-xx 的文件夹内,还有子文件夹。层级比其他日期的要多一层,合并时用到的临时目录也需要多一层。
if
(
sourceFile
.
RelativePatchPath
.
StartsWith
(
"DB\\2099"
))
{
var
subPath
=
Path
.
Combine
(
MergeSqlTempFullPath
,
sourceFile
.
RelativePatchPath
);
if
(!
Directory
.
Exists
(
subPath
))
Directory
.
CreateDirectory
(
subPath
);
//创建所有层级的子目录,打包结束会被删除
}
var
tmpFile
=
Path
.
Combine
(
MergeSqlTempFullPath
,
$"
{
sourceFile
.
RelativePatchPath
}
_
{
sourceFile
.
Name
}
"
);
var
tmpFile
=
Path
.
Combine
(
MergeSqlTempFullPath
,
$"
{
sourceFile
.
RelativePatchPath
}
_
{
sourceFile
.
Name
}
"
);
File
.
Copy
(
sourceFile
.
FullName
,
tmpFile
,
true
);
File
.
Copy
(
sourceFile
.
FullName
,
tmpFile
,
true
);
//把待合并的sql文件复制到临时目录。
if
(
ProjectHelp
.
CanMergeSqlFile
(
tmpFile
))
if
(
ProjectHelp
.
CanMergeSqlFile
(
tmpFile
))
{
{
...
@@ -428,6 +472,18 @@ namespace Ftt.PatchPack
...
@@ -428,6 +472,18 @@ namespace Ftt.PatchPack
return
date
;
return
date
;
}
}
/// <summary>
/// 校验脚本文件夹名称是否合法
/// </summary>
/// <param name="folderName">文件夹名称(日期格式)</param>
/// <param name="hours">打包期限,单位小时</param>
/// <returns></returns>
private
bool
IsValidDBScriptFolderName
(
string
folderName
,
double
hours
)
{
DateTime
date
=
ParseToDateTime
(
folderName
);
return
IsValid
(
date
,
hours
);
}
#
endregion
#
endregion
}
}
...
@@ -447,6 +503,8 @@ namespace Ftt.PatchPack
...
@@ -447,6 +503,8 @@ namespace Ftt.PatchPack
fileName
=
@"config\project.json"
;
fileName
=
@"config\project.json"
;
if
(
File
.
Exists
(
oldPath
))
if
(
File
.
Exists
(
oldPath
))
{
{
if
(!
Directory
.
Exists
(
Application
.
StartupPath
))
Directory
.
CreateDirectory
(
Application
.
StartupPath
);
File
.
Copy
(
oldPath
,
FilePath
,
true
);
File
.
Copy
(
oldPath
,
FilePath
,
true
);
File
.
Delete
(
oldPath
);
File
.
Delete
(
oldPath
);
}
}
...
...
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