//------------------------------------------------- #region static mathods region //These methods are server and online working //so you should use await keyword for them. public static async Task <RepositoryContentChangeSet> CreateKingdomThrone(KingdomInfo kingdomInfo) { KingdomThrone kingdomThrone = new KingdomThrone() { King_PlayerName = ThereIsConstants.Path.NotSet, // 1 Queen_PlayerName = ThereIsConstants.Path.NotSet, // 2 MinisterOfWar_PlayerName = ThereIsConstants.Path.NotSet, // 3 MinisterOfWealth_PlayerName = ThereIsConstants.Path.NotSet, // 4 Hierarch_PlayerName = ThereIsConstants.Path.NotSet, // 5 Guardians_Chief_PlayerName = ThereIsConstants.Path.NotSet, // 6 Clown_PlayerName = ThereIsConstants.Path.NotSet, // 7 }; return(await ThereIsServer.Actions.CreateFile(ThereIsServer.ServersInfo.MyServers[kingdomInfo.Index], KingdomThroneFileName, new DataBaseCreation("BY SAO_Game", QString.Parse(kingdomThrone.GetForServer())))); }
public static async Task <bool> Delete(SAO_Kingdoms _kingdom_) { var _s = ThereIsServer.ServersInfo.ServerManager.Get_Kingdom_Server(_kingdom_); var _target = KingdomInfo_LOC; bool _del1 = false, _del2, _del3; if (await ThereIsServer.Actions.Exists(_s, _target)) { var _existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target); var _req = new DataBaseDeleteRequest(MESSAGE, _existing.Sha.GetStrong()); _del1 = await ThereIsServer.Actions.DeleteData(_s, _target, _req); } _del2 = await KingdomRankings.DeleteRankings(_kingdom_); _del3 = await KingdomThrone.DeleteThrone(_kingdom_); return(_del1 && _del2 && _del3); }
public static async Task <KingdomThrone> GetKingdomThrone(KingdomInfo kingdom) { KingdomThrone kingdomThrone = new KingdomThrone(); var Existing = await ThereIsServer.Actions.GetAllContentsByRef(ThereIsServer.ServersInfo.MyServers[kingdom.Index], KingdomThroneFileName); if (Existing.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed) { NoInternetConnectionSandBox.PrepareConnectionClosedSandBox(); return(null); } StrongString[] myStrings = Existing.Decode().Split(CharSeparator); kingdomThrone.King_PlayerName = myStrings[0]; kingdomThrone.Queen_PlayerName = myStrings[1]; kingdomThrone.MinisterOfWar_PlayerName = myStrings[2]; kingdomThrone.MinisterOfWealth_PlayerName = myStrings[3]; kingdomThrone.Hierarch_PlayerName = myStrings[4]; kingdomThrone.Guardians_Chief_PlayerName = myStrings[5]; kingdomThrone.Clown_PlayerName = myStrings[6]; return(kingdomThrone); }
public static async Task <KingdomInfo> GetKingdomInfo(SAO_Kingdoms _kingdom_) { KingdomInfo kingdomInfo = new KingdomInfo(_kingdom_) { Index = (uint)_kingdom_, }; //--------------------------------------------- var _s = ThereIsServer.ServersInfo.ServerManager.Get_Kingdom_Server(kingdomInfo.Provider); var _target = KingdomInfo_LOC; var _existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target); //--------------------------------------------- if (_existing.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed) { NoInternetConnectionSandBox.PrepareConnectionClosedSandBox(); return(null); // don't set ServerSettings.IsWaitingForServerChecking = false; } kingdomInfo.SetParams(_existing.Decode()); kingdomInfo.Rankings = await KingdomRankings.GetKingdomRankings(kingdomInfo); kingdomInfo.Throne = await KingdomThrone.GetKingdomThrone(kingdomInfo); return(kingdomInfo); }