当前位置: 首页>>代码示例>>C#>>正文


C# CommandArgs.Read方法代码示例

本文整理汇总了C#中CommandArgs.Read方法的典型用法代码示例。如果您正苦于以下问题:C# CommandArgs.Read方法的具体用法?C# CommandArgs.Read怎么用?C# CommandArgs.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommandArgs的用法示例。


在下文中一共展示了CommandArgs.Read方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

        public static void Start(CommandArgs args)
        {
            var server = args.Read<string>();
            var alias = args.Read<string>();

            ConsoleManager.Start(server, alias, $"--alias {alias}");
        }
开发者ID:Arctium-Emulation,项目名称:Project-WoW,代码行数:7,代码来源:ConsoleServiceCommands.cs

示例2: DeleteAccount

        public static void DeleteAccount(CommandArgs args)
        {
            var email = args.Read<string>();

            if (email != null)
            {
                if (Database.Bnet.Delete<Account>(a => a.Email == email))
                    Log.Message(LogTypes.Success, $"Account '{email}' successfully deleted.");
                else
                    Log.Message(LogTypes.Error, $"Can't delete account '{email}'.");
            }
        }
开发者ID:Arctium-Emulation,项目名称:Project-WoW,代码行数:12,代码来源:AccountCommands.cs

示例3: CreateAccount

        public static void CreateAccount(CommandArgs args)
        {
            var email = args.Read<string>();
            var password = args.Read<string>();

            if (email != null && password != null)
            {
                var salt = new byte[0].GenerateRandomKey(32).ToHexString();

                // Check if account exists.
                if (!Database.Bnet.Any<Account>(a => a.Email == email))
                {
                    var account = new Account
                    {
                        Email = email,
                        PasswordVerifier = PasswordHash.GeneratePasswordVerifier(email, password, salt).ToHexString(),
                        Salt = salt,
                        // Region = XX
                        Region = 7
                    };

                    var gameAccount = new GameAccount
                    {
                        AccountId = Database.Bnet.GetAutoIncrementValue<Account, uint>(),
                        Game = "WoW",
                        Index = 1,
                        // Region = XX
                        Region = 7,
                        ExpansionLevel = 6
                    };

                    if (Database.Bnet.Add(account) && Database.Bnet.Add(gameAccount))
                        Log.Message(LogTypes.Success, $"Account '{email}' successfully created.");
                    else
                        Log.Message(LogTypes.Error, $"Account creation failed.");
                }
                else
                    Log.Message(LogTypes.Error, $"Account '{email}' already in database.");
            }
        }
开发者ID:Arctium-Emulation,项目名称:Project-WoW,代码行数:40,代码来源:AccountCommands.cs

示例4: Stop

        public static void Stop(CommandArgs args)
        {
            var alias = args.Read<string>();

            ConsoleManager.Stop(alias);
        }
开发者ID:Arctium-Emulation,项目名称:Project-WoW,代码行数:6,代码来源:ConsoleServiceCommands.cs

示例5: Attach

        public static void Attach(CommandArgs args)
        {
            var alias = args.Read<string>();

            ConsoleManager.Attach(alias);
        }
开发者ID:Arctium-Emulation,项目名称:Project-WoW,代码行数:6,代码来源:ConsoleServiceCommands.cs


注:本文中的CommandArgs.Read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。