Exemplo n.º 1
0
 public SpeechContentItem(int index, SpeechContentType type, string fileName, string desc = "", string url = "")
 {
     Index    = index;
     Type     = type;
     Desc     = desc;
     URL      = url;
     FileName = fileName;
 }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        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);
        }