-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
30 lines (29 loc) · 1.21 KB
/
App.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
namespace WebImageSpider {
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application {
System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args) {
string dllName = args.Name.Contains(",") ? args.Name.Substring(0, args.Name.IndexOf(',')) : args.Name.Replace(".dll", "");
//MessageBox.Show(dllName);
dllName = dllName.Replace(".", "_");
if (dllName.EndsWith("_resources")) {
return null;
}
System.Resources.ResourceManager rm = new System.Resources.ResourceManager(GetType().Namespace + ".Properties.Resources", System.Reflection.Assembly.GetExecutingAssembly());
byte[] bytes = (byte[])rm.GetObject(dllName);
return System.Reflection.Assembly.Load(bytes);
}
public App() {
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
//MessageBox.Show("123");
}
}
}