public static bool run(strList words) { string cmd = words.shift(); if (cmd == "curid") { return(curId()); } if (cmd == "info") { return(cmdVoiceDescribe.info(words)); } if (cmd == "list") { return(cmdVoiceDescribe.list(words)); } if (cmd == "select") { return(cmdVoiceSelect.run(words)); } if (cmd == "vol") { return(cmdSpeechVolume(words.getOr(0))); } if (cmd == "rate") { return(cmdSpeechRate(words.getOr(0))); } return(Program.errUnsuppCmd()); }
public static bool cmdSleep(strList words) { float val = float.Parse(words.shift(), CultureInfo.InvariantCulture); string unit = words.shift(); if (unit != "sec") { fail("unsupported_time_unit"); } int msec = (int)Math.Ceiling(val * 1.0e3); Thread.Sleep(msec); Console.WriteLine("ok slept"); return(true); }
public static bool decode(strList words) { string text = Program.textBuf; byte[] bytes = {}; string how; while (true) { how = words.shift(); if (how == null) { break; } if (how == "base64") { bytes = System.Convert.FromBase64String(text); continue; } if (how == "utf8") { text = System.Text.Encoding.UTF8.GetString(bytes); continue; } Program.fail("unsupported_decoder " + how); } return(exact(text, "decoded")); }
public static bool run(strList words) { string how = words.shift(); if (how == "arg") { return(exact(String.Join(" ", words))); } if (how == "next") { return(exact(Program.readLn())); } if (how == "until") { return(untilMark(words.getOr(0))); } if (how == "decode") { return(decode(words)); } if (how == "_debug_dump_json") { return(dumpTextAsJson()); } return(Program.errUnsuppCmd()); }
static string readLnCore() { if (readLnInputQ.Count > 0) { return(readLnInputQ.shift()); } if (interactiveMode) { return(libInputUtil.readStdinLn()); } return(null); }
public static bool cmdOutput(strList words) { string destType = words.shift(); if (destType == "default") { failIfLockedDown(); synth.SetOutputToDefaultAudioDevice(); Console.WriteLine("ok audio_destination {0}", destType); return(true); } return(errUnsuppCmd()); }
public static bool run(strList words) { string how = words.shift(); if (how == "id") { return(byId(words)); } if (how == "namepart") { return(byNamePart(words.getOr(0))); } return(Program.errUnsuppCmd()); }
public static bool run(strList words) { string cmd = words.shift(); if (cmd == "sync") { return(sync()); } if (cmd == "start") { return(start()); } if (cmd == "stop") { return(stop()); } // pause/resume: toggle the "paused" flag return(Program.errUnsuppCmd()); }
public static bool cmd(strList words = null) { if (words == null) { string ln = readLn(); if (ln == null) { return(die("quit")); } words = strList.splitWords(ln); } if (words.Count < 1) { return(true); } string cmd = words.shift(); if (cmd == "#") { return(true); } if (cmd == "must") { return(cmdMust(words)); } if (cmd == "quit") { return(die("quit")); } if (cmd == "flag") { return(cmdFlag(words)); } if (cmd == "interactive") { return(cmdInteractive()); } if (cmd == "voice") { return(cmdVoice.run(words)); } if (cmd == "vol") { return(cmdMasterVolume(words.getOr(0))); } if (cmd == "audio_output") { return(cmdOutput(words)); } if (cmd == "set_text") { return(cmdSetTextBuf.run(words)); } if (cmd == "speak") { return(cmdSpeak.run(words)); } if (cmd == "speak_sync") { return(cmdSpeak.sync()); } // legacy v1.0.1 compat if (cmd == "sleep") { return(cmdSleep(words)); } return(errUnsuppCmd()); }