/// <summary> /// /// </summary> /// <param name="profile"></param> /// <returns></returns> private Profile ConvertProfileToHoloOASISProfile(API.Core.IProfile profile) { return(new Profile { DOB = profile.DOB, Email = profile.Email, FirstName = profile.FirstName, HcAddressHash = string.Empty, HolonType = profile.HolonType, Id = profile.Id, Karma = profile.Karma, LastName = profile.LastName, Password = profile.Password, PlayerAddress = profile.PlayerAddress, ProviderKey = profile.ProviderKey == null ? string.Empty : profile.ProviderKey, Title = profile.Title, Username = profile.Username }); }
/// <summary> /// /// </summary> /// <param name="profile"></param> /// <returns></returns> //private Profile ConvertProfileToHoloOASISProfile(API.Core.IProfile profile) //{ // return new Profile // { // DOB = profile.DOB, // Email = profile.Email, // FirstName = profile.FirstName, // HcAddressHash = string.Empty, // HolonType = profile.HolonType, // Id = profile.Id, // Karma = profile.Karma, // LastName = profile.LastName, // Password = profile.Password, // PlayerAddress = profile.PlayerAddress, // ProviderKey = profile.ProviderKey == null ? string.Empty : profile.ProviderKey, // Title = profile.Title, // Username = profile.Username // }; //} private HcProfile ConvertProfileToHoloOASISProfile(API.Core.IProfile profile) { return(new HcProfile { dob = profile.DOB, email = profile.Email, first_name = profile.FirstName, hc_address_hash = string.Empty, holon_type = profile.HolonType, id = profile.Id, karma = profile.Karma, last_name = profile.LastName, password = profile.Password, player_address = profile.PlayerAddress, provider_key = profile.ProviderKey == null ? string.Empty : profile.ProviderKey, title = profile.Title, username = profile.Username }); }
/* * public override async Task<API.Core.IProfile> SaveProfileAsync(API.Core.IProfile profile) * { * await _taskCompletionSourceGetInstance.Task; * * if (HoloNETClient.State == System.Net.WebSockets.WebSocketState.Open && !string.IsNullOrEmpty(_hcinstance)) * { * if (profile.Id == Guid.Empty) * profile.Id = Guid.NewGuid(); * * Profile hcProfile = profile as Profile; * * if (hcProfile == null) * hcProfile = ConvertProfileToHoloOASISProfile(profile); * else * { * // Rust/HC does not like null strings so need to set to empty string. * if (hcProfile.HcAddressHash == null) * hcProfile.HcAddressHash = string.Empty; * * if (hcProfile.ProviderKey == null) * hcProfile.ProviderKey = string.Empty; * } * * _currentId++; * _savingProfiles[_currentId.ToString()] = ConvertProfileToHoloOASISProfile(hcProfile); * await HoloNETClient.CallZomeFunctionAsync(_currentId.ToString(), _hcinstance, OURWORLD_ZOME, SAVE_PROFILE_FUNC, new { entry = hcProfile }); * return await _taskCompletionSourceSaveProfile.Task; * } * * return null; * } */ public override async Task <IProfile> SaveProfileAsync(API.Core.IProfile profile) { await _taskCompletionSourceGetInstance.Task; if (HoloNETClient.State == System.Net.WebSockets.WebSocketState.Open && !string.IsNullOrEmpty(_hcinstance)) { if (profile.Id == Guid.Empty) { profile.Id = Guid.NewGuid(); } HcProfile hcProfile = profile as HcProfile; if (hcProfile == null) { hcProfile = ConvertProfileToHoloOASISProfile(profile); } else { // Rust/HC does not like null strings so need to set to empty string. if (hcProfile.hc_address_hash == null) { hcProfile.hc_address_hash = string.Empty; } if (hcProfile.provider_key == null) { hcProfile.provider_key = string.Empty; } } _currentId++; //_savingProfiles[_currentId.ToString()] = ConvertProfileToHoloOASISProfile(hcProfile); _savingProfiles[_currentId.ToString()] = hcProfile; await HoloNETClient.CallZomeFunctionAsync(_currentId.ToString(), _hcinstance, OURWORLD_ZOME, SAVE_PROFILE_FUNC, new { entry = hcProfile }); return(await _taskCompletionSourceSaveProfile.Task); } return(null); }
public Task <KarmaAkashicRecord> AddKarmaToProfileAsync(API.Core.IProfile profile, KarmaType karmaType, KarmaSourceType karmaSourceType, string karamSourceTitle, string karmaSourceDesc) { return(profile.KarmaEarnt(karmaType, karmaSourceType, karamSourceTitle, karmaSourceDesc)); }
public Task <KarmaAkashicRecord> SubtractKarmaFromProfileAsync(API.Core.IProfile profile, KarmaType karmaType, KarmaSourceType karmaSourceType, string karamSourceTitle, string karmaSourceDesc) { return(profile.KarmaLost(karmaType, karmaSourceType, karamSourceTitle, karmaSourceDesc)); }