Ejemplo n.º 1
0
        /// <summary>
        /// 检查文件是否存在,如不存在是否创建文件夹及XML的文件头
        /// </summary>
        /// <param name="strFileName">检查的文件名称</param>
        /// <param name="CreatePath">是否创建文件夹</param>
        /// <param name="CreateXMLHead">是否创建XML文件头</param>
        /// <returns>文件是否存在</returns>
        public static bool PrepareFileExist(string strFileName, bool bCreatePath, bool bCreateXMLHead)
        {
            if (File.Exists(strFileName))
            {
                return(true);
            }

            string str = Path.GetDirectoryName(strFileName);

            if (str != strFileName)
            {
                if (Directory.Exists(str) == false)
                {
                    if (bCreatePath)
                    {
                        Directory.CreateDirectory(str);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }

            if (bCreateXMLHead)
            {
                CXmlFile.CreateXmlFile(strFileName);
            }

            return(true);
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            CXmlFile.SaveStringToXmlFile(lstLanguage.SelectedIndex.ToString(), configFile, "语音设置/语音类型");
            CXmlFile.SaveStringToXmlFile(lstVoiceType.SelectedIndex.ToString(), configFile, "语音设置/格式类型");
            CXmlFile.SaveStringToXmlFile(sliderValue.Value.ToString(), configFile, "语音设置/语速");
            CXmlFile.SaveStringToXmlFile(playTimes.Value.ToString(), configFile, "语音设置/播放次数");
            this.DialogResult = DialogResult.OK;

            this.Close();
        }
Ejemplo n.º 3
0
        public SpeakVoice()
        {
            InitializeComponent();
            IntPtr i = this.Handle;

            _spFlags = SpeechVoiceSpeakFlags.SVSFlagsAsync;
            _voice   = new SpVoice();
            InitialControl();
            _speakTextList            = new List <string>();
            lstLanguage.SelectedIndex = Convert.ToInt32(
                CXmlFile.GetStringFromXmlFile(configFile, "语音设置/语音类型", "0"));
            lstVoiceType.SelectedIndex = Convert.ToInt32(
                CXmlFile.GetStringFromXmlFile(configFile, "语音设置/格式类型", "0"));

            sliderValue.Value = Convert.ToInt32(CXmlFile.GetStringFromXmlFile(configFile, "语音设置/语速", "0"));
            playTimes.Value   = Convert.ToInt32(CXmlFile.GetStringFromXmlFile(configFile, "语音设置/播放次数", "1"));
            newThread         = new Thread(new ParameterizedThreadStart(doThread));
        }