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
93d4ea90
Commit
93d4ea90
authored
Aug 17, 2024
by
罗显健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.优化打包工具、脚本执行工具: 配置文件迁移到Config目录中
2.自动更新程序优化
parent
dda11c52
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
73 additions
and
25 deletions
+73
-25
Ftt.PatchPack.exe.config
AppHome/Ftt.PatchPack.exe.config
+0
-3
AutoUpdate.csproj
AutoUpdate/AutoUpdate.csproj
+1
-0
Form1.cs
AutoUpdate/Form1.cs
+43
-5
AssemblyInfo.cs
AutoUpdate/Properties/AssemblyInfo.cs
+3
-3
App.config
Ftt.PatchPack/App.config
+0
-3
Ftt.PatchPack.csproj
Ftt.PatchPack/Ftt.PatchPack.csproj
+1
-0
Project.cs
Ftt.PatchPack/Project.cs
+14
-1
ClientHelp.cs
UpdateExecuter/Helper/ClientHelp.cs
+11
-10
No files found.
AppHome/Ftt.PatchPack.exe.config
View file @
93d4ea90
...
@@ -8,9 +8,6 @@
...
@@ -8,9 +8,6 @@
<
add
key
=
"PatchTimeFrame_Dll"
value
=
"48"
/>
<
add
key
=
"PatchTimeFrame_Dll"
value
=
"48"
/>
<
add
key
=
"PatchTimeFrame_Sql"
value
=
"720"
/>
<
add
key
=
"PatchTimeFrame_Sql"
value
=
"720"
/>
<
add
key
=
"PatchTimeFrame_Xml"
value
=
"720"
/>
<
add
key
=
"PatchTimeFrame_Xml"
value
=
"720"
/>
<
add
key
=
"PatchTimeFrame_Xml"
value
=
"720"
/>
<!--是否排除.
pdb
文件。
1
:排除,其他包含。-->
<!--是否排除.
pdb
文件。
1
:排除,其他包含。-->
<
add
key
=
"Exclude_PDB"
value
=
"1"
/>
<
add
key
=
"Exclude_PDB"
value
=
"1"
/>
<
add
key
=
"ClientSettingsProvider.ServiceUri"
value
=
""
/>
<
add
key
=
"ClientSettingsProvider.ServiceUri"
value
=
""
/>
...
...
AutoUpdate/AutoUpdate.csproj
View file @
93d4ea90
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
<ErrorReport>
prompt
</ErrorReport>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
<LangVersion>
8.0
</LangVersion>
<LangVersion>
8.0
</LangVersion>
<Prefer32Bit>
false
</Prefer32Bit>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<PlatformTarget>
AnyCPU
</PlatformTarget>
...
...
AutoUpdate/Form1.cs
View file @
93d4ea90
...
@@ -16,6 +16,11 @@ namespace AutoUpdate
...
@@ -16,6 +16,11 @@ namespace AutoUpdate
string
_exeName
=
""
;
//程序名称(即进程名称)
string
_exeName
=
""
;
//程序名称(即进程名称)
string
_exportName
=
"AppHome"
;
//程序导出路径,此默认为AppHome
string
_exportName
=
"AppHome"
;
//程序导出路径,此默认为AppHome
/// <summary>
/// 更新结果,反馈给调用程序
/// </summary>
private
bool
updateSuccess
=
false
;
public
Form1
(
string
[]
args
)
public
Form1
(
string
[]
args
)
{
{
InitializeComponent
();
InitializeComponent
();
...
@@ -57,7 +62,7 @@ namespace AutoUpdate
...
@@ -57,7 +62,7 @@ namespace AutoUpdate
ProcessStartInfo
info
=
new
ProcessStartInfo
()
ProcessStartInfo
info
=
new
ProcessStartInfo
()
{
{
FileName
=
startup
,
FileName
=
startup
,
Arguments
=
"1"
,
Arguments
=
updateSuccess
?
"1"
:
"0"
,
// 更新成功携带参数1,反之0.
UseShellExecute
=
false
,
UseShellExecute
=
false
,
RedirectStandardError
=
true
,
RedirectStandardError
=
true
,
};
};
...
@@ -68,7 +73,7 @@ namespace AutoUpdate
...
@@ -68,7 +73,7 @@ namespace AutoUpdate
private
void
AppUpdate
()
private
void
AppUpdate
()
{
{
var
dt
=
GetPackageData
();
var
dt
=
GetPackageData
();
this
.
AddProcessText
(
80
);
this
.
AddProcessText
(
75
);
if
(
dt
.
DefaultView
.
Count
>
0
)
if
(
dt
.
DefaultView
.
Count
>
0
)
{
{
//结束原进程
//结束原进程
...
@@ -97,6 +102,12 @@ namespace AutoUpdate
...
@@ -97,6 +102,12 @@ namespace AutoUpdate
//删除更新包
//删除更新包
File
.
Delete
(
fileFullName
);
File
.
Delete
(
fileFullName
);
this
.
AddProcessText
(
100
);
this
.
AddProcessText
(
100
);
updateSuccess
=
true
;
}
else
{
MessageBox
.
Show
(
"更新失败,继续使用当前版本!"
);
}
}
}
}
...
@@ -112,10 +123,12 @@ namespace AutoUpdate
...
@@ -112,10 +123,12 @@ namespace AutoUpdate
while
(!
task
.
IsCompleted
)
while
(!
task
.
IsCompleted
)
{
{
Thread
.
Sleep
(
100
);
Thread
.
Sleep
(
100
);
Application
.
DoEvents
();
AddProcessText
(
"正在下载更新包"
,
progress
++
/
10
,
true
,
79
);
AddProcessText
(
"正在下载更新包"
,
progress
++
/
10
,
true
,
100
);
Application
.
DoEvents
();
}
}
AddProcessText
(
"更新包下载完成"
,
100
,
true
);
return
task
.
Result
;
return
task
.
Result
;
}
}
...
@@ -161,8 +174,8 @@ namespace AutoUpdate
...
@@ -161,8 +174,8 @@ namespace AutoUpdate
{
{
conn
=
new
SqlConnection
(
strLink
);
conn
=
new
SqlConnection
(
strLink
);
conn
.
Open
();
conn
.
Open
();
var
ada
=
new
SqlDataAdapter
(
strSql
,
conn
);
var
ada
=
new
SqlDataAdapter
(
strSql
,
conn
);
SetCommandTimeout
(
ada
,
600
);
// 默认30秒,与服务器网络不畅的情况下会下载失败,设置10分钟
if
(
Schema
)
ada
.
FillSchema
(
dt
,
SchemaType
.
Mapped
);
//取出数据结构
if
(
Schema
)
ada
.
FillSchema
(
dt
,
SchemaType
.
Mapped
);
//取出数据结构
ada
.
Fill
(
dt
);
//填充数据
ada
.
Fill
(
dt
);
//填充数据
}
}
...
@@ -223,6 +236,31 @@ namespace AutoUpdate
...
@@ -223,6 +236,31 @@ namespace AutoUpdate
}
}
}
}
#
region
设置
Command
超时时间
/// <summary>
/// 设置Command超时时间
/// </summary>
/// <param name="sqlDataAdapter"></param>
/// <param name="seconds"></param>
private
void
SetCommandTimeout
(
SqlDataAdapter
sqlDataAdapter
,
int
seconds
)
{
SetCommandTimeout
(
sqlDataAdapter
.
SelectCommand
,
seconds
);
SetCommandTimeout
(
sqlDataAdapter
.
InsertCommand
,
seconds
);
SetCommandTimeout
(
sqlDataAdapter
.
UpdateCommand
,
seconds
);
SetCommandTimeout
(
sqlDataAdapter
.
DeleteCommand
,
seconds
);
}
/// <summary>
/// 设置Command超时时间
/// </summary>
/// <param name="sqlCommand"></param>
/// <param name="seconds"></param>
private
void
SetCommandTimeout
(
SqlCommand
sqlCommand
,
int
seconds
)
{
if
(
sqlCommand
!=
null
)
sqlCommand
.
CommandTimeout
=
seconds
;
}
#
endregion
#
endregion
#
endregion
}
}
}
}
AutoUpdate/Properties/AssemblyInfo.cs
View file @
93d4ea90
...
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
...
@@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AutoUpdate")]
[assembly: AssemblyProduct("AutoUpdate")]
[assembly: AssemblyCopyright("Copyright © 202
1
")]
[assembly: AssemblyCopyright("Copyright © 202
4
")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyCulture("")]
...
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
...
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.
0.0.0
")]
[assembly: AssemblyVersion("1.
8.17.24
")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Ftt.PatchPack/App.config
View file @
93d4ea90
...
@@ -8,9 +8,6 @@
...
@@ -8,9 +8,6 @@
<
add
key
=
"PatchTimeFrame_Dll"
value
=
"48"
/>
<
add
key
=
"PatchTimeFrame_Dll"
value
=
"48"
/>
<
add
key
=
"PatchTimeFrame_Sql"
value
=
"720"
/>
<
add
key
=
"PatchTimeFrame_Sql"
value
=
"720"
/>
<
add
key
=
"PatchTimeFrame_Xml"
value
=
"720"
/>
<
add
key
=
"PatchTimeFrame_Xml"
value
=
"720"
/>
<
add
key
=
"PatchTimeFrame_Xml"
value
=
"720"
/>
<!--是否排除.
pdb
文件。
1
:排除,其他包含。-->
<!--是否排除.
pdb
文件。
1
:排除,其他包含。-->
<
add
key
=
"Exclude_PDB"
value
=
"1"
/>
<
add
key
=
"Exclude_PDB"
value
=
"1"
/>
<
add
key
=
"ClientSettingsProvider.ServiceUri"
value
=
""
/>
<
add
key
=
"ClientSettingsProvider.ServiceUri"
value
=
""
/>
...
...
Ftt.PatchPack/Ftt.PatchPack.csproj
View file @
93d4ea90
...
@@ -37,6 +37,7 @@
...
@@ -37,6 +37,7 @@
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<DefineConstants>
DEBUG;TRACE
</DefineConstants>
<ErrorReport>
prompt
</ErrorReport>
<ErrorReport>
prompt
</ErrorReport>
<WarningLevel>
4
</WarningLevel>
<WarningLevel>
4
</WarningLevel>
<Prefer32Bit>
false
</Prefer32Bit>
</PropertyGroup>
</PropertyGroup>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PropertyGroup
Condition=
" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "
>
<PlatformTarget>
AnyCPU
</PlatformTarget>
<PlatformTarget>
AnyCPU
</PlatformTarget>
...
...
Ftt.PatchPack/Project.cs
View file @
93d4ea90
...
@@ -399,10 +399,23 @@ namespace Ftt.PatchPack
...
@@ -399,10 +399,23 @@ namespace Ftt.PatchPack
/// </summary>
/// </summary>
public
class
ProjectHelp
public
class
ProjectHelp
{
{
static
private
string
fileName
=
"project.json"
;
static
private
string
fileName
=
@
"project.json"
;
static
private
Encoding
encoding
=
Encoding
.
Default
;
static
private
Encoding
encoding
=
Encoding
.
Default
;
static
string
FilePath
{
get
{
return
Path
.
Combine
(
Application
.
StartupPath
,
fileName
);
}
}
static
string
FilePath
{
get
{
return
Path
.
Combine
(
Application
.
StartupPath
,
fileName
);
}
}
static
ProjectHelp
()
{
#
region
统一调整配置文件的位置,并把已存在文件迁移过去。下个版本可以删除,并修改
fileName
=
@"config\project.json"
;
var
oldPath
=
FilePath
;
fileName
=
@"config\project.json"
;
if
(
File
.
Exists
(
oldPath
))
{
File
.
Copy
(
oldPath
,
FilePath
,
true
);
File
.
Delete
(
oldPath
);
}
#
endregion
}
public
static
Dictionary
<
string
,
Project
>
Read
()
public
static
Dictionary
<
string
,
Project
>
Read
()
{
{
Dictionary
<
string
,
Project
>
keyValues
=
new
Dictionary
<
string
,
Project
>();
Dictionary
<
string
,
Project
>
keyValues
=
new
Dictionary
<
string
,
Project
>();
...
...
UpdateExecuter/Helper/ClientHelp.cs
View file @
93d4ea90
...
@@ -9,7 +9,7 @@ namespace UpdateExecuter.Helper
...
@@ -9,7 +9,7 @@ namespace UpdateExecuter.Helper
public
static
class
ClientHelp
public
static
class
ClientHelp
{
{
static
private
string
fileName
=
"db.json"
;
static
private
string
fileName
=
@
"db.json"
;
static
string
FilePath
{
get
{
return
Path
.
Combine
(
Application
.
StartupPath
,
fileName
);
}
}
static
string
FilePath
{
get
{
return
Path
.
Combine
(
Application
.
StartupPath
,
fileName
);
}
}
...
@@ -17,11 +17,19 @@ namespace UpdateExecuter.Helper
...
@@ -17,11 +17,19 @@ namespace UpdateExecuter.Helper
static
ClientHelp
()
static
ClientHelp
()
{
{
#
region
统一调整配置文件的位置,并把已存在文件迁移过去。下个版本可以删除,并修改
fileName
=
@"config\db.json"
;
var
oldPath
=
FilePath
;
fileName
=
@"config\db.json"
;
if
(
File
.
Exists
(
oldPath
))
{
File
.
Copy
(
oldPath
,
FilePath
,
true
);
File
.
Delete
(
oldPath
);
}
#
endregion
Init
();
Init
();
}
}
#
region
私有操作
#
region
私有操作
private
static
Dictionary
<
string
,
Client
>
Init
()
private
static
Dictionary
<
string
,
Client
>
Init
()
...
@@ -43,8 +51,6 @@ namespace UpdateExecuter.Helper
...
@@ -43,8 +51,6 @@ namespace UpdateExecuter.Helper
#
endregion
#
endregion
/// <summary>
/// <summary>
/// 返回用户信息
/// 返回用户信息
/// </summary>
/// </summary>
...
@@ -69,8 +75,6 @@ namespace UpdateExecuter.Helper
...
@@ -69,8 +75,6 @@ namespace UpdateExecuter.Helper
return
true
;
return
true
;
}
}
/// <summary>
/// <summary>
/// 序列化保存
/// 序列化保存
/// </summary>
/// </summary>
...
@@ -88,8 +92,5 @@ namespace UpdateExecuter.Helper
...
@@ -88,8 +92,5 @@ namespace UpdateExecuter.Helper
}
}
return
true
;
return
true
;
}
}
}
}
}
}
\ 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