本文整理汇总了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}");
}
示例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}'.");
}
}
示例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.");
}
}
示例4: Stop
public static void Stop(CommandArgs args)
{
var alias = args.Read<string>();
ConsoleManager.Stop(alias);
}
示例5: Attach
public static void Attach(CommandArgs args)
{
var alias = args.Read<string>();
ConsoleManager.Attach(alias);
}