public static bool IsRoomOwnerFriend(string roomId, UserId userId) { WebServiceRequest getRoomOwnerRelationship = new WebServiceRequest(_ServicesSiteRoot, "Friends", "IsRoomOwnerFriend"); if (userId != null) { getRoomOwnerRelationship.AddParam("userId", userId.Id.ToString()); } getRoomOwnerRelationship.AddParam("roomId", roomId); XmlDocument serviceResponse = getRoomOwnerRelationship.GetWebResponse(); XmlNodeList isRoomOwnerFriendNode = serviceResponse.GetElementsByTagName("isRoomOwnerFriend"); if (isRoomOwnerFriendNode.Count > 0) { if (isRoomOwnerFriendNode[0] != null) { if (Convert.ToBoolean(isRoomOwnerFriendNode[0].InnerText)) { return(true); } else { return(false); } } } return(false); }
public static void GetGameData(ServerAccount serverAccount, string[] dataKeys, Action <XmlDocument> result) { if (mMockGetGameData == null) { string dataKeysCsv = String.Join(",", dataKeys); mLogger.DebugFormat("FashionMinigameServiceAPI - MiniGames.GetMiniGameUserData called accountId={0} dataKeys={1}", serverAccount.AccountId, dataKeysCsv); WebServiceRequest setDataService = new WebServiceRequest(mWebServicesBaseUrl, "MiniGames", "GetMiniGameUserData"); setDataService.Method = FormMethod.POST; setDataService.AddParam("accountId", serverAccount.AccountId.ToString()); setDataService.AddParam("miniGameId", FASHION_MINIGAME_SERVICE_ID.ToString()); setDataService.AddParam("miniGameName", FASHION_MINIGAME_NAME); setDataService.AddParam("dataKeyCSVList", dataKeysCsv); setDataService.GetWebResponseAsync(delegate(XmlDocument response) { mLogger.DebugFormat("FashionMinigameServiceAPI - MiniGames.GetMiniGameUserData responded accountId={0} xmlResponse={1}", serverAccount.AccountId, response.OuterXml); result(response); }); } else { mMockGetGameData(serverAccount, dataKeys, result); } }
public static void DisableRoomService(AccountId accountId, RoomId roomId, System.Action <XmlDocument> disableRoomServiceCallback) { WebServiceRequest disableRoomInDatabaseService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "DisableRoom"); disableRoomInDatabaseService.AddParam(kRoomId, roomId.ToString()); disableRoomInDatabaseService.AddParam(kAccountId, accountId.ToString()); disableRoomInDatabaseService.GetWebResponseAsync(disableRoomServiceCallback); }
public static void UpdateRoomDnaService(RoomId roomId, XmlDocument roomDna, System.Action <XmlDocument> updateRoomDnaServiceFinishedCallback) { mLogger.DebugFormat("UpdateRoomDnaService called roomId={0} roomDna={1}", roomId, roomDna.OuterXml); WebServiceRequest updateRoomDna = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "UpdateRoomDNA"); updateRoomDna.AddParam(kRoomId, roomId.ToString()); updateRoomDna.AddParam(kRoomDna, roomDna.OuterXml); updateRoomDna.GetWebResponseAsync(updateRoomDnaServiceFinishedCallback); }
private void MoneyPaymentsLogService(string timeStamp, string xmlData, Action <XmlDocument> logServiceCallback) { WebServiceRequest moneyPaymentsLogService = new WebServiceRequest(mWebServicesBaseUrl, "MoneyPaymentsLog", "WritePaymentsLog"); moneyPaymentsLogService.Method = FormMethod.POST; moneyPaymentsLogService.AddParam("key", mKey); moneyPaymentsLogService.AddParam("timeStamp", timeStamp); moneyPaymentsLogService.AddParam("xmlData", xmlData); moneyPaymentsLogService.GetWebResponseAsync(logServiceCallback); }
public static void GetSessionOwnedRoomsWithPrivacyService(AccountId accountId, PrivacyLevel privacyLevel, System.Action <XmlDocument> getRoomServiceFinishedCallback) { mLogger.DebugFormat("GetSessionOwnedRoomsWithPrivacyService called accountId={0} privacyLevel={1}", accountId, privacyLevel); WebServiceRequest getRoomList = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "GetRooms"); getRoomList.AddParam(kAccountId, accountId.ToString()); if (privacyLevel != PrivacyLevel.Default) { getRoomList.AddParam(kPrivacyLevel, ((uint)privacyLevel).ToString()); } getRoomList.GetWebResponseAsync(getRoomServiceFinishedCallback); }
public static void CreateNewRoomService(AccountId accountId, string roomName, PrivacyLevel privacyLevel, System.Action <XmlDocument> createRoomFinishedCallback) { mLogger.DebugFormat("CreateNewRoomService called accountId={0} roomName={1} privacyLevel={2}", accountId, roomName, privacyLevel); WebServiceRequest createRoomService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "CreateRoom"); createRoomService.Encrypted = true; createRoomService.AddParam(kAccountId, accountId.ToString()); createRoomService.AddParam(kRoomName, roomName); createRoomService.AddParam(kPrivacyLevel, ((int)privacyLevel).ToString()); createRoomService.AddParam(kDefaultRoomId, "1"); createRoomService.GetWebResponseAsync(createRoomFinishedCallback); }
/// <summary> /// /// </summary> /// <param name="serverAccount"></param> /// <param name="defaultAvatarId"></param> /// <param name="createAvatarForUserServiceCallback"></param> public static void CreateAvatarForUser(ServerAccount serverAccount, AvatarId defaultAvatarId, Action <XmlDocument> createAvatarForUserServiceCallback) { mLogger.DebugFormat("CreateAvatarForUser called accountId={0} defaultAvatarId={1}", serverAccount.AccountId, defaultAvatarId); WebServiceRequest getAvatarList = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Avatars", "CreateAvatar"); getAvatarList.AddParam(kAccountId, serverAccount.AccountId.ToString()); getAvatarList.AddParam(kDefaultAvatarId, defaultAvatarId.ToString()); getAvatarList.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("CreateAvatarForUser responded accountId={0} defaultAvatarId={1}", serverAccount.AccountId, defaultAvatarId); createAvatarForUserServiceCallback(xmlResponse); }); }
/// <summary> /// /// </summary> /// <param name="avatarId"></param> /// <param name="avatarDna"></param> /// <param name="updateAvatarDnaServiceFinishedCallback"></param> public static void UpdateAvatarDna(AvatarId avatarId, XmlDocument avatarDna, System.Action <XmlDocument> updateAvatarDnaServiceFinishedCallback) { mLogger.DebugFormat("UpdateAvatarDna called avatarId={0}", avatarId); WebServiceRequest updateAvatarDna = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Avatars", "UpdateAvatarDNA"); updateAvatarDna.AddParam(kAvatarId, avatarId.ToString()); updateAvatarDna.AddParam(kAvatarDna, avatarDna.OuterXml); updateAvatarDna.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("UpdateAvatarDna responded avatarId={0}", avatarId); updateAvatarDnaServiceFinishedCallback(xmlResponse); }); }
public static void RemoveSession(AccountId accountId, string sessionId, Action <XmlDocument> updateStateServerCallback) { mLogger.DebugFormat("RemoveSession called accountId={0} sessionId={1}", accountId, sessionId); WebServiceRequest bossService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Boss", "RemoveSession"); bossService.AddParam("accountId", accountId.ToString()); bossService.AddParam("sessionId", sessionId); bossService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("RemoveSession responded accountId={0} sessionId={1}", accountId, sessionId); updateStateServerCallback(xmlResponse); }); }
public static void GetAllFacebookFriends(long facebookAccountId, string sessionKey, System.Action <XmlDocument> getAllFacebookFriendsServiceCallback) { mLogger.InfoFormat("GetAllFacebookFriends called fbAccountId={0}", facebookAccountId); WebServiceRequest getFacebookFriendsService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Facebook", "GetAllFacebookFriends"); getFacebookFriendsService.AddParam(kFbAccountId, facebookAccountId.ToString()); getFacebookFriendsService.AddParam(kSessionKey, sessionKey); getFacebookFriendsService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.Info("GetAllFacebookFriends responded"); getAllFacebookFriendsServiceCallback(xmlResponse); }); }
public static void InitStateServer(string ipAddress, string port, Action <XmlDocument> initStateServerCallback) { mLogger.DebugFormat("InitStateServer called ipAddress={0} port={1}", ipAddress, port); WebServiceRequest bossService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Boss", "InitStateServer"); bossService.AddParam("stateServerIp", ipAddress); bossService.AddParam("port", port); bossService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("InitStateServer responded ipAddress={0} port={1}", ipAddress, port); initStateServerCallback(xmlResponse); }); }
public static void GetDefaultRoomService(AccountId accountId, System.Action <XmlDocument> getDefaultRoomServiceCallback) { mLogger.DebugFormat("GetDefaultRoomService called accountId={0}", accountId); WebServiceRequest getDefaultRoomService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "GetRooms"); getDefaultRoomService.AddParam("accountId", accountId.ToString()); getDefaultRoomService.AddParam("isDefault", "1"); getDefaultRoomService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("GetDefaultRoomService responded accountId={0} xmlResponse={1}", accountId, xmlResponse.OuterXml); getDefaultRoomServiceCallback(xmlResponse); }); }
public static void UpdateAccountData(AccountId accountId, XmlDocument accountDataXml, Action <XmlDocument> updatedAccountDataCallback) { mLogger.DebugFormat("UpdateAccountData called accountId={0}", accountId); WebServiceRequest updateAccountDataService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Accounts", "UpdateAccountData"); updateAccountDataService.AddParam(ConstStrings.kAccountId, accountId.ToString()); updateAccountDataService.AddParam(ConstStrings.kAccountData, accountDataXml.OuterXml); updateAccountDataService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("UpdateAccountData responded accountId={0}", accountId); updatedAccountDataCallback(xmlResponse); }); }
private void SetDefaultRoom(ServerAccount userAccount, RoomId roomId) { WebServiceRequest setDefaultRoomService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "SetDefaultRoom"); setDefaultRoomService.AddParam("accountId", userAccount.AccountId.ToString()); setDefaultRoomService.AddParam("roomId", roomId.ToString()); Action <XmlDocument> setDefaultRoomServiceCallback = delegate(XmlDocument xmlResponse) { //TODO: error checking? }; setDefaultRoomService.GetWebResponseAsync(setDefaultRoomServiceCallback); }
public static void UpdateStateServer(string stateServerId, int population, string isEnabled, Action <XmlDocument> updateStateServerCallback) { mLogger.DebugFormat("UpdateStateServer called stateServerId={0} population={1} isEnabled={2}", stateServerId, population, isEnabled); WebServiceRequest bossService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Boss", "UpdateStateServer"); bossService.AddParam("stateServerId", stateServerId); bossService.AddParam("population", population.ToString()); bossService.AddParam("isEnabled", isEnabled); bossService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("UpdateStateServer responded stateServerId={0} population={1} isEnabled={2}", stateServerId, population, isEnabled); updateStateServerCallback(xmlResponse); }); }
public static void UpdateServerPaymentItemsAccount(string accountId, string paymentItemsAccountId, string secureKey, Action <XmlDocument> updatePaymentItemAccountCallback) { mLogger.InfoFormat("UpdateServerPaymentItemsAccount called accountId={0} PIAccountId={1}", accountId, paymentItemsAccountId); WebServiceRequest updatePaymentItemsAccountService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Accounts", "UpdateAccountWithPaymentItemsInfo"); updatePaymentItemsAccountService.AddParam(ConstStrings.kAccountId, accountId); updatePaymentItemsAccountService.AddParam(ConstStrings.kPaymentItemsAccountId, paymentItemsAccountId); updatePaymentItemsAccountService.AddParam(ConstStrings.kPiSecureId, secureKey); updatePaymentItemsAccountService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.InfoFormat("UpdateServerPaymentItemsAccount responded accountId={0} PIAccountId={1}", accountId, paymentItemsAccountId); updatePaymentItemAccountCallback(xmlResponse); }); }
public static void CreateEscrowTransaction(long toFacebookAccountId, long fromFacebookAccountId, string transactionType, int value, System.Action <XmlDocument> callback) { mLogger.DebugFormat("CreateEscrowTransaction called to={0} from={1} type={2} value={3}", toFacebookAccountId, fromFacebookAccountId, transactionType, value); WebServiceRequest request = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Escrow", "CreateEscrowTransaction"); request.AddParam(kToAccountId, toFacebookAccountId.ToString()); request.AddParam(kFromAccountId, fromFacebookAccountId.ToString()); request.AddParam(kTransactionType, transactionType); request.AddParam(kValue, value.ToString()); request.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("CreateEscrowTransaction responded xml={0}", xmlResponse.OuterXml); callback(xmlResponse); }); }
public static void GetSessionOwnedRoomsService(AccountId accountId, System.Action <XmlDocument> getRoomServiceFinishedCallback) { mLogger.DebugFormat("GetSessionOwnedRoomsService called accountId={0}", accountId); WebServiceRequest getRoomList = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "GetRooms"); getRoomList.AddParam(kAccountId, accountId.ToString()); getRoomList.GetWebResponseAsync(getRoomServiceFinishedCallback); }
public static void GetAllSystemRoomsService(System.Action <XmlDocument> getSystemRoomFinishedCallback) { mLogger.DebugFormat("GetAllSystemRoomsService called"); WebServiceRequest getSystemRoomService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "GetSystemRooms"); getSystemRoomService.AddParam(kIsEnabled, "1"); getSystemRoomService.GetWebResponseAsync(getSystemRoomFinishedCallback); }
public static void GetEscrowTransactions(long toFacebookAccountId, long fromFacebookAccountId, EscrowType transactionType, string timeStamp, bool clearTransactions, System.Action <XmlDocument> callback) { mLogger.DebugFormat("GetEscrowTransactions called to={0} from={1} type={2} ts={3}", toFacebookAccountId, fromFacebookAccountId, transactionType, timeStamp); WebServiceRequest request = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Escrow", "GetEscrowTransactions"); request.AddParam(kToAccountId, toFacebookAccountId.ToString()); if (fromFacebookAccountId == 0) { request.AddParam(kFromAccountId, ""); } else { request.AddParam(kFromAccountId, fromFacebookAccountId.ToString()); } request.AddParam(kTransactionType, transactionType.ToString()); request.AddParam(kTransactionTimeStamp, timeStamp); // Do we want to immediately clear the transactions after getting them? if (clearTransactions) { request.AddParam(kDeleteTransactions, "1"); } else { request.AddParam(kDeleteTransactions, "0"); } request.GetWebResponseAsync(callback); }
public static void ClearEscrowTransactions(long toFacebookAccountId, long fromFacebookAccountId, string transactionType, string timeStamp, System.Action <XmlDocument> callback) { mLogger.DebugFormat("ClearEscrowTransactions called to={0} from={1} type={2} ts={3}", toFacebookAccountId, fromFacebookAccountId, transactionType, timeStamp); WebServiceRequest request = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Escrow", "ClearEscrowTransactions"); request.AddParam(kToAccountId, toFacebookAccountId.ToString()); if (fromFacebookAccountId == 0) { request.AddParam(kFromAccountId, ""); } else { request.AddParam(kFromAccountId, fromFacebookAccountId.ToString()); } request.AddParam(kTransactionType, transactionType); request.AddParam(kTransactionTimeStamp, timeStamp); request.GetWebResponseAsync(callback); }
public XmlDocument GetTheUserInformationFromHangoutId(string hangoutUserId, string baseServicesRoot) { XmlDocument userInformation = null; WebServiceRequest request = new WebServiceRequest(baseServicesRoot, "Accounts", "GetAccounts"); request.AddParam("accountId", hangoutUserId); userInformation = request.GetWebResponse(); return(userInformation); }
public static void GetServerAccountForAccountId(string accountId, Action <XmlDocument> getServerAccountForAccountIdCallback) { mLogger.DebugFormat("GetServerAccountForAccountId called accountId={0}", accountId); WebServiceRequest getServerAccountForAccountIdService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Accounts", "GetAccounts"); getServerAccountForAccountIdService.AddParam(ConstStrings.kAccountId, accountId); getServerAccountForAccountIdService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("GetServerAccountForAccountId responded accountId={0}", accountId); getServerAccountForAccountIdCallback(xmlResponse); }); }
public static void GetSessionOwnedRoomsWithPrivacyService(IList <AccountId> accountIds, PrivacyLevel privacyLevel, System.Action <XmlDocument> getRoomServiceFinishedCallback) { mLogger.DebugFormat("GetSessionOwnedRoomsWithPrivacyService called accountIds={0} privacyLevel={1}", accountIds, privacyLevel); WebServiceRequest getRoomList = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Rooms", "GetRooms"); AccountId[] accountIdArray = new AccountId[accountIds.Count]; accountIds.CopyTo(accountIdArray, 0); string[] accountIdStringArray = Array.ConvertAll <AccountId, string>(accountIdArray, new Converter <AccountId, string>( delegate(AccountId accountId) { return(accountId.ToString()); } )); string accountIdsCommaSeperatedString = String.Join(",", accountIdStringArray); getRoomList.AddParam(kAccountIdCsvList, accountIdsCommaSeperatedString); if (privacyLevel != PrivacyLevel.Default) { getRoomList.AddParam(kPrivacyLevel, ((uint)privacyLevel).ToString()); } getRoomList.GetWebResponseAsync(getRoomServiceFinishedCallback); }
private void GetTransactionsToNotify(Action <XmlDocument> getTransactionToNotifyCallback) { try { WebServiceRequest getTransactionToNotifyService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "MoneyPaymentsLog", "GetTransactionsToNotify"); getTransactionToNotifyService.AddParam("state", "3"); getTransactionToNotifyService.GetWebResponseAsync(getTransactionToNotifyCallback); } catch (Exception ex) { mLogger.Error(String.Format("Error in GetTransactionsToNotify {0} ", ex)); } }
/// <summary> /// /// </summary> /// <param name="avatarId">Id of system avatar we are requesting (ie. "1","2","3","4","5") </param> /// <param name="getSystemAvatarsCallback"></param> public static void GetSystemAvatar(string avatarId, Action <XmlDocument> getSystemAvatarsCallback) { mLogger.DebugFormat("GetSystemAvatar called, avatarId = {0}", avatarId); // For now we just return all the system avatars to choose from WebServiceRequest getAvatarService = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Avatars", "GetSystemAvatars"); getAvatarService.Method = FormMethod.POST; getAvatarService.AddParam(kAvatarId, avatarId); getAvatarService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("GetSystemAvatar responded, avatarId = {0}", avatarId); getSystemAvatarsCallback(xmlResponse); }); }
private XmlDocument ProcessCallBack(string xmlInfo, string baseServicesRoot) { UTF8Encoding encoding = new UTF8Encoding(); Byte[] byteArray = encoding.GetBytes(xmlInfo); WebServiceRequest request = new WebServiceRequest(baseServicesRoot, "PaymentItemsService", "PayPalCallback"); request.AddParam("xmlInfoBinary", byteArray); XmlDocument xmlResponse = request.GetWebResponse(); return(xmlResponse); }
public static void CreateEscrowTransaction(ICollection <long> toFacebookAccountIdList, long fromFacebookAccountId, string transactionType, int value, System.Action <XmlDocument> callback) { string csvListOfFbIds = ""; string delimiter = ""; foreach (long friendFacebookId in toFacebookAccountIdList) { csvListOfFbIds += (delimiter + friendFacebookId.ToString()); delimiter = ","; } mLogger.DebugFormat("CreateMultipleEscrowTransaction called to={0} from={1} type={2} value={3}", toFacebookAccountIdList, fromFacebookAccountId, transactionType, value); WebServiceRequest request = new WebServiceRequest(StateServerConfig.WebServicesBaseUrl, "Escrow", "CreateMultipleEscrowTransactions"); request.AddParam(kFbIdCsvList, csvListOfFbIds); request.AddParam(kFromAccountId, fromFacebookAccountId.ToString()); request.AddParam(kTransactionType, transactionType); request.AddParam(kValue, value.ToString()); request.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("CreateMultipleEscrowTransactions responded xml={0}", xmlResponse.OuterXml); callback(xmlResponse); }); }
public static void SetGameData(ServerAccount serverAccount, string dataKey, object dataValue, Action <XmlDocument> result) { if (mMockSetGameData == null) { mLogger.DebugFormat("FashionMinigameServiceAPI - MiniGames.SaveMiniGameUserData called accountId={0} dataKey={1} dataValue={2}", serverAccount.AccountId, dataKey, dataValue.ToString()); WebServiceRequest setDataService = new WebServiceRequest(mWebServicesBaseUrl, "MiniGames", "SaveMiniGameUserData"); setDataService.Method = FormMethod.POST; setDataService.AddParam("accountId", serverAccount.AccountId.ToString()); setDataService.AddParam("miniGameId", FASHION_MINIGAME_SERVICE_ID.ToString()); setDataService.AddParam("miniGameName", FASHION_MINIGAME_NAME); setDataService.AddParam("dataKey", dataKey); setDataService.AddParam("dataValue", dataValue.ToString()); setDataService.GetWebResponseAsync(delegate(XmlDocument xmlResponse) { mLogger.DebugFormat("FashionMinigameServiceAPI - MiniGames.SaveMiniGameUserData responded accountId={0} xmlResponse={1}", serverAccount.AccountId, xmlResponse.OuterXml); result(xmlResponse); }); } else { mMockSetGameData(serverAccount, dataKey, dataValue.ToString(), result); } }