50 lines
1.7 KiB
C#
50 lines
1.7 KiB
C#
|
|
using LiveUpdate;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Reflection;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using System.Windows.Forms;
|
|||
|
|
|
|||
|
|
namespace OnLineUpgradeConfig
|
|||
|
|
{
|
|||
|
|
internal static class Program
|
|||
|
|
{
|
|||
|
|
/// <summary>
|
|||
|
|
/// 应用程序的主入口点。
|
|||
|
|
/// </summary>
|
|||
|
|
[STAThread]
|
|||
|
|
static void Main()
|
|||
|
|
{
|
|||
|
|
AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
|
|||
|
|
Application.EnableVisualStyles();
|
|||
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|||
|
|
Application.Run(new frmUpdateFile());
|
|||
|
|
}
|
|||
|
|
static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
AssemblyName assemblyName = new AssemblyName(args.Name);
|
|||
|
|
var parent_folder = System.IO.Path.GetDirectoryName(Application.StartupPath.Trim('\\')).Trim('\\');
|
|||
|
|
if (System.IO.File.Exists(parent_folder + @"\Bin\" + assemblyName.Name + ".dll"))
|
|||
|
|
{
|
|||
|
|
return Assembly.LoadFrom(parent_folder + @"\Bin\" + assemblyName.Name + ".dll");
|
|||
|
|
}
|
|||
|
|
else if (System.IO.File.Exists(Application.StartupPath + @"\Bin\dlls\" + assemblyName.Name + ".dll"))
|
|||
|
|
{
|
|||
|
|
return Assembly.LoadFrom(Application.StartupPath + @"\Bin\dlls\" + assemblyName.Name + ".dll");
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
return args.RequestingAssembly;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
catch (Exception)
|
|||
|
|
{
|
|||
|
|
return args.RequestingAssembly;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|