cd50996311
1.支持自动选择实验性模式的系统版本,并且弹出提示对话框 2.支持通过控制台参数启动(使用--help可以查看详情) 3.While循环内判断逻辑改用比较器,使运行效率提升 4.支持隐藏运行模式(--hide) 5.支持自动激活模式(--auto) 6.程序集改为嵌入式资源静态加载 7.旧版自解压临时目录改为独立临时工作区 Google Translate : 1. Support system edition of automatic selection of experimental mode, and a prompt dialog box pops up. 2. Support to start through the console parameters (use --help to see details) 3. The decision logic in the While Loop uses a comparator to improve the operating efficiency. 4. Support hidden operation mode (--hide). 5. Support automatic activation mode (--auto) 6. Assembly to embedded resources static loading. 7. The old version of the self-extracting temporary directory was changed to a separate temporary workspace.
83 lines
2.6 KiB
C#
83 lines
2.6 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Reflection;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows;
|
||
|
||
namespace CMWTAT_DIGITAL
|
||
{
|
||
public static class Program
|
||
{
|
||
|
||
public static bool autoact = false;
|
||
public static bool hiderun = false;
|
||
public static bool expact = false;
|
||
public static bool showhelp = false;
|
||
|
||
/// <summary>
|
||
/// Application Entry Point.
|
||
/// </summary>
|
||
[System.STAThreadAttribute()]
|
||
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
|
||
|
||
public static void Main(string[] startup_args)
|
||
{
|
||
//添加程序集解析事件
|
||
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
|
||
{
|
||
String resourceName = "CMWTAT_DIGITAL.Res." +
|
||
|
||
new AssemblyName(args.Name).Name + ".dll";
|
||
|
||
using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
|
||
{
|
||
Byte[] assemblyData = new Byte[stream.Length];
|
||
|
||
stream.Read(assemblyData, 0, assemblyData.Length);
|
||
|
||
return Assembly.Load(assemblyData);
|
||
}
|
||
};
|
||
|
||
//if (startup_args.Length == 0)
|
||
//{
|
||
// //MessageBox.Show("ARGS NULL");
|
||
// //Console.WriteLine("CMWTAT Digital Edition V2");
|
||
// //Console.WriteLine("This application can use console args.");
|
||
//}
|
||
foreach (string arg in startup_args)
|
||
{
|
||
Console.WriteLine("arg: " + arg);
|
||
if (arg == "-a" || arg == "--auto")
|
||
{
|
||
Console.WriteLine("AUTO: True");
|
||
autoact = true;
|
||
}
|
||
if (arg == "-h" || arg == "--hide")
|
||
{
|
||
Console.WriteLine("HIDE: True");
|
||
hiderun = true;
|
||
}
|
||
if (arg == "-e" || arg == "--expact")
|
||
{
|
||
Console.WriteLine("EXPACT: True");
|
||
expact = true;
|
||
}
|
||
if (arg == "-?" || arg == "--help")
|
||
{
|
||
Console.WriteLine("EXPACT: True");
|
||
showhelp = true;
|
||
}
|
||
}
|
||
|
||
CMWTAT_DIGITAL.App app = new CMWTAT_DIGITAL.App();//WPF项目的Application实例,用来启动WPF项目的
|
||
app.InitializeComponent();
|
||
app.Run();
|
||
}
|
||
}
|
||
}
|