public ParseColors(Environments env, Logger log) { this.env = env; if (!File.Exists(env.ROOT + "lib" + env.DELIM + "colors.csv")) { log.Report(2, "ParseColors", "File colors.csv does not exist"); return; } }
public Database(Environments env) { log = new Logger(env); this.env = env; db = String.Format("{0}dat{1}store",env.ROOT,env.DELIM); log.Report(0, "Database", "Creating DB"); Create(); Check(); }
public Speaker(Language.Country language) { //ensure bools are defaulted to off. AsyncMode = false; UseSSML = false; _language = language; ss = new SpeechSynthesizer(); ss.SetOutputToDefaultAudioDevice(); try { if (UseSSML) { return; } switch (_language) { case Language.Country.eng: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)"); break; case Language.Country.fin: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (fi-FI, Heidi)"); break; case Language.Country.nor: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (nb-NO, Hulda)"); break; case Language.Country.rus: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (ru-RU, Elena)"); break; case Language.Country.swe: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (sv-SE, Hedvig)"); break; default: ss.SelectVoice("Microsoft Server Speech Text to Speech Voice (en-GB, Hazel)"); break; } } catch (NullReferenceException e) { // Woop. Logger logging = new Logger(true); logging.Report(ToString(), e.StackTrace); logging.Dispose(); } }
//default the speed to "no change" public void Speak(string message, int speed = 0) { try { PromptBuilder builder = new PromptBuilder(); builder.AppendText(message); //suddenly voices! ss.Rate = speed; if (UseSSML) { string ssmlString = "<speak version=\"1.0\" xmlns=\"http://www.w3.org/2001/10/synthesis\""; switch (_language) { case Language.Country.eng: ssmlString += " xml:lang=\"en-GB\">"; break; case Language.Country.fin: ssmlString += " xml:lang=\"fi-FI\">"; break; case Language.Country.nor: ssmlString += " xml:lang=\"nb-NO\">"; break; case Language.Country.rus: ssmlString += " xml:lang=\"ru-RU\">"; break; case Language.Country.swe: ssmlString += " xml:lang=\"sv-SE\">"; break; default: ssmlString += " xml:lang=\"en-GB\">"; break; } ssmlString += "<s>" + message + "</s/></speak>"; if (AsyncMode) { ss.SpeakSsmlAsync(ssmlString); } else { ss.SpeakSsml(ssmlString); } } } catch (Exception e) { Logger logging = new Logger(true); logging.Report(ToString(), e.StackTrace); logging.Dispose(); } }