internal ReplacementText(DisplayAttributes displayAttributes, string text, int wordIndex, int countOfWords) { _displayAttributes = displayAttributes; _text = text; _wordIndex = wordIndex; _countOfWords = countOfWords; }
/// <summary> /// Save Presentation.Table.Attribute settings to the settings file /// </summary> /// <param name="attributeNode">XML-node for the Attribute settings</param> public void Save(XmlNode attributeNode) { string xpath; xpath = "./displayAttributes"; SettingsHelper.SetSettingValue(xpath, attributeNode, DisplayAttributes.ToString()); xpath = "./displayDefaultAttributes"; SettingsHelper.SetSettingValue(xpath, attributeNode, DisplayDefaultAttributes.ToString()); }
// GET: Account/Connect?token public ActionResult Connect(string token) { if (token == null) { return(RedirectToAction("Index", "Home")); } try { string sdkId = Environment.GetEnvironmentVariable("YOTI_CLIENT_SDK_ID"); _logger.LogInformation(string.Format("sdkId='{0}'", sdkId)); string yotiKeyFilePath = Environment.GetEnvironmentVariable("YOTI_KEY_FILE_PATH"); _logger.LogInformation( string.Format( "yotiKeyFilePath='{0}'", yotiKeyFilePath)); StreamReader privateKeyStream = System.IO.File.OpenText(yotiKeyFilePath); var yotiClient = new YotiClient(sdkId, privateKeyStream); ActivityDetails activityDetails = yotiClient.GetActivityDetails(token); var profile = activityDetails.Profile; ViewBag.RememberMeID = activityDetails.RememberMeId; DisplayAttributes displayAttributes = CreateDisplayAttributes(profile.AttributeCollection); if (profile.FullName != null) { displayAttributes.FullName = profile.FullName.GetValue(); } YotiAttribute <Image> selfie = profile.Selfie; if (profile.Selfie != null) { displayAttributes.Base64Selfie = selfie.GetValue().GetBase64URI(); } return(View(displayAttributes)); } catch (Exception e) { _logger.LogError( exception: e, message: e.Message); TempData["Error"] = e.Message; TempData["InnerException"] = e.InnerException?.Message; return(RedirectToAction("Error")); } }
/// <summary> /// Saves the XML document. /// </summary> public static void SaveXml() { using (XmlWriter writer = XmlWriter.Create(Paths.CreateOSPath("settings.xml"), XmlWriterSettings)) { writer.WriteStartDocument(); writer.WriteStartElement("Options"); writer.WriteStartElement("General"); writer.WriteElementString("AutoSave", AutoSave.ToString()); writer.WriteElementString("AutoSaveSpeed", AutoSaveSpeed.ToString()); writer.WriteElementString("AutoScroll", AutoScroll.ToString()); writer.WriteElementString("Music", Music.ToString()); writer.WriteElementString("NpcBar", NpcBar.ToString()); writer.WriteElementString("NpcDamage", NpcDamage.ToString()); writer.WriteElementString("NpcName", NpcName.ToString()); writer.WriteElementString("PlayerBar", PlayerBar.ToString()); writer.WriteElementString("PlayerDamage", PlayerDamage.ToString()); writer.WriteElementString("PlayerName", PlayerName.ToString()); writer.WriteElementString("SavedAccount", SavedAccount); writer.WriteElementString("SavedPassword", SavedPassword); writer.WriteElementString("Sound", Sound.ToString()); writer.WriteElementString("SpeechBubbles", SpeechBubbles.ToString()); writer.WriteElementString("Timestamps", Timestamps.ToString()); writer.WriteElementString("ActiveSkin", ActiveSkin); writer.WriteElementString("LastClientUpdateTime", LastClientUpdateTime.ToBinary().ToString()); writer.WriteElementString("LastGFXUpdateTime", LastGFXUpdateTime.ToBinary().ToString()); writer.WriteEndElement(); writer.WriteStartElement("ConnectionInfo"); writer.WriteElementString("Port", ConnectionPort.ToString()); writer.WriteElementString("Server", ConnectionIP); writer.WriteElementString("UpdateLink", UpdateAddress); writer.WriteElementString("SFXLink", SoundAddress); writer.WriteElementString("MusicLink", MusicAddress); writer.WriteEndElement(); writer.WriteStartElement("Editor"); writer.WriteElementString("MapGrid", MapGrid.ToString()); writer.WriteElementString("DisplayAttributes", DisplayAttributes.ToString()); writer.WriteElementString("DragAndPlace", DragAndPlace.ToString()); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndDocument(); } }
#pragma warning disable 6504 #pragma warning disable 6507 // Constructor for recognized 'word' public RecognizedWordUnit(string text, float confidence, string pronunciation, string lexicalForm, DisplayAttributes displayAttributes, TimeSpan audioPosition, TimeSpan audioDuration) { ArgumentNullException.ThrowIfNull(lexicalForm); if (confidence < 0.0f || confidence > 1.0f) { throw new ArgumentOutOfRangeException(SR.Get(SRID.InvalidConfidence)); } _text = text == null || text.Length == 0 ? null : text; _confidence = confidence; _pronunciation = pronunciation == null || pronunciation.Length == 0 ? null : pronunciation; _lexicalForm = lexicalForm; _displayAttributes = displayAttributes; _audioPosition = audioPosition; _audioDuration = audioDuration; }
internal static byte DisplayAttributesToSapiAttributes(DisplayAttributes displayAttributes) { return((byte)((uint)displayAttributes >> 1)); }
private static DisplayAttributes CreateDisplayAttributes(ReadOnlyCollection <BaseAttribute> attributes) { var displayAttributes = new DisplayAttributes(); foreach (var yotiAttribute in attributes) { switch (yotiAttribute.GetName()) { case Yoti.Auth.Constants.UserProfile.FullNameAttribute: // Do nothing - we are displaying this already break; case Yoti.Auth.Constants.UserProfile.GivenNamesAttribute: AddDisplayAttribute <string>("Given name", "yoti-icon-profile", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.FamilyNameAttribute: AddDisplayAttribute <string>("Family name", "yoti-icon-profile", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.NationalityAttribute: AddDisplayAttribute <string>("Nationality", "yoti-icon-nationality", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.PostalAddressAttribute: AddDisplayAttribute <string>("Postal Address", "yoti-icon-address", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.StructuredPostalAddressAttribute: AddDisplayAttribute <Dictionary <string, JToken> >("Structured Postal Address", "yoti-icon-address", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.PhoneNumberAttribute: AddDisplayAttribute <string>("Mobile number", "yoti-icon-phone", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.EmailAddressAttribute: AddDisplayAttribute <string>("Email address", "yoti-icon-email", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.DateOfBirthAttribute: AddDisplayAttribute <DateTime>("Date of birth", "yoti-icon-calendar", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.SelfieAttribute: // Do nothing - we already display the selfie break; case Yoti.Auth.Constants.UserProfile.GenderAttribute: AddDisplayAttribute <string>("Gender", "yoti-icon-gender", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.DocumentDetailsAttribute: AddDisplayAttribute <DocumentDetails>("Document Details", "yoti-icon-profile", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.DocumentImagesAttribute: AddDisplayAttribute <List <Image> >("Document Images", "yoti-icon-profile", yotiAttribute, displayAttributes); break; case Yoti.Auth.Constants.UserProfile.IdentityProfileReportAttribute: AddDisplayAttribute <Dictionary <string, JToken> >("Identity Profile Report", "yoti-icon-profile", yotiAttribute, displayAttributes); break; default: if (yotiAttribute is YotiAttribute <string> stringAttribute) { if (stringAttribute.GetName().Contains(":")) { displayAttributes.Add(new DisplayAttribute("Age Verification/", "Age verified", "yoti-icon-verified", stringAttribute.GetAnchors(), stringAttribute.GetValue())); break; } AddDisplayAttribute <string>(stringAttribute.GetName(), "yoti-icon-profile", yotiAttribute, displayAttributes); } break; } } return(displayAttributes); }
private static void AddDisplayAttribute <T>(string name, string icon, BaseAttribute baseAttribute, DisplayAttributes displayAttributes) { if (baseAttribute is YotiAttribute <T> yotiAttribute) { displayAttributes.Add(name, icon, yotiAttribute.GetAnchors(), yotiAttribute.GetValue()); } }