コード例 #1
0
        public static OperationResult <DmSystem> GetDmSystem(string dmPath = "dm.dll")
        {
            if (!File.Exists(dmPath))
            {
                return(new OperationResult <DmSystem>(OperationResultType.Error, $"大漠插件文件“{dmPath}”不存在"));
            }
            DmPlugin dm  = new DmPlugin(dmPath);
            Version  ver = new Version(dm.Ver());

            if (ver > new Version("3.1233"))
            {
                string code = SoftContext.Locator.Settings.DmRegCode;
                if (code == null)
                {
                    return(new OperationResult <DmSystem>(OperationResultType.Error, "大漠插件版本大于“3.1233”,请在“菜单-设置”中设置大漠注册码"));
                }
                int ret = dm.Reg(code);
                if (ret != 1)
                {
                    return(new OperationResult <DmSystem>(OperationResultType.Error, $"大漠插件版本大于“3.1233”,执行插件注册失败,失败码:{ret}"));
                }
            }
            DmSystem system = new DmSystem(dm);

            return(new OperationResult <DmSystem>(OperationResultType.Success, "大漠系统对象获取成功", system));
        }
コード例 #2
0
        public static OperationResult <DmSystem> GetDmSystem(string dmPath = "dm.dll")
        {
            if (!File.Exists(dmPath))
            {
                return(new OperationResult <DmSystem>(OperationResultType.Error, $"大漠插件文件“{dmPath}”不存在"));
            }
            DmPlugin dm  = new DmPlugin(dmPath);
            Version  ver = new Version(dm.Ver());

            if (ver > new Version("3.1233"))
            {
                string code = SoftContext.Locator.Settings.DmRegCode;
                //code = "rhjv5528a9fb08d84534868df99ad3940be57c";
                if (code == null)
                {
                    return(new OperationResult <DmSystem>(OperationResultType.Error, "大漠插件版本大于“3.1233”,请在“菜单-设置”中设置大漠注册码"));
                }
                //int ret = dm.Reg(code);
                int ret = dm.RegEx(code, "1.0", "221.229.162.75|58.218.204.170|221.229.162.171|221.229.162.40|112.84.124.170");
                if (ret != 1)
                {
                    return(new OperationResult <DmSystem>(OperationResultType.Error, $"大漠插件版本大于“3.1233”,执行插件注册失败,失败码:{ret}"));
                }
            }
            DmSystem system = new DmSystem(dm);

            return(new OperationResult <DmSystem>(OperationResultType.Success, "大漠系统对象获取成功", system));
        }
コード例 #3
0
        private static async Task ResolveDmPlugin()
        {
            SettingsViewModel model = SoftContext.Locator.Settings;

            if (!File.Exists(model.DmFile))
            {
                await SoftContext.ShowMessageAsync("错误", $"指定大漠路径“{model.DmFile}”的文件不存在");

                return;
            }
            try
            {
                DmPlugin dm = new DmPlugin(model.DmFile);

                Version ver = new Version(dm.Ver());
                model.DmVersion      = ver.ToString();
                model.DmVersionShow  = true;
                model.DmRegCodeShow  = ver > new Version("3.1233");
                SoftContext.DmSystem = new DmSystem(dm);
            }
            catch (Exception ex)
            {
                await SoftContext.MainWindow.Dispatcher.Invoke(async() =>
                {
                    await SoftContext.ShowMessageAsync("错误", $"大漠初始化错误:{ex.Message}");
                });

                model.DmFile = null;
            }
        }
コード例 #4
0
        static void Main(string[] args)
        {
            Stopwatch watch = Stopwatch.StartNew();

            _dm = new DmPlugin();
            watch.Stop();
            Console.WriteLine($"创建大漠对象耗时:{watch.Elapsed}");
            while (true)
            {
                Console.WriteLine($"大漠插件版本号:{_dm.Ver()},请输入注册码,0跳过:");
                if (_dm.CheckUAC())
                {
                    Console.WriteLine($"关闭UAC:{_dm.SetUAC(false)}");
                }
                string code = Console.ReadLine();
                if (code == "0")
                {
                    break;
                }
                int ret = _dm.Reg(code);
                if (ret == 1)
                {
                    Console.WriteLine("大漠插件注册成功");
                    break;
                }
                Console.WriteLine($"大漠插件注册失败:{ret}");
            }

            bool exit = false;

            while (true)
            {
                try
                {
                    Console.WriteLine(@"请输入命令:0; 退出程序,功能命令:1 - n");
                    string input = Console.ReadLine();
                    if (input == null)
                    {
                        continue;
                    }
                    switch (input.ToLower())
                    {
                    case "0":
                        exit = true;
                        break;

                    case "1":
                        Method01();
                        break;

                    case "2":
                        Method02();
                        break;

                    case "3":
                        Method03();
                        break;

                    case "4":
                        Method04();
                        break;

                    case "5":
                        Method05();
                        break;

                    case "6":
                        Method06();
                        break;

                    case "7":
                        Method07();
                        break;

                    case "8":
                        Method08();
                        break;

                    case "9":
                        Method09();
                        break;

                    case "10":
                        Method10();
                        break;

                    case "11":
                        Method11();
                        break;
                    }
                    if (exit)
                    {
                        break;
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
        }