Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
VIZ.Package
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘龙飞
VIZ.Package
Commits
dda7d71e
Commit
dda7d71e
authored
Apr 07, 2023
by
liulongfei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DLL 安全校验
parent
1a3d9a7a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
91 additions
and
9 deletions
+91
-9
VIZ.Package.Module/Main/View/MainView.xaml.cs
+38
-0
VIZ.Package.Module/Properties/AssemblyInfo.cs
+11
-7
VIZ.Package.Module/Setup/AppSetup_DllSafe.cs
+21
-0
VIZ.Package.Module/VIZ.Package.Module.csproj
+1
-0
VIZ.Package.Service/Logic/Plugin/PluginService.cs
+12
-0
VIZ.Package/App.xaml.cs
+2
-0
VIZ.Package/Properties/AssemblyInfo.cs
+6
-2
No files found.
VIZ.Package.Module/Main/View/MainView.xaml.cs
View file @
dda7d71e
using
DevExpress.Xpf.Docking
;
using
DevExpress.Xpf.Docking
;
using
log4net
;
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Reflection
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
System.Windows
;
using
System.Windows
;
...
@@ -22,11 +24,47 @@ namespace VIZ.Package.Module
...
@@ -22,11 +24,47 @@ namespace VIZ.Package.Module
/// </summary>
/// </summary>
public
partial
class
MainView
:
UserControl
public
partial
class
MainView
:
UserControl
{
{
/// <summary>
/// 日志
/// </summary>
private
readonly
static
ILog
log
=
LogManager
.
GetLogger
(
typeof
(
MainView
));
public
MainView
()
public
MainView
()
{
{
InitializeComponent
();
InitializeComponent
();
this
.
CheckDll
();
WPFHelper
.
BindingViewModel
(
this
,
new
MainViewModel
());
WPFHelper
.
BindingViewModel
(
this
,
new
MainViewModel
());
}
}
/// <summary>
/// 监测DLL
/// </summary>
private
void
CheckDll
()
{
// 入口
ApplicationDllCheckAttribute
entry_attribute
=
Assembly
.
GetEntryAssembly
().
GetCustomAttribute
<
ApplicationDllCheckAttribute
>();
if
(
entry_attribute
==
null
||
string
.
IsNullOrWhiteSpace
(
entry_attribute
.
Key
))
{
log
.
Error
(
"dll check error."
);
throw
new
Exception
(
"dll check error."
);
}
// 模块
ApplicationDllCheckAttribute
module_attribute
=
this
.
GetType
().
Assembly
.
GetCustomAttribute
<
ApplicationDllCheckAttribute
>();
if
(
module_attribute
==
null
||
string
.
IsNullOrWhiteSpace
(
module_attribute
.
Key
))
{
log
.
Error
(
"dll check error."
);
throw
new
Exception
(
"dll check error."
);
}
// 不匹配
if
(!
string
.
Equals
(
entry_attribute
.
Key
,
module_attribute
.
Key
))
{
log
.
Error
(
"dll check error."
);
throw
new
Exception
(
"dll check error."
);
}
}
}
}
}
}
VIZ.Package.Module/Properties/AssemblyInfo.cs
View file @
dda7d71e
...
@@ -3,6 +3,7 @@ using System.Resources;
...
@@ -3,6 +3,7 @@ using System.Resources;
using
System.Runtime.CompilerServices
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
using
System.Windows
;
using
System.Windows
;
using
VIZ.Framework.Core
;
// 有关程序集的一般信息由以下
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 控制。更改这些特性值可修改
...
@@ -31,13 +32,13 @@ using System.Windows;
...
@@ -31,13 +32,13 @@ using System.Windows;
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
[
assembly
:
ThemeInfo
(
[
assembly
:
ThemeInfo
(
ResourceDictionaryLocation
.
None
,
//主题特定资源词典所处位置
ResourceDictionaryLocation
.
None
,
//主题特定资源词典所处位置
//(未在页面中找到资源时使用,
//(未在页面中找到资源时使用,
//或应用程序资源字典中找到时使用)
//或应用程序资源字典中找到时使用)
ResourceDictionaryLocation
.
SourceAssembly
//常规资源词典所处位置
ResourceDictionaryLocation
.
SourceAssembly
//常规资源词典所处位置
//(未在页面中找到资源时使用,
//(未在页面中找到资源时使用,
//、应用程序或任何主题专用资源字典中找到时使用)
//、应用程序或任何主题专用资源字典中找到时使用)
)]
)]
...
@@ -51,5 +52,7 @@ using System.Windows;
...
@@ -51,5 +52,7 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: ApplicationDllCheck(Key = "V1.2.0.04041049_beta")]
\ No newline at end of file
VIZ.Package.Module/Setup/AppSetup_DllSafe.cs
0 → 100644
View file @
dda7d71e
using
log4net
;
using
System
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Text
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Module
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Storage
;
namespace
VIZ.Package.Module
{
/// <summary>
/// 应用程序启动 -- 初始化CSV
/// </summary>
public
class
AppSetup_DllSafe
:
AppSetup_DllSafeBase
{
}
}
\ No newline at end of file
VIZ.Package.Module/VIZ.Package.Module.csproj
View file @
dda7d71e
...
@@ -407,6 +407,7 @@
...
@@ -407,6 +407,7 @@
</Compile>
</Compile>
<Compile Include="Setting\VizConfig\VizConfigSettingPluginLifeCycle.cs" />
<Compile Include="Setting\VizConfig\VizConfigSettingPluginLifeCycle.cs" />
<Compile Include="Setting\VizConfig\ViewModel\VizConfigSettingViewModel.cs" />
<Compile Include="Setting\VizConfig\ViewModel\VizConfigSettingViewModel.cs" />
<Compile Include="Setup\AppSetup_DllSafe.cs" />
<Compile Include="Setup\AppSetup_InitRecordLog.cs" />
<Compile Include="Setup\AppSetup_InitRecordLog.cs" />
<Compile Include="Setup\AppSetup_InitCSV.cs" />
<Compile Include="Setup\AppSetup_InitCSV.cs" />
<Compile Include="Setup\AppSetup_InitLiteDB_Config.cs" />
<Compile Include="Setup\AppSetup_InitLiteDB_Config.cs" />
...
...
VIZ.Package.Service/Logic/Plugin/PluginService.cs
View file @
dda7d71e
...
@@ -5,6 +5,7 @@ using System.Linq;
...
@@ -5,6 +5,7 @@ using System.Linq;
using
System.Reflection
;
using
System.Reflection
;
using
System.Text
;
using
System.Text
;
using
System.Threading.Tasks
;
using
System.Threading.Tasks
;
using
VIZ.Framework.Core
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Domain
;
using
VIZ.Package.Plugin
;
using
VIZ.Package.Plugin
;
...
@@ -33,6 +34,10 @@ namespace VIZ.Package.Service
...
@@ -33,6 +34,10 @@ namespace VIZ.Package.Service
{
{
List
<
PluginInfo
>
list
=
new
List
<
PluginInfo
>();
List
<
PluginInfo
>
list
=
new
List
<
PluginInfo
>();
ApplicationDllCheckAttribute
entry_attribute
=
Assembly
.
GetEntryAssembly
().
GetCustomAttribute
<
ApplicationDllCheckAttribute
>();
if
(
entry_attribute
==
null
||
string
.
IsNullOrWhiteSpace
(
entry_attribute
.
Key
))
return
list
;
string
[]
files
=
System
.
IO
.
Directory
.
GetFiles
(
AppDomain
.
CurrentDomain
.
BaseDirectory
);
string
[]
files
=
System
.
IO
.
Directory
.
GetFiles
(
AppDomain
.
CurrentDomain
.
BaseDirectory
);
Type
pluginLifeCycleType
=
typeof
(
IPluginLifeCycle
);
Type
pluginLifeCycleType
=
typeof
(
IPluginLifeCycle
);
...
@@ -63,6 +68,13 @@ namespace VIZ.Package.Service
...
@@ -63,6 +68,13 @@ namespace VIZ.Package.Service
continue
;
continue
;
}
}
ApplicationDllCheckAttribute
attribute
=
type
.
Assembly
.
GetCustomAttribute
<
ApplicationDllCheckAttribute
>();
if
(
attribute
==
null
)
continue
;
if
(!
string
.
Equals
(
entry_attribute
.
Key
,
attribute
.
Key
))
continue
;
PluginInfo
info
=
lifeCycle
.
Register
();
PluginInfo
info
=
lifeCycle
.
Register
();
list
.
Add
(
info
);
list
.
Add
(
info
);
}
}
...
...
VIZ.Package/App.xaml.cs
View file @
dda7d71e
...
@@ -30,6 +30,8 @@ namespace VIZ.Package
...
@@ -30,6 +30,8 @@ namespace VIZ.Package
Theme
.
RegisterTheme
(
theme
);
Theme
.
RegisterTheme
(
theme
);
ApplicationThemeHelper
.
ApplicationThemeName
=
theme
.
Name
;
ApplicationThemeHelper
.
ApplicationThemeName
=
theme
.
Name
;
// DLL安全
AppSetup
.
AppendSetup
(
new
AppSetup_DllSafe
());
// 初始化LiteDB
// 初始化LiteDB
AppSetup
.
AppendSetup
(
new
AppSetup_InitLiteDB
());
AppSetup
.
AppendSetup
(
new
AppSetup_InitLiteDB
());
// 初始化CSV
// 初始化CSV
...
...
VIZ.Package/Properties/AssemblyInfo.cs
View file @
dda7d71e
...
@@ -3,6 +3,8 @@ using System.Resources;
...
@@ -3,6 +3,8 @@ using System.Resources;
using
System.Runtime.CompilerServices
;
using
System.Runtime.CompilerServices
;
using
System.Runtime.InteropServices
;
using
System.Runtime.InteropServices
;
using
System.Windows
;
using
System.Windows
;
using
System.Windows.Input
;
using
VIZ.Framework.Core
;
// 有关程序集的一般信息由以下
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 控制。更改这些特性值可修改
...
@@ -51,5 +53,7 @@ using System.Windows;
...
@@ -51,5 +53,7 @@ using System.Windows;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: ApplicationDllCheck(Key = "V1.2.0.04041049_beta")]
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