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));
        }
Beispiel #2
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);
                }
            }
        }