public SpeechContentItem(int index, SpeechContentType type, string fileName, string desc = "", string url = "") { Index = index; Type = type; Desc = desc; URL = url; FileName = fileName; }
private static void AddContentFile(string txt, SpeechContentType scType) { txt = txt.Trim(); if (scType == SpeechContentType.URL) { txt = PrefixURL + txt; } using (var sw = new StreamWriter(GetFileName(GetFirstAvailaibleIndex()), false, Encoding.UTF8)) { sw.Write(txt); } }
private static void UpdateContentFile(string txt, SpeechContentType scType, int index) { if (scType == SpeechContentType.URL) { txt = PrefixURL + txt; } using (var sw = new StreamWriter(Path.Combine(BaseFolder, "content", $"sc_{index}.txt"), false, Encoding.UTF8)) { sw.Write(txt); } }
public static void UpdateContentItem(string txt, int index) { if (String.IsNullOrEmpty(txt) || txt.Length < 5) { throw new ArgumentException(); } SpeechContentType scType = SpeechContentType.Text; if (IsCheckURL(txt.Trim())) { scType = SpeechContentType.URL; } UpdateContentFile(txt.Trim(), scType, index); }