Skip to content

Instantly share code, notes, and snippets.

@AriDEV
Created November 3, 2014 18:59
Show Gist options
  • Save AriDEV/0b3141b507de12523070 to your computer and use it in GitHub Desktop.
Save AriDEV/0b3141b507de12523070 to your computer and use it in GitHub Desktop.
.../Server/AuthServer/Commands/AccountCommands.cs | 29 ++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/Projects/Server/AuthServer/Commands/AccountCommands.cs b/Projects/Server/AuthServer/Commands/AccountCommands.cs
index a660ac1..e97edb3 100644
--- a/Projects/Server/AuthServer/Commands/AccountCommands.cs
+++ b/Projects/Server/AuthServer/Commands/AccountCommands.cs
@@ -122,5 +122,34 @@ namespace AuthServer.Commands
Log.Message(LogType.Error, "Account '{0}' doesn't exist.", account.Email);
}
}
+
+ [ConsoleCommand("DeleteGameAccount", "")]
+ public static void DeleteGameAccount(string[] args)
+ {
+ var email = Command.Read<string>(args, 0);
+ var game = Command.Read<string>(args, 1);
+ var index = Command.Read<byte>(args, 2);
+
+ if (email != "" && game != "" && index != 0)
+ {
+ var account = DB.Auth.Single<Account>(a => a.Email == email);
+
+ if (account != null)
+ {
+ var exists = account.GameAccounts != null ? account.GameAccounts.Any(ga => ga.Game == game && ga.Index == index) : false;
+
+ if (exists)
+ {
+ if (DB.Auth.Delete<Account>(gameAccount))
+ Log.Message(LogType.Normal, "GameAccount '{0}{1}' for Account '{2}' successfully deleted.", game, index, email);
+ else
+ Log.Message(LogType.Error, "GameAccount '{0}{1}' for Account '{2}' failed to delete.", game, index, email);
+ }
+ }
+ else
+ Log.Message(LogType.Error, "GameAccount '{0}{1}' for Account '{2}' doesn't exist.", game, index, email);
+ }
+ }
+ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment