public void TestBoxing(string base58) { var account = new AccountId(base58); var copy = (object)account; Assert.Equal(account.ToString(), copy.ToString()); }
public void Death(string killer, Entity entity = null, WmapTile tile = null, bool rekt = false) { if (_client.State == ProtocolState.Disconnected || _dead) { return; } if (tile != null && tile.Spawned) { rekt = true; } _dead = true; if (Rekted(rekt)) { return; } if (Arena(killer)) { return; } if (NonPermaKillEnemy(entity, killer)) { return; } if (TestWorld(killer)) { return; } if (Resurrection()) { return; } SaveToCharacter(); Manager.Database.Death(Manager.Resources.GameData, _client.Account, _client.Character, FameCounter.Stats, killer); GenerateGravestone(); AnnounceDeath(killer); _client.SendPacket(new Death() { AccountId = AccountId.ToString(), CharId = _client.Character.CharId, KilledBy = killer, ZombieId = -1 }); Owner.Timers.Add(new WorldTimer(1000, (w, t) => { if (_client.Player != this) { return; } _client.Disconnect(); })); }
public IAsyncResult BeginRemovePresenceSubscription(AccountId userId, AsyncCallback callback) { AssertLoggedIn(); AsyncNoResult ar = new AsyncNoResult(callback); if (!_presenceSubscriptions.ContainsKey((userId))) { ar.SetCompletedSynchronously(); return(ar); } var request = new vx_req_account_buddy_delete_t(); request.account_handle = _accountHandle; request.buddy_uri = userId.ToString(); VxClient.Instance.BeginIssueRequest(request, result => { try { VxClient.Instance.EndIssueRequest(result); _presenceSubscriptions.Remove(userId); ar.SetComplete(); } catch (Exception e) { VivoxDebug.Instance.VxExceptionMessage($"{request.GetType().Name} failed: {e}"); ar.SetComplete(e); if (VivoxDebug.Instance.throwInternalExcepetions) { throw; } return; } }); return(ar); }
public void TestCopy(string base58) { var account = new AccountId(base58); var copy = account; Assert.Equal(account.ToString(), copy.ToString()); }
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 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 void WriteJson(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WriteString("currency", CurrencyCode.ToString()); writer.WriteString("issuer", Issuer.ToString()); writer.WriteString("value", Value.ToString()); writer.WriteEndObject(); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("AccountId=" + AccountId.ToString()); sb.AppendLine("Enabled=" + Enabled.ToString()); return(sb.ToString()); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("AccessToken=" + AccessToken.ToString()); sb.AppendLine("AccountId=" + AccountId.ToString()); sb.AppendLine("AccountInfo=" + AccountInfo.ToString()); return(sb.ToString()); }
public override string ToString() { return("\n----------- ServerAccount ---------------" + "\nFacebookId:\t" + mFbAccountId.ToString() + "\nAccountId:\t" + mAccountId.ToString() + "\nNickname:\t" + mNickname + "\nFirstname:\t" + mFirstName + "\nLastname:\t" + mLastName + "\nUserProperties:\n" + mUserProperties.ToString() + "\n-----------------------------------------\n"); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("AccountId=" + AccountId.ToString()); sb.AppendLine("Password="******"Server=" + Server.ToString()); sb.AppendLine("UserName=" + UserName.ToString()); return(sb.ToString()); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("AccountId=" + AccountId.ToString()); sb.AppendLine("Directory=" + Directory.ToString()); sb.AppendLine("Enabled=" + Enabled.ToString()); sb.AppendLine("EnsureUniqueFilenames=" + EnsureUniqueFilenames.ToString()); return(sb.ToString()); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("AccountId=" + AccountId.ToString()); sb.AppendLine("CreateShareLink=" + CreateShareLink.ToString()); sb.AppendLine("Enabled=" + Enabled.ToString()); sb.AppendLine("EnsureUniqueFilenames=" + EnsureUniqueFilenames.ToString()); sb.AppendLine("SharedFolder=" + SharedFolder.ToString()); return(sb.ToString()); }
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); }
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); }
protected async Task <JObject[]> GetAccountData(AccountId testAccount) { // ReSharper disable once InconsistentNaming const string ledger_index = "validated"; var account = testAccount.ToString(); var parameters = new { ledger_index, account }; var lines = Ws.RequestAsync("account_lines", parameters); var info = Ws.RequestAsync("account_info", parameters); var offers = Ws.RequestAsync("account_offers", parameters); return(await Task.WhenAll(info, lines, offers)); }
public override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("AccountId=" + AccountId.ToString()); sb.AppendLine("IsBasicAuthentication=" + IsBasicAuthentication.ToString()); sb.AppendLine("Password="******"Url=" + Url.ToString()); sb.AppendLine("UserName=" + UserName.ToString()); return(sb.ToString()); }
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); }); }
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 override string ToString() { StringBuilder sb = new StringBuilder(); sb.AppendLine("AccountId=" + AccountId.ToString()); sb.AppendLine("AddSignature=" + AddSignature.ToString()); sb.AppendLine("Content=" + Content.ToString()); sb.AppendLine("Enabled=" + Enabled.ToString()); sb.AppendLine("Html=" + Html.ToString()); sb.AppendLine("Recipients=" + Recipients.ToString()); sb.AppendLine("Subject=" + Subject.ToString()); return(sb.ToString()); }
public string GetTelemetryUserId() { if (IsDefaultOfflineAccount) { return("default-" + LocalAccountId); } else if (IsOnlineAccount) { return(AccountId.ToString()); } else { return("offline-" + LocalAccountId); } }
public async Task <Account> GetAsync(AccountId id) { try { return(await _repo.GetAsync(id)); } catch (AccountNotFoundException) { var info = new Dictionary <string, string>() { ["Id"] = id.ToString() }; throw new WPayException(AccountErrors.AccountNotExist, info); } }
internal LoginSession(Client client, AccountId accountId) { if (AccountId.IsNullOrEmpty(accountId)) { throw new ArgumentNullException(nameof(accountId)); } if (client == null) { throw new ArgumentNullException(nameof(client)); } Key = accountId; _accountHandle = accountId.ToString(); _groupHandle = "sg_" + _accountHandle; _client = client; VxClient.Instance.EventMessageReceived += Instance_EventMessageReceived; }
public async Task LockAsync(AccountId id, bool locked) { try { var acc = await _repo.GetAsync(id, true); var newAcc = new Account(acc.Id, acc.Balance, locked); await _repo.UpdateAsync(newAcc); } catch (AccountNotFoundException) { var info = new Dictionary <string, string>() { ["Id"] = id.ToString() }; throw new WPayException(AccountErrors.AccountNotExist, info); } }
public override string ToString() { var result = string.Empty; if (!string.IsNullOrWhiteSpace(Nickname)) { result = Nickname; } else if (AccountId != 0) { result = AccountId.ToString(); } else { result = base.ToString(); } return(result); }
public IAsyncResult BeginSendDirectedMessage(AccountId userId, string language, string message, string applicationStanzaNamespace, string applicationStanzaBody, AsyncCallback callback) { if (AccountId.IsNullOrEmpty(userId)) { throw new ArgumentNullException(nameof(userId)); } if (string.IsNullOrEmpty(message) && string.IsNullOrEmpty(applicationStanzaBody)) { throw new ArgumentNullException($"{nameof(message)} and {nameof(applicationStanzaBody)} cannot both be null"); } AssertLoggedIn(); AsyncNoResult ar = new AsyncNoResult(callback); var request = new vx_req_account_send_message_t { account_handle = _accountHandle, message_body = message, user_uri = userId.ToString(), language = language, application_stanza_namespace = applicationStanzaNamespace, application_stanza_body = applicationStanzaBody }; VxClient.Instance.BeginIssueRequest(request, result => { vx_resp_account_send_message_t response; try { response = VxClient.Instance.EndIssueRequest(result); _directedMessageResult = new DirectedMessageResult(response.request_id); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DirectedMessageResult))); ar.SetComplete(); } catch (Exception e) { VivoxDebug.Instance.VxExceptionMessage($"{request.GetType().Name} failed: {e}"); ar.SetComplete(e); return; } }); return(ar); }
private async Task CreateShipment() { try { var req = new GrpcNewShipmentRequest() { TrackingCode = MLShipment.TrackingCode, SetAutoUpdate = true, MarketplaceAccountId = AccountId.ToString(), MarketplaceSaleId = MLShipment.OrderId.ToString(), BoundMarketplace = "mercado livre", SetCreatedManually = false, ShippingImplementation = GetShipmentImplementation(), PackageData = new GrpcNewPackageRequest() }; await ShippingClient.CreateShipment(req); } catch (Exception) { throw; } }
public async Task <ActionResult <ApiResultViewModel <FriendRequest> > > GetFriendRequests( [FromQuery] QueryInputModel <FriendRequestFilterInputModel> filterInputModel, CancellationToken cancellationToken) { var fromAccountId = filterInputModel.FilterParameters.FirstOrDefault(q => q.FieldName == nameof(FriendRequestFilterInputModel.FromAccountId)); var toAccountId = filterInputModel.FilterParameters.FirstOrDefault(q => q.FieldName == nameof(FriendRequestFilterInputModel.ToAccountId)); if ((fromAccountId == null || !string.Equals(fromAccountId.Values[0], AccountId.ToString(), StringComparison.OrdinalIgnoreCase)) && (toAccountId == null || !string.Equals(toAccountId.Values[0], AccountId.ToString(), StringComparison.OrdinalIgnoreCase))) { return(Forbidden()); } var friendRequests = await _friendRequestManager.GetAllAsync(filterInputModel, cancellationToken); return(OkData(friendRequests.Data, friendRequests.TotalCount)); }
private List <UriParam> GetParams() { return(new List <UriParam>() { new UriParam() { Name = "seller", Data = AccountId.ToString() }, new UriParam() { Name = "access_token", Data = AccessToken }, new UriParam() { Name = "offset", Data = Pagination.Offset.ToString() }, new UriParam() { Name = "limit", Data = Pagination.Limit.ToString() }, }); }