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
988d4a63
Commit
988d4a63
authored
Jul 09, 2024
by
罗显健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.更新器用系统默认应用打开sql文件。2.工具升级程序更新进度信息调整
parent
29829eb5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
17 deletions
+51
-17
Form1.cs
AutoUpdate/Form1.cs
+45
-12
AssemblyInfo.cs
Tools/Properties/AssemblyInfo.cs
+3
-3
Tools.csproj
Tools/Tools.csproj
+1
-1
frmMain.cs
UpdateExecuter/frmMain.cs
+2
-1
No files found.
AutoUpdate/Form1.cs
View file @
988d4a63
using
ICSharpCode.SharpZipLib.Zip
;
using
ICSharpCode.SharpZipLib.Zip
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.ComponentModel
;
using
System.Data
;
using
System.Data
;
using
System.Data.SqlClient
;
using
System.Data.SqlClient
;
using
System.Diagnostics
;
using
System.Diagnostics
;
using
System.Drawing
;
using
System.IO
;
using
System.IO
;
using
System.Linq
;
using
System.Text
;
using
System.Threading
;
using
System.Threading
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows.Forms
;
using
System.Windows.Forms
;
...
@@ -72,8 +67,8 @@ namespace AutoUpdate
...
@@ -72,8 +67,8 @@ namespace AutoUpdate
private
void
AppUpdate
()
private
void
AppUpdate
()
{
{
string
link
=
this
.
GetDbLinkString204
(
"FTT_Work"
);
var
dt
=
GetPackageData
(
);
DataTable
dt
=
this
.
GetDataTable
(
link
,
"SELECT TOP 1 * FROM dbo.FTT_AutoUpdate ORDER BY UDate DESC"
,
"FTT_AutoUpdate"
);
this
.
AddProcessText
(
80
);
if
(
dt
.
DefaultView
.
Count
>
0
)
if
(
dt
.
DefaultView
.
Count
>
0
)
{
{
//结束原进程
//结束原进程
...
@@ -85,30 +80,68 @@ namespace AutoUpdate
...
@@ -85,30 +80,68 @@ namespace AutoUpdate
p
.
Kill
();
p
.
Kill
();
}
}
}
}
this
.
AddProcessText
(
1
0
);
this
.
AddProcessText
(
8
0
);
//获取更新数据
//获取更新数据
var
drv
=
dt
.
DefaultView
[
0
];
var
drv
=
dt
.
DefaultView
[
0
];
var
fileName
=
drv
[
"UName"
].
ToString
();
var
fileName
=
drv
[
"UName"
].
ToString
();
var
bytes
=
drv
[
"UData"
]
as
byte
[];
var
bytes
=
drv
[
"UData"
]
as
byte
[];
//默认解压覆盖指定目录
//默认解压覆盖指定目录
var
fileFullName
=
$@"
{
this
.
_path
}
\
{
fileName
}
"
;
var
fileFullName
=
$@"
{
this
.
_path
}
\
{
fileName
}
"
;
this
.
AddProcessText
(
30
);
this
.
AddProcessText
(
85
);
//创建本地更新包
//创建本地更新包
File
.
WriteAllBytes
(
fileFullName
,
bytes
);
File
.
WriteAllBytes
(
fileFullName
,
bytes
);
this
.
AddProcessText
(
6
0
);
this
.
AddProcessText
(
9
0
);
//解压更新包到指定目录
//解压更新包到指定目录
this
.
ZipDecompress
(
fileFullName
,
this
.
_path
);
this
.
ZipDecompress
(
fileFullName
,
this
.
_path
);
this
.
AddProcessText
(
9
0
);
this
.
AddProcessText
(
9
5
);
//删除更新包
//删除更新包
File
.
Delete
(
fileFullName
);
File
.
Delete
(
fileFullName
);
this
.
AddProcessText
(
100
);
this
.
AddProcessText
(
100
);
}
}
}
}
private
DataTable
GetPackageData
()
{
string
link
=
this
.
GetDbLinkString204
(
"FTT_Work"
);
var
task
=
Task
.
Run
(()
=>
{
return
this
.
GetDataTable
(
link
,
"SELECT TOP 1 * FROM dbo.FTT_AutoUpdate ORDER BY UDate DESC"
,
"FTT_AutoUpdate"
);
});
var
progress
=
0
;
while
(!
task
.
IsCompleted
)
{
Thread
.
Sleep
(
100
);
Application
.
DoEvents
();
AddProcessText
(
"正在下载更新包"
,
progress
++
/
10
,
true
,
79
);
}
return
task
.
Result
;
}
private
void
AddProcessText
(
int
value
)
private
void
AddProcessText
(
int
value
)
{
{
this
.
textBox1
.
Text
+=
$"进度完成
{
value
}
%\r\n"
;
textBox1
.
Invoke
(
new
MethodInvoker
(()
=>
{
textBox1
.
Text
+=
$"进度完成
{
value
}
%\r\n"
;
}));
}
}
private
void
AddProcessText
(
string
processText
,
int
value
,
bool
isClearn
=
false
,
int
maxValue
=
100
)
{
if
(
value
>=
maxValue
)
value
=
maxValue
;
if
(
processText
==
null
)
processText
=
"进度完成"
;
textBox1
.
Invoke
(
new
MethodInvoker
(()
=>
{
if
(
isClearn
)
textBox1
.
Text
=
""
;
textBox1
.
Text
+=
$"
{
processText
}{
value
}
%\r\n"
;
}));
}
#
region
工具方法
#
region
工具方法
/// <summary>
/// <summary>
...
...
Tools/Properties/AssemblyInfo.cs
View file @
988d4a63
...
@@ -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("FTT-Tools")]
[assembly: AssemblyProduct("FTT-Tools")]
[assembly: AssemblyCopyright("Copyright © 202
0
")]
[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.0.
*
")]
[assembly: AssemblyFileVersion("1.0.0.0")]
Tools/Tools.csproj
View file @
988d4a63
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
<TargetFrameworkVersion>
v4.8
</TargetFrameworkVersion>
<TargetFrameworkVersion>
v4.8
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<FileAlignment>
512
</FileAlignment>
<AutoGenerateBindingRedirects>
true
</AutoGenerateBindingRedirects>
<AutoGenerateBindingRedirects>
true
</AutoGenerateBindingRedirects>
<Deterministic>
tru
e
</Deterministic>
<Deterministic>
fals
e
</Deterministic>
<TargetFrameworkProfile
/>
<TargetFrameworkProfile
/>
<NuGetPackageImportStamp>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</NuGetPackageImportStamp>
...
...
UpdateExecuter/frmMain.cs
View file @
988d4a63
...
@@ -219,7 +219,8 @@ namespace UpdateExecuter
...
@@ -219,7 +219,8 @@ namespace UpdateExecuter
var
fileFullName
=
(
listViewMsg
.
SelectedItems
[
0
]
as
ListViewItem
).
SubItems
[
2
].
Text
;
var
fileFullName
=
(
listViewMsg
.
SelectedItems
[
0
]
as
ListViewItem
).
SubItems
[
2
].
Text
;
if
(!
string
.
IsNullOrEmpty
(
fileFullName
))
Process
.
Start
(
"notepad.exe"
,
fileFullName
);
//以操作系统默认应用打开文件。
if
(!
string
.
IsNullOrEmpty
(
fileFullName
))
Process
.
Start
(
fileFullName
);
}
}
/// <summary>
/// <summary>
...
...
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