public ProfileData LoadProfile(string fileName, string profileName, ProfileExtension profileExtension, ProfileType profileType) { string content = new StreamReader(fileName).ReadToEnd(); if (profileExtension == ProfileExtension.XML) { content = ConvertXmlToJson(profileName, content, profileType); } return(JsonConvert.DeserializeObject <ProfileData>(content)); }
public ProfileData LoadProfile(string fileName, string profileName, ProfileExtension profileExtension, ProfileType profileType) { string content = new StreamReader(fileName).ReadToEnd(); if (profileExtension == ProfileExtension.XML) { throw new Exception("unsuported xml"); } Console.WriteLine("converting to OBject"); return(JsonConvert.DeserializeObject <ProfileData>(content)); }
//--------------------------------------------------------------------------------------------------------------------- public override void Delete() { if (ProfileExtension != null && !IgnoreExtensions) { ProfileExtension.OnDeleting(context, this); } base.Delete(); if (ProfileExtension != null && !IgnoreExtensions) { ProfileExtension.OnDeleted(context, this); } }
//--------------------------------------------------------------------------------------------------------------------- public void StorePassword(string newPassword) { if (ProfileExtension != null && !IgnoreExtensions) { ProfileExtension.OnPasswordChanging(context, this, newPassword); } context.Execute(String.Format("UPDATE usr SET password=PASSWORD({1}) WHERE id={0}", Id, StringUtils.EscapeSql(newPassword))); if (ProfileExtension != null && !IgnoreExtensions) { ProfileExtension.OnPasswordChanged(context, this, newPassword); } }
//--------------------------------------------------------------------------------------------------------------------- public override void Store() { bool isNew = !Exists; if (ProfileExtension != null && !IgnoreExtensions) { if (isNew) { ProfileExtension.OnCreating(context, this); } ProfileExtension.OnChanging(context, this); } //int appendix = 0; if (emailChanged) { NeedsEmailConfirmation = true; if (context.AutomaticUserMails) { SendMail(UserMailType.EmailChanged, true); } } if (NeedsEmailConfirmation) { AccountStatus = AccountStatus | AccountFlags.NeedsEmailConfirmation; } base.Store(); AccountStatus = (AccountStatus & 7); if (ProfileExtension != null && !IgnoreExtensions) { if (isNew) { ProfileExtension.OnCreated(context, this); } ProfileExtension.OnChanged(context, this); } }
public async Task <ProfileData> LoadProfileAsync(string fileName, string profileName, ProfileExtension profileExtension, ProfileType profileType) => await Task.Run(() => LoadProfile(fileName, profileName, profileExtension, profileType));