Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
S
Setup
Project
Project
Details
Activity
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
黄树航
Setup
Commits
3c203046
Commit
3c203046
authored
Mar 16, 2023
by
黄树航
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
未完成
parent
1ec84764
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
82 additions
and
41 deletions
+82
-41
App.xaml
App.xaml
+1
-1
ApiHelper.cs
Common/ApiHelper.cs
+37
-0
DirectoryHelper.cs
Common/DirectoryHelper.cs
+0
-1
Utils.cs
Common/Utils.cs
+1
-0
Dqkj.Setup.Wpf.sln
Dqkj.Setup.Wpf.sln
+1
-1
Dqkj.Setup.csproj
Dqkj.Setup.csproj
+3
-1
MainWindow.xaml
MainWindow.xaml
+1
-1
UpdateInfo.cs
Model/UpdateInfo.cs
+0
-1
VersionInfo.cs
Model/VersionInfo.cs
+1
-7
AssemblyInfo.cs
Properties/AssemblyInfo.cs
+2
-2
InstallView.xaml
View/InstallView.xaml
+1
-1
InstallView.xaml.cs
View/InstallView.xaml.cs
+11
-5
ProgressView.xaml.cs
View/ProgressView.xaml.cs
+23
-20
No files found.
App.xaml
View file @
3c203046
...
...
@@ -10,7 +10,7 @@
<ResourceDictionary.MergedDictionaries>
<!--<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/>
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/>-->
<ResourceDictionary Source="pack://application:,,,/Setup;component/Style/ControlStyle.xaml"></ResourceDictionary>
<ResourceDictionary Source="pack://application:,,,/
电趣百宝箱
Setup;component/Style/ControlStyle.xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
...
...
Common/ApiHelper.cs
0 → 100644
View file @
3c203046
using
System.Net.Http
;
using
System.Text.RegularExpressions
;
using
System.Threading.Tasks
;
namespace
Setup.Common
{
internal
class
ApiHelper
{
private
const
string
_url
=
"http://crm.yilongex.cn/api/client/product/list?name=BaibaoTest"
;
private
static
readonly
HttpClient
_httpClient
=
new
HttpClient
();
public
static
async
Task
<
string
>
CheckAsync
()
{
var
ret
=
await
_httpClient
.
GetAsync
(
_url
);
ret
.
EnsureSuccessStatusCode
();
var
response
=
await
ret
.
Content
.
ReadAsStringAsync
();
var
lastFile
=
GetValue
(
response
,
"lastFile"
);
return
lastFile
;
}
private
static
string
GetValue
(
string
input
,
string
key
)
{
var
pattern
=
"(?:\""
+
key
+
"\"):\"(?<val>[^\"]*?)\""
;
var
match
=
Regex
.
Match
(
input
,
pattern
);
if
(
match
.
Groups
.
Count
>
0
)
{
return
match
.
Groups
[
0
].
Value
;
}
else
{
return
null
;
}
}
}
}
Common/DirectoryHelper.cs
View file @
3c203046
...
...
@@ -34,7 +34,6 @@ namespace Dqkj.Setup.Common
}
}
public
static
void
DeleteTemp
(
List
<
string
>
lisDelete
)
{
foreach
(
var
ss
in
lisDelete
)
...
...
Common/Utils.cs
View file @
3c203046
...
...
@@ -44,6 +44,7 @@ namespace Dqkj.Setup
}
return
""
;
}
public
static
string
CurrentPath
{
get
...
...
Dqkj.Setup.Wpf.sln
View file @
3c203046
...
...
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33122.133
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "
Setup", "
Setup.csproj", "{743C17E3-641B-429C-A271-2ED6BEAA6B63}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "
Dqkj.Setup", "Dqkj.
Setup.csproj", "{743C17E3-641B-429C-A271-2ED6BEAA6B63}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
...
...
Setup.csproj
→
Dqkj.
Setup.csproj
View file @
3c203046
...
...
@@ -7,7 +7,7 @@
<ProjectGuid>
{743C17E3-641B-429C-A271-2ED6BEAA6B63}
</ProjectGuid>
<OutputType>
WinExe
</OutputType>
<RootNamespace>
Setup
</RootNamespace>
<AssemblyName>
Setup
</AssemblyName>
<AssemblyName>
电趣百宝箱
Setup
</AssemblyName>
<TargetFrameworkVersion>
v4.5
</TargetFrameworkVersion>
<FileAlignment>
512
</FileAlignment>
<ProjectTypeGuids>
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
</ProjectTypeGuids>
...
...
@@ -49,6 +49,7 @@
<Reference
Include=
"System.Drawing"
/>
<Reference
Include=
"System.IO.Compression"
/>
<Reference
Include=
"System.IO.Compression.FileSystem"
/>
<Reference
Include=
"System.Net.Http"
/>
<Reference
Include=
"System.Numerics"
/>
<Reference
Include=
"System.Windows.Forms"
/>
<Reference
Include=
"System.Xml"
/>
...
...
@@ -88,6 +89,7 @@
<DependentUpon>
App.xaml
</DependentUpon>
<SubType>
Code
</SubType>
</Compile>
<Compile
Include=
"Common\ApiHelper.cs"
/>
<Compile
Include=
"Common\DirectoryHelper.cs"
/>
<Compile
Include=
"Common\DownloadWebClient.cs"
>
<SubType>
Component
</SubType>
...
...
MainWindow.xaml
View file @
3c203046
...
...
@@ -24,7 +24,7 @@
<StackPanel Grid.Row="0" Orientation="Horizontal" Style="{StaticResource stackPanel_setup}">
<Image x:Name="imageLogo" Source="/Img/Subtract.png" Width="40" Height="40" />
<TextBlock x:Name="txtBlockTitle" Text="电趣
采集助手
" FontSize="25" Foreground="White" VerticalAlignment="Center" Margin="10 0" ></TextBlock>
<TextBlock x:Name="txtBlockTitle" Text="电趣
百宝箱
" FontSize="25" Foreground="White" VerticalAlignment="Center" Margin="10 0" ></TextBlock>
</StackPanel>
<Image Source="/Img/Rectangle 310-1.png" HorizontalAlignment="Left" IsHitTestVisible="False" />
...
...
Model/UpdateInfo.cs
View file @
3c203046
...
...
@@ -8,7 +8,6 @@ namespace Dqkj.Setup
public
string
Content
{
get
;
set
;
}
public
string
Md5
{
get
;
set
;
}
public
string
UpdateUrl
{
get
;
set
;
}
...
...
Model/VersionInfo.cs
View file @
3c203046
...
...
@@ -8,12 +8,6 @@ namespace Dqkj.Setup
public
string
Url
{
get
;
set
;
}
public
Version
Ver
{
get
{
return
System
.
Version
.
Parse
(
this
.
Version
);
}
}
public
Version
Ver
=>
System
.
Version
.
Parse
(
this
.
Version
);
}
}
Properties/AssemblyInfo.cs
View file @
3c203046
...
...
@@ -8,11 +8,11 @@ using System.Windows;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("
Dqkj.Setup
")]
[assembly: AssemblyTitle("
电趣百宝箱 - 安装程序
")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Organization")]
[assembly: AssemblyProduct("
Dqkj.Setup
")]
[assembly: AssemblyProduct("
电趣百宝箱 - 安装程序
")]
[assembly: AssemblyCopyright("Copyright © Organization 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
...
...
View/InstallView.xaml
View file @
3c203046
...
...
@@ -17,7 +17,7 @@
<TextBlock Text="安装路径:" Style="{StaticResource textBlock_setup}" Margin="10,0" ></TextBlock>
<Border Style="{StaticResource border_setup}">
<TextBox x:Name="txtPath"
Text="C:\Dqkj\"
Width="300" Height="25" BorderThickness="0" HorizontalContentAlignment="Left" VerticalContentAlignment="Center"></TextBox>
<TextBox x:Name="txtPath" Width="300" Height="25" BorderThickness="0" HorizontalContentAlignment="Left" VerticalContentAlignment="Center"></TextBox>
</Border>
<Border Margin="5,0" Style="{StaticResource border_setup}" >
...
...
View/InstallView.xaml.cs
View file @
3c203046
...
...
@@ -6,9 +6,6 @@ using System.Windows.Controls;
namespace
Dqkj.Setup
{
/// <summary>
/// InstallView.xaml 的交互逻辑
/// </summary>
public
partial
class
InstallView
:
UserControl
{
private
MainWindow
_mainWindow
{
get
;
set
;
}
...
...
@@ -34,7 +31,7 @@ namespace Dqkj.Setup
MessageBox
.
Show
(
"请选择安装路径!"
,
"温馨提示"
);
return
;
}
if
(!
System
.
IO
.
Path
.
GetInvalidFileNameChars
().
Any
(
c
=>
txtPath
.
Text
.
Contains
(
c
)))
if
(!
Path
.
GetInvalidFileNameChars
().
Any
(
c
=>
txtPath
.
Text
.
Contains
(
c
)))
{
MessageBox
.
Show
(
"非法路径,请重新填写或者选择路径!"
,
"温馨提示"
);
return
;
...
...
@@ -58,7 +55,16 @@ namespace Dqkj.Setup
private
void
Install_Loaded
(
object
sender
,
RoutedEventArgs
e
)
{
var
defaultName
=
"Dqukj"
;
string
[]
drives
=
Environment
.
GetLogicalDrives
();
if
(
drives
.
Length
>
1
)
{
this
.
txtPath
.
Text
=
$@"
{
drives
[
1
]}{
defaultName
}
\"
;
}
else
{
this
.
txtPath
.
Text
=
$@"
{
drives
[
0
]}{
defaultName
}
\"
;
}
}
}
}
View/ProgressView.xaml.cs
View file @
3c203046
#
define
天猫助手
using
AutoDownload.Common
;
using
AutoDownload.Common
;
using
Dqkj.Setup.Common
;
using
Dqkj.Setup.View
;
using
Setup.Common
;
using
System
;
using
System.Collections.Generic
;
using
System.IO
;
...
...
@@ -22,38 +21,40 @@ namespace Dqkj.Setup
public
partial
class
ProgressView
:
System
.
Windows
.
Controls
.
UserControl
{
private
MainWindow
_mainWindow
{
get
;
set
;
}
string
defaultUpdateXmlUrl
{
get
;
set
;
}
static
string
executeName
{
get
;
set
;
}
string
formTitle
{
get
;
set
;
}
static
string
zip_temp
{
get
;
set
;
}
static
string
_installPath
{
get
;
set
;
}
private
string
defaultUpdateXmlUrl
{
get
;
set
;
}
private
static
string
executeName
{
get
;
set
;
}
private
string
formTitle
{
get
;
set
;
}
private
static
string
zip_temp
{
get
;
set
;
}
private
static
string
_installPath
{
get
;
set
;
}
public
ProgressView
(
string
installPath
,
MainWindow
mainWindow
)
{
InitializeComponent
();
Initialize
(
installPath
)
;
_installPath
=
installPath
;
_mainWindow
=
mainWindow
;
}
public
void
Initialize
(
string
installPath
)
public
async
Task
Initialize
(
string
installPath
)
{
_installPath
=
installPath
;
zip_temp
=
Path
.
Combine
(
installPath
,
"data_temp.zip"
);
#if 天猫助手
defaultUpdateXmlUrl
=
"http://112.74.55.104/AutomaticUpdates/全平台采集/Update.xml"
;
executeName
=
"电趣采集助手.exe"
;
formTitle
=
$"电趣采集助手-自动更新"
;
#endif
//#if 天猫助手
// defaultUpdateXmlUrl = "http://112.74.55.104/AutomaticUpdates/全平台采集/Update.xml";
// executeName = "电趣采集助手.exe";
// formTitle = $"电趣采集助手-自动更新";
//#endif
defaultUpdateXmlUrl
=
await
ApiHelper
.
CheckAsync
();
executeName
=
"电趣百宝箱.exe"
;
formTitle
=
$"电趣百宝箱-自动更新"
;
}
private
void
installProgress_Loaded
(
object
sender
,
RoutedEventArgs
e
)
private
async
void
installProgress_Loaded
(
object
sender
,
RoutedEventArgs
e
)
{
try
{
await
Initialize
(
_installPath
);
Download
();
}
catch
(
Exception
ex
)
...
...
@@ -84,11 +85,13 @@ namespace Dqkj.Setup
client
.
DownloadFileAsync
(
new
Uri
(
serverVersion
.
Url
),
zip_temp
,
serverVersion
);
//Application.Run(frm);
}
private
void
Client_DownloadProgressChanged
(
object
sender
,
DownloadProgressChangedEventArgs
e
)
{
progress
.
Value
=
e
.
ProgressPercentage
;
txtBlockHint
.
Text
=
$"正在安装,请稍后(
{
progress
.
Value
}
%)"
;
}
/// <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