コード例 #1
0
 public SpeechContentItem(int index, SpeechContentType type, string fileName, string desc = "", string url = "")
 {
     Index    = index;
     Type     = type;
     Desc     = desc;
     URL      = url;
     FileName = fileName;
 }
コード例 #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);
            }
        }
コード例 #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);
            }
        }
コード例 #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);
        }