/// <summary> /// Fetch the latest version of the profile version /// </summary> void Fill() { PersonalProfiles = new Dictionary<string, RegistrationPersonal>(); ApplicationProfiles = new Dictionary<string, RegistrationApplication>(); ApplicationProfilesDefault = new Dictionary<string, string>(); DeviceProfiles = new Dictionary<string, RegistrationDevice>(); var ProfileKeys = Register.GetSubKeys(Constants.RegistryPersonal); var DeviceKeys = Register.GetKeys(Constants.RegistryDevice); var ApplicationKeys = Register.GetKeys(Constants.RegistryApplication); string DefaultDevice = null; foreach (var KeySet in ProfileKeys) { var Filename = KeySet.GetValueString(""); if (Filename != "") { var Profile = new RegistrationPersonal(KeySet.Key, Filename); if (Profile != null) { PersonalProfiles.Add(KeySet.Key, Profile); // add Archive var Archive = KeySet.GetValueString("Archive"); Profile.Archive = Archive; // add Portals var Portals = KeySet.GetValueMultiString("Portals"); Profile.Portals = Portals?.ToList(); if (KeySet.Default) { _Personal = Profile; } } } } foreach (var Key in ApplicationKeys) { if (Key.Key.Length > 10) { var Profile = new RegistrationApplication(Key.Key, Key.Value); if (Profile != null) { ApplicationProfiles.Add(Key.Key, Profile); } } else { ApplicationProfilesDefault.Add(Key.Key, Key.Value); } } foreach (var Key in DeviceKeys) { if (Key.Key != "") { var Profile = new RegistrationDevice(Key.Key, Key.Value); if (Profile != null) { DeviceProfiles.Add(Key.Key, Profile); } } else { DefaultDevice = Key.Value; } } if (DefaultDevice != null) { DeviceProfiles.TryGetValue(DefaultDevice, out _Device); } return; }
/// <summary> /// Add the associated profile to the machine store. /// </summary> /// <param name="PortalAddress">Portal to add profile to</param> /// <param name="SignedPersonalProfile">Profile to add</param> /// <returns>The registration created</returns> public RegistrationPersonal Add(SignedPersonalProfile SignedPersonalProfile, string PortalAddress) { var Registration = new RegistrationPersonal(SignedPersonalProfile, new List<string> { PortalAddress }); Add(Registration); return Registration; }
/// <summary> /// Add the associated registration to the machine store. /// </summary> /// <param name="Registration">Profile to add.</param> public void Add(RegistrationPersonal Registration) { PersonalProfiles.Add(Registration.UDF, Registration); // If no existing default, register as the default if (Personal == null) { Personal = Registration; } }
void Report(RegistrationPersonal Registration, bool Detail) { var SignedPersonalProfile = Registration.Profile; var PersonalProfile = SignedPersonalProfile.Signed; var Identifier = Utils.Default(PersonalProfile.Identifier, "<null>"); var Updated = Utils.Default(PersonalProfile.Updated.ToString(), "<null>"); var UDF = Utils.Default(PersonalProfile.UDF, "<null>"); Report("Profile {0}", Identifier); Report(" UDF : {0}", UDF); Report(" Updated : {0}", Updated); ReportWrite(" PortalIDs :"); foreach (var Portal in Registration.Portals) { ReportWrite(" "); ReportWrite(Portal); } Report(""); if (!Detail) return; Report("Devices"); foreach (var Device in PersonalProfile.Devices) { Report(Device); } Report("Applications"); foreach (var ApplicationProfileEntry in PersonalProfile.Applications) { Report(" Type {0}, Friendly {1}", ApplicationProfileEntry.Type, ApplicationProfileEntry.Friendly); Report(" Identifier: {0}", ApplicationProfileEntry.Identifier); Report(" Sign IDs: ", ApplicationProfileEntry.SignID); Report(" Decrypt IDs: ", ApplicationProfileEntry.DecryptID); } }
private void GetProfile(String Portal, String UDF) { RegistrationPersonal = Machine.Personal; Utils.Assert(RegistrationPersonal, "No profile found"); PortalID = RegistrationPersonal?.Portals?[0]; Utils.Assert(PortalID, "No portal ID known"); SignedPersonalProfile = RegistrationPersonal.Profile; PersonalProfile = SignedPersonalProfile.Signed; PersonalProfile.SignedDeviceProfile = GetDevice(SignedPersonalProfile); }
/// <summary> /// Construct a profile entry from a personal profile registration. /// </summary> /// <param name="Registration">The profile registration to use</param> public Profile(RegistrationPersonal Registration) { }