public Player(int id, string name, GenderOptions gender, int age) { _id = id; _name = name; _gender = gender; _age = age; }
// Populate structure from string public GenderAttribute(string gender) : base(1, 1) { if (gender == "m") { this.gender = GenderOptions.Male; } else if (gender == "f") { this.gender = GenderOptions.Female; } else if (gender == "h") { this.gender = GenderOptions.Human; } else if (gender == "u") { this.gender = GenderOptions.OneOfUs; } else if (gender == "n") { this.gender = GenderOptions.Neuter; } else { throw new ArgumentException("Unknown gender: " + gender); } }
public async override void Start() { base.Start(); GenderOptions.Add(new SelectOptionViewModel <string> { Display = "Male", Value = "M" }); GenderOptions.Add(new SelectOptionViewModel <string> { Display = "Female", Value = "F" }); try { if (this.NavigationCriteria.ExistingUser) { await this.LoadUserAsync(this.NavigationCriteria.ProfileId); } else { await this.CreateUserAsync(); } } catch (Exception ex) { this.messageBox.ShowAsync("There was an error creating the user: "******"Error"); this.logger.Log(ex); } }
public Human(string name, int age, float height, float weight, GenderOptions gender) { this._name = name; this._age = age; this._height = height; this._weight = weight; this._gender = gender; }
public IActionResult Maak(string name, int age, GenderOptions geslacht, string bandname) { ViewBag.Bandmember = new BandMember { Name = name, Age = age, Gender = geslacht }; ViewBag.Band = bandname; return(View()); }
public virtual Task <Stream> TextToSpeechAsync(string text, SpeechLocaleOptions locale, VoiceName voiceName, GenderOptions voiceType, AudioOutputFormatOptions outputFormat) { return(PolicyService.ExecuteRetryAndCapture400Errors( "SpeechService.TextToSpeechAsync", ApiKeys.SpeechRetryInSeconds, () => { var result = SpeechRepository.TextToSpeechAsync(text, locale, voiceName, voiceType, outputFormat); return result; }, null)); }
public ClientDemographicViewModel(IDialogService dialogService, ISettings settings) : base(dialogService, settings) { Step = 1; GenderOptions = CustomLists.GenderList; AgeUnitOptions = CustomLists.AgeUnitList; SelectedGender = GenderOptions.First(); SelectedAgeUnit = AgeUnitOptions.First(); BirthDate = DateTime.Today;//.AddDays(-1); Title = "Demographics"; MovePreviousLabel = ""; MoveNextLabel = "NEXT"; Age = 0; SelectedAgeUnit = AgeUnitOptions.First(); }
// Populate structure from string public GenderAttribute(string gender) : base(1, 1) { if (gender == "m") this.gender = GenderOptions.Male; else if (gender == "f") this.gender = GenderOptions.Female; else if (gender == "h") this.gender = GenderOptions.Human; else if (gender == "u") this.gender = GenderOptions.OneOfUs; else if (gender == "n") this.gender = GenderOptions.Neuter; else throw new ArgumentException("Unknown gender: " + gender); }
public override void LoadFromStore(VMStore modelStore) { try { Demographic = JsonConvert.DeserializeObject<ClientDemographicDTO>(modelStore.Store); Downloaded = Demographic.Downloaded; PersonId = Demographic.PersonId; FirstName = Demographic.FirstName; MiddleName = Demographic.MiddleName; LastName = Demographic.LastName; NickName = Demographic.NickName; SelectedGender = GenderOptions.FirstOrDefault(x => x.Value == Demographic.Gender); Age = Demographic.Age; if (!string.IsNullOrWhiteSpace(Demographic.AgeUnit)) SelectedAgeUnit = AgeUnitOptions.FirstOrDefault(x => x.Value == Demographic.AgeUnit); BirthDate = Demographic.BirthDate; } catch (Exception e) { Mvx.Error(e.Message); } }
public virtual Stream GetAudioStream(string url, string text, SpeechLocaleOptions locale, VoiceName voiceName, GenderOptions voiceType, AudioOutputFormatOptions outputFormat, string token) { // Construct HTTP request to get the logo HttpWebRequest httpRequest = (HttpWebRequest) WebRequest.Create(url); httpRequest.Method = WebRequestMethods.Http.Post; var headers = GetAudioHeaders(token, outputFormat); httpRequest.Headers.Add("X-Microsoft-OutputFormat", outputFormat.MemberAttrValue()); httpRequest.Headers.Add("Authorization", $"Bearer {token}"); httpRequest.ContentType = "application/ssml+xml"; httpRequest.UserAgent = "TTSClient"; byte[] reqData = Encoding.UTF8.GetBytes(GetAudioContent(text, locale, voiceName, voiceType)); httpRequest.ContentLength = (long)reqData.Length; Stream requestStream = httpRequest.GetRequestStream(); requestStream.Write(reqData, 0, reqData.Length); requestStream.Close(); // Get back the HTTP response for web server HttpWebResponse httpResponse = (HttpWebResponse)httpRequest.GetResponse(); Stream httpResponseStream = httpResponse.GetResponseStream(); var newStream = new MemoryStream(); httpResponseStream.CopyTo(newStream); httpResponse.Close(); newStream.Position = 0; return(newStream); }
public virtual string GetAudioContent(string text, SpeechLocaleOptions locale, VoiceName voiceName, GenderOptions voiceType) { var langValue = locale.MemberAttrValue(); var namespaceAttr = $"xmlns=\"http://www.w3.org/2001/10/synthesis\""; var versionAttr = $"version=\"1.0\""; var langAttr = $"xml:lang=\"{langValue}\""; var genderAttr = $"xmlns:gender=\"{voiceType}\""; var nameAttr = $"name=\"Microsoft Server Speech Text to Speech Voice {voiceName.MemberAttrValue()}\""; var speakTag = $"<speak {versionAttr} {namespaceAttr} {langAttr}><voice {nameAttr}>{text}</voice></speak>"; return(speakTag); }
// Copy constructor public GenderAttribute(GenderOptions gender) : base(1, 1) { this.gender = gender; }
void IFastSerializable.Deserialize(SerializationReader reader) { base.Deserialize(reader); gender = (GenderOptions) reader.ReadObject(); }
void IFastSerializable.Deserialize(SerializationReader reader) { base.Deserialize(reader); gender = (GenderOptions)reader.ReadObject(); }
public virtual async Task <Stream> GetAudioStreamAsync(string url, string text, BingSpeechLocaleOptions locale, string voiceName, GenderOptions voiceType, AudioOutputFormatOptions outputFormat, string token) { HttpClientHandler handler = new HttpClientHandler() { CookieContainer = new CookieContainer(), UseProxy = false }; HttpClient client = new HttpClient(handler); client.DefaultRequestHeaders.Clear(); var Headers = GetAudioHeaders(token, outputFormat); foreach (var header in Headers) { client.DefaultRequestHeaders.TryAddWithoutValidation(header.Key, header.Value); } var request = new HttpRequestMessage(HttpMethod.Post, url) { Content = GetAudioContent(text, locale, voiceName, voiceType) }; var response = await client.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, CancellationToken.None); return(await response.Content.ReadAsStreamAsync()); }
public SearchOptions(GenderOptions genderOptions, IEnumerable<RelationType> notAllowedRelations) { GenderOptions = genderOptions; NotAllowedRelations = notAllowedRelations; }
public virtual bool TextToFile(string text, string filePath, SpeechLocaleOptions locale, VoiceName voiceName, GenderOptions voiceType, AudioOutputFormatOptions outputFormat) { if (File.Exists(filePath)) { return(true); } //can only send 1000 characters at a time //speech xml request = 178 characters var textLimit = 822; var textParts = (text.Length > textLimit) ? SplitToLength(text, textLimit) : new List <string> { text }; using (var fileStream = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.Write)) { foreach (var t in textParts) { using (var dataStream = TextToSpeech(t, locale, voiceName, voiceType, outputFormat)) { if (dataStream != null) { dataStream.CopyTo(fileStream); } } } fileStream.Close(); } return(true); }
public virtual async Task <Stream> TextToSpeechAsync(string text, SpeechLocaleOptions locale, VoiceName voiceName, GenderOptions voiceType, AudioOutputFormatOptions outputFormat) { var response = await RepositoryClient.GetAudioStreamAsync( ApiKeys.SpeechEndpoint, text, locale, voiceName, voiceType, outputFormat, GetSpeechToken()); return(response); }
public virtual StringContent GetAudioContent(string text, BingSpeechLocaleOptions locale, string voiceName, GenderOptions voiceType) { return(new StringContent($"<speak version=\"1.0\" xmlns:lang=\"en-US\"><voice xmlns:lang=\"{JsonConvert.SerializeObject(locale)}\" xmlns:gender=\"{JsonConvert.SerializeObject(voiceType)}\" name=\"{voiceName}\">{text}</voice></speak>")); }
public Player(int _id, string _name, GenderOptions _gender) { this._id = _id; this._name = _name; this._gender = _gender; }
public virtual Stream TextToSpeech(string text, BingSpeechLocaleOptions locale, string voiceName, GenderOptions voiceType, AudioOutputFormatOptions outputFormat) { try { var result = SpeechRepository.TextToSpeech(text, locale, voiceName, voiceType, outputFormat); return(result); } catch (Exception ex) { Logger.Error("SpeechService.TextToSpeech failed", this, ex); } return(null); }
public virtual async Task <Stream> TextToSpeechAsync(string text, BingSpeechLocaleOptions locale, string voiceName, GenderOptions voiceType, AudioOutputFormatOptions outputFormat) { var response = await RepositoryClient.GetAudioStreamAsync( $"{ApiKeys.BingSpeechEndpoint}synthesize", text, locale, voiceName, voiceType, outputFormat, RepositoryClient.SendBingSpeechTokenRequest(ApiKeys.BingSpeech)); return(response); }