Ejemplo n.º 1
0
        /// <summary>
        ///     转换多个文件为对应文件名的多个文件
        /// </summary>
        /// <param name="filePathes"></param>
        /// <param name="outputDir"></param>
        public void Convert(IList <string> filePathes, string outputDir)
        {
            ExportContents = new List <string>();
            int c = 0;

            filePathes = GetRealPath(filePathes);

            foreach (string file in filePathes)
            {
                WordLibraryList wlList = import.Import(file);
                wlList = Filter(wlList);
                if (selectedTranslate != ChineseTranslate.NotTrans)
                {
                    wlList = ConvertChinese(wlList);
                }
                c += wlList.Count;
                GenerateWordRank(wlList);
                ExportContents = export.Export(RemoveEmptyCodeData(wlList));
                for (var i = 0; i < ExportContents.Count; i++)
                {
                    string exportPath = outputDir + (outputDir.EndsWith("\\") ? "" : "\\") +
                                        Path.GetFileNameWithoutExtension(file) + (i == 0?"":i.ToString()) + ".txt";
                    FileOperationHelper.WriteFile(exportPath, export.Encoding, ExportContents[i]);
                }
            }
            count = c;
        }
Ejemplo n.º 2
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            timer1.Enabled = false;
            toolStripProgressBar1.Value = toolStripProgressBar1.Maximum;
            ShowStatusMessage("转换完成", false);
            if (streamExport && import.IsText)
            {
                ShowStatusMessage("转换完成,词库保存到文件:" + exportPath, true);
                return;
            }
            if (exportDirectly)
            {
                richTextBox1.Text = "为提高处理速度,高级设置中默认设置为直接导出,本文本框中不显示转换后的结果,若要查看、修改转换后的结果再导出请取消该设置。";
            }
            else
            {
                richTextBox1.Text = fileContent;
                btnExport.Enabled = true;
            }

            if (
                MessageBox.Show("是否将导入的" + mainBody.Count + "条词库保存到本地硬盘上?", "是否保存", MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (!string.IsNullOrEmpty(exportFileName))
                {
                    saveFileDialog1.FileName = exportFileName;
                }
                if (export is TouchPal)
                {
                    saveFileDialog1.DefaultExt = ".bak";
                    saveFileDialog1.Filter     = "触宝备份文件|*.bak";
                }
                else if (export is MsPinyin)
                {
                    saveFileDialog1.DefaultExt = ".dctx";
                    saveFileDialog1.Filter     = "微软拼音2010|*.dctx";
                }
                else
                {
                    saveFileDialog1.DefaultExt = ".txt";
                    saveFileDialog1.Filter     = "文本文件|*.txt";
                }
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    if (export is TouchPal)
                    {
                        File.Move(fileContent, saveFileDialog1.FileName);
                    }
                    else if (FileOperationHelper.WriteFile(saveFileDialog1.FileName, export.Encoding, fileContent))
                    {
                        ShowStatusMessage("保存成功,词库路径:" + saveFileDialog1.FileName, true);
                    }
                    else
                    {
                        ShowStatusMessage("保存失败", true);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var lines = new List <SubtitleLine>();

            foreach (var subtitleLine in subtitle.Bodies)
            {
                if (removeChinese)
                {
                    subtitleLine.Text = subtitleLine.EnglishTextWithMeans;
                }
                else
                {
                    subtitleLine.Text = subtitleLine.Text.Replace(subtitleLine.EnglishText,
                                                                  subtitleLine.EnglishTextWithMeans);
                }
                lines.Add(subtitleLine);
            }
            subtitle.Bodies = lines;
            var path    = txbSubtitleFilePath.Text;
            var bakFile = Path.GetDirectoryName(path) + "\\" + Path.GetFileNameWithoutExtension(path) + "_bak" + Path.GetExtension(path);

            if (!File.Exists(bakFile))
            {
                File.Copy(txbSubtitleFilePath.Text, bakFile);
            }
            var str = stOperator.Subtitle2String(subtitle);

            FileOperationHelper.WriteFile(txbSubtitleFilePath.Text, Encoding.UTF8, str);
            ShowMessage("保存成功");
        }
Ejemplo n.º 4
0
        public IList <string> Export(WordLibraryList wlList)
        {
            //对全拼方案进行编码转换
            wlList = Filter(wlList);
            string tempPath = Path.Combine(FileOperationHelper.GetCurrentFolderPath(), "dictionary.txt");

            if (File.Exists(tempPath))
            {
                File.Delete(tempPath);
            }
            var sb = new StringBuilder();

            sb.Append("# Gboard Dictionary version:1\n");
            for (int i = 0; i < wlList.Count; i++)
            {
                sb.Append(ExportLine(wlList[i]));
                sb.Append("\n");
            }
            FileOperationHelper.WriteFile(tempPath, new UTF8Encoding(false), sb.ToString());
            string zipPath = Path.Combine(FileOperationHelper.GetCurrentFolderPath(), "Gboard词库.zip");

            if (File.Exists(zipPath))
            {
                File.Delete(zipPath);
            }
            FileOperationHelper.ZipFile(tempPath, zipPath);
            return(new List <string>()
            {
                "词库文件在:" + zipPath
            });
            //return new List<string>() { sb.ToString() };
        }
Ejemplo n.º 5
0
        private void SplitFileByLength(int length)
        {
            //Encoding encoding = null;
            length = length - 100; //100个字的Buffer
            //string str = FileOperationHelper.ReadFileContent(txbFilePath.Text, ref encoding, Encoding.UTF8);

            Encoding encoding  = FileOperationHelper.GetEncodingType(txbFilePath.Text);
            string   str       = FileOperationHelper.ReadFile(txbFilePath.Text, encoding);
            int      fileIndex = 1;

            do
            {
                if (str.Length == 0)
                {
                    break;
                }
                string content = str.Substring(0, Math.Min(str.Length, length));
                str = str.Substring(content.Length);

                int i = Math.Min(str.IndexOf('\r'), str.IndexOf('\n'));
                if (i != -1)
                {
                    content += str.Substring(0, i + 2);
                    str      = str.Substring(i + 2);
                }
                string newFile = GetWriteFilePath(fileIndex++);
                FileOperationHelper.WriteFile(newFile, encoding, content);
                rtbLogs.AppendText(newFile + "\r\n");
            } while (true);
        }
Ejemplo n.º 6
0
        //private  void ClearCache()
        //{
        //    userVocabularies.Clear();
        //    cachedDict.Clear();
        //}

        private void btnSave_Click(object sender, EventArgs e)
        {
            var nsubtitle = BuildSubtitleFromGrid();

            if (nsubtitle == null || nsubtitle.Bodies.Count == 0)
            {
                MessageBox.Show("请先点击“载入字幕”按钮打开字幕文件");
                return;
            }
            if (meanColor != default(Color))
            {
                Regex r          = new Regex(@"\(([^\)]+)\)");
                var   fontFormat = "(<font color='#" + meanColor.R.ToString("x2") + meanColor.G.ToString("x2") +
                                   meanColor.B.ToString("x2") + "'>$1</font>)";
                foreach (var kv in nsubtitle.Bodies)
                {
                    var line = kv.Value;
                    if (r.IsMatch(line.Text))
                    {
                        line.Text = r.Replace(line.Text, fontFormat);
                    }
                }
            }
            var path    = txbSubtitleFilePath.Text;
            var newFile = Path.GetDirectoryName(path) + "\\" + Path.GetFileNameWithoutExtension(path) + "_new" + Path.GetExtension(path);
            //if(!File.Exists(newFile))
            //{
            //    File.Copy(txbSubtitleFilePath.Text, newFile);
            //}
            var str = stOperator.Subtitle2String(nsubtitle);

            FileOperationHelper.WriteFile(newFile, Encoding.UTF8, str);
            ShowMessage("保存成功");
            MessageBox.Show("保存成功,文件名:" + Path.GetFileName(newFile));
        }
Ejemplo n.º 7
0
        public void TestWriteFile()
        {
            string path    = "WriteTest.txt";
            string content = "Hello Word!";

            Assert.IsTrue(FileOperationHelper.WriteFile(path, Encoding.UTF8, content));
            Assert.IsTrue(File.Exists(path));
            File.Delete(path);
        }
 private void btnOK_Click(object sender, EventArgs e)
 {
     foreach (var subtitleFile in SubtitleFiles)
     {
         //File.Copy(subtitleFile.Key,subtitleFile.Key+".bak");
         FileOperationHelper.WriteFile(subtitleFile.Key, Encoding.UTF8,
                                       stOperator.Subtitle2String(subtitleFile.Value));
     }
     MessageBox.Show("完成");
 }
Ejemplo n.º 9
0
        public void Run()
        {
            for (int i = 0; i < Args.Length; i++)
            {
                string arg = Args[i];
                type = RunCommand(arg);
            }
            if (!string.IsNullOrEmpty(format))
            {
                if ((!(wordLibraryExport is SelfDefining)) && (!(wordLibraryImport is SelfDefining)))
                {
                    Console.WriteLine("-f参数用于自定义格式时设置格式样式用,导入导出词库格式均不是自定义格式,该参数无效!");
                    return;
                }
            }
            if (!string.IsNullOrEmpty(codingFile))
            {
                if (!(wordLibraryExport is SelfDefining))
                {
                    Console.WriteLine("-f参数用于自定义格式输出时设置编码用,导出词库格式不是自定义格式,该参数无效!");
                    return;
                }
            }
            if (wordLibraryImport is SelfDefining)
            {
                ((SelfDefining)wordLibraryImport).UserDefiningPattern = pattern;
            }
            if (wordLibraryExport is SelfDefining)
            {
                ((SelfDefining)wordLibraryExport).UserDefiningPattern = pattern;
            }
            if (importPaths.Count > 0 && exportPath != "")
            {
                MainBody mainBody = new MainBody();
                mainBody.Export = wordLibraryExport;
                mainBody.Import = wordLibraryImport;

                Console.WriteLine("转换开始...");
                //foreach (string importPath in importPaths)
                //{
                //    Console.WriteLine("开始转换文件:" + importPath);
                //    wordLibraryList.AddWordLibraryList(wordLibraryImport.Import(importPath));
                //}
                //string str = wordLibraryExport.Export(wordLibraryList);
                string str = mainBody.Convert(importPaths);
                FileOperationHelper.WriteFile(exportPath, wordLibraryExport.Encoding, str);
                Console.WriteLine("转换完成,共转换" + mainBody.Count + "个");
                return;
            }
            else
            {
                Console.WriteLine("输入 -? 可获取帮助");
            }
        }
Ejemplo n.º 10
0
        public void ExportToFile(string filePath)
        {
            var outputDir = Path.GetDirectoryName(filePath);

            for (var i = 0; i < ExportContents.Count; i++)
            {
                string exportPath = outputDir + (outputDir.EndsWith("\\") ? "" : "\\") +
                                    Path.GetFileNameWithoutExtension(filePath) + (i == 0 ? "" : i.ToString()) + ".txt";
                FileOperationHelper.WriteFile(exportPath, export.Encoding, ExportContents[i]);
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        ///     转换多个文件为对应文件名的多个文件
        /// </summary>
        /// <param name="filePathes"></param>
        /// <param name="outputDir"></param>
        public void Convert(IList <string> filePathes, string outputDir)
        {
            this.timer.Start();
            ExportContents = new List <string>();
            int c = 0;

            //filePathes = GetRealPath(filePathes);
            int fileCount     = filePathes.Count;
            var fileProcessed = 0;

            foreach (string file in filePathes)
            {
                fileProcessed++;
                DateTime start = DateTime.Now;
                try
                {
                    WordLibraryList wlList = import.Import(file);
                    wlList = Filter(wlList);
                    if (selectedTranslate != ChineseTranslate.NotTrans)
                    {
                        wlList = ConvertChinese(wlList);
                    }
                    c += wlList.Count;
                    GenerateWordRank(wlList);
                    wlList = RemoveEmptyCodeData(wlList);
                    ReplaceAfterCode(wlList);
                    ExportContents = export.Export(wlList);
                    for (var i = 0; i < ExportContents.Count; i++)
                    {
                        string exportPath = outputDir + (outputDir.EndsWith("\\") ? "" : "\\") +
                                            Path.GetFileNameWithoutExtension(file) + (i == 0 ? "" : i.ToString()) +
                                            ".txt";
                        FileOperationHelper.WriteFile(exportPath, export.Encoding, ExportContents[i]);
                    }
                    ExportContents = new List <string>();
                    var costSeconds = (DateTime.Now - start).TotalSeconds;
                    ProcessNotice?.Invoke(fileProcessed + "/" + fileCount + "\t" + Path.GetFileName(file) + "\t转换完成,耗时:" +
                                          costSeconds + "秒\r\n");
                }
                catch (Exception ex)
                {
                    ProcessNotice?.Invoke(fileProcessed + "/" + fileCount + "\t" + Path.GetFileName(file) + "\t处理时发生异常:" +
                                          ex.Message + "\r\n");
                    count = c;
                    this.timer.Stop();
                }
            }
            count = c;
            this.timer.Stop();
        }
 private void btnExportUnknownWords_Click(object sender, EventArgs e)
 {
     if (saveFileDialog1.ShowDialog() == DialogResult.OK)
     {
         var           rows = dbOperator.FindAll <UserVocabulary>(v => v.KnownStatus == KnownStatus.Unknown);
         StringBuilder sb   = new StringBuilder();
         foreach (var row in rows)
         {
             sb.Append(row.Word + "\r\n");
         }
         FileOperationHelper.WriteFile(saveFileDialog1.FileName, Encoding.UTF8, sb.ToString());
         MessageBox.Show("导出完成");
     }
 }
Ejemplo n.º 13
0
        private void SplitFileByLine(int maxLine)
        {
            Encoding encoding = FileOperationHelper.GetEncodingType(txbFilePath.Text);

            string str = FileOperationHelper.ReadFile(txbFilePath.Text, encoding);

            string splitLineChar = "\r\n";

            if (str.IndexOf(splitLineChar) < 0)
            {
                if (str.IndexOf('\r') > 0)
                {
                    splitLineChar = "\r";
                }
                else if (str.IndexOf('\n') > 0)
                {
                    splitLineChar = "\n";
                }
                else
                {
                    MessageBox.Show("不能找到行分隔符");
                    return;
                }
            }
            string[] list = str.Split(new[] { splitLineChar }, StringSplitOptions.RemoveEmptyEntries);

            var fileContent = new StringBuilder();
            int fileIndex   = 1;

            for (int i = 0; i < list.Length; i++)
            {
                fileContent.Append(list[i]);
                fileContent.Append(splitLineChar);
                if ((i + 1) % maxLine == 0 || i == list.Length - 1)
                {
                    if (i != 0)
                    {
                        string newFile = GetWriteFilePath(fileIndex++);
                        FileOperationHelper.WriteFile(newFile, encoding, fileContent.ToString());
                        rtbLogs.AppendText(newFile + "\r\n");
                        fileContent = new StringBuilder();
                    }
                }
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 转换多个文件为对应文件名的多个文件
        /// </summary>
        /// <param name="filePathes"></param>
        /// <param name="outputDir"></param>
        public void Convert(IList <string> filePathes, string outputDir)
        {
            int c = 0;

            foreach (string file in filePathes)
            {
                WordLibraryList wlList = import.Import(file);
                wlList = Filter(wlList);
                if (selectedTranslate != ChineseTranslate.NotTrans)
                {
                    wlList = ConvertChinese(wlList);
                }
                c += wlList.Count;
                GenerateWordRank(wlList);
                var result     = export.Export(RemoveEmptyCodeData(wlList));
                var exportPath = outputDir + (outputDir.EndsWith("\\")?"":"\\") + Path.GetFileNameWithoutExtension(file) + ".txt";
                FileOperationHelper.WriteFile(exportPath, export.Encoding, result);
            }
            count = c;
        }
Ejemplo n.º 15
0
 private void btnExport_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("是否将文本框中的所有词条保存到本地硬盘上?", "是否保存", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
         DialogResult.Yes)
     {
         saveFileDialog1.DefaultExt = ".txt";
         if (cbxTo.Text == ConstantString.MS_PINYIN)
         {
             saveFileDialog1.DefaultExt = ".dctx";
         }
         if (saveFileDialog1.ShowDialog() == DialogResult.OK)
         {
             if (FileOperationHelper.WriteFile(saveFileDialog1.FileName, export.Encoding, richTextBox1.Text))
             {
                 ShowStatusMessage("保存成功,词库路径:" + saveFileDialog1.FileName, true);
             }
             else
             {
                 ShowStatusMessage("保存失败", false);
             }
         }
     }
 }
        private void btnMergeWL_Click(object sender, EventArgs e)
        {
            string mainWL = FileOperationHelper.ReadFile(txbMainWLFile.Text);
            Dictionary <string, List <string> > mainDict = ConvertTxt2Dictionary(mainWL);

            string[] userFiles = txbUserWLFiles.Text.Split('|');
            foreach (string userFile in userFiles)
            {
                string filePath = userFile.Trim();
                string userTxt  = FileOperationHelper.ReadFile(filePath);
                Dictionary <string, List <string> > userDict = ConvertTxt2Dictionary(userTxt);
                Merge2Dict(mainDict, userDict);
            }
            if (cbxSortByCode.Checked)
            {
                var keys = new List <string>(mainDict.Keys);
                keys.Sort();
                var sortedDict = new Dictionary <string, List <string> >();
                foreach (string key in keys)
                {
                    sortedDict.Add(key, mainDict[key]);
                }
                mainDict = sortedDict;
            }
            string result = Dict2String(mainDict);

            richTextBox1.Text = result;
            if (
                MessageBox.Show("是否将合并的" + mainDict.Count + "条词库保存到本地硬盘上?", "是否保存", MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    FileOperationHelper.WriteFile(saveFileDialog1.FileName, Encoding.Unicode, result);
                }
            }
        }
Ejemplo n.º 17
0
        private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            timer1.Enabled = false;
            toolStripProgressBar1.Value = toolStripProgressBar1.Maximum;
            ShowStatusMessage("转换完成", false);
            if (e.Error != null)
            {
                MessageBox.Show("不好意思,发生了错误:" + e.Error.Message);
                if (e.Error.InnerException != null)
                {
                    richTextBox1.Text = (e.Error.InnerException.ToString());
                }
                return;
            }
            if (streamExport && import.IsText)
            {
                ShowStatusMessage("转换完成,词库保存到文件:" + exportPath, true);
                return;
            }
            if (exportDirectly)
            {
                richTextBox1.Text = "为提高处理速度,“高级设置”中选中了“不显示结果,直接导出”,本文本框中不显示转换后的结果,若要查看转换后的结果再确定是否保存请取消该设置。";
            }
            else
            {
                richTextBox1.Text = fileContent;
                //btnExport.Enabled = true;
            }
            if (!mergeTo1File)
            {
                MessageBox.Show("转换完成!");
                return;
            }
            if (
                MessageBox.Show("是否将导入的" + mainBody.Count + "条词库保存到本地硬盘上?", "是否保存", MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                if (!string.IsNullOrEmpty(exportFileName))
                {
                    saveFileDialog1.FileName = exportFileName;
                }

                else if (export is MsPinyin)
                {
                    saveFileDialog1.DefaultExt = ".dctx";
                    saveFileDialog1.Filter     = "微软拼音2010|*.dctx";
                }
                else
                {
                    saveFileDialog1.DefaultExt = ".txt";
                    saveFileDialog1.Filter     = "文本文件|*.txt";
                }
                if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    if (FileOperationHelper.WriteFile(saveFileDialog1.FileName, export.Encoding, fileContent))
                    {
                        ShowStatusMessage("保存成功,词库路径:" + saveFileDialog1.FileName, true);
                    }
                    else
                    {
                        ShowStatusMessage("保存失败", true);
                    }
                }
            }
        }
Ejemplo n.º 18
0
 public void Run()
 {
     if (Args.Length == 0)
     {
         Console.WriteLine("输入 -? 可获取帮助");
         return;
     }
     for (int i = 0; i < Args.Length; i++)
     {
         string arg = Args[i];
         type = RunCommand(arg);
     }
     if (!string.IsNullOrEmpty(format))
     {
         if ((!(wordLibraryExport is SelfDefining)) && (!(wordLibraryImport is SelfDefining)))
         {
             Console.WriteLine("-f参数用于自定义格式时设置格式样式用,导入导出词库格式均不是自定义格式,该参数无效!");
             return;
         }
     }
     if (!string.IsNullOrEmpty(codingFile))
     {
         if (!(wordLibraryExport is SelfDefining))
         {
             Console.WriteLine("-f参数用于自定义格式输出时设置编码用,导出词库格式不是自定义格式,该参数无效!");
             return;
         }
     }
     if (wordLibraryImport is SelfDefining)
     {
         ((SelfDefining)wordLibraryImport).UserDefiningPattern = pattern;
     }
     if (wordLibraryExport is SelfDefining)
     {
         ((SelfDefining)wordLibraryExport).UserDefiningPattern = pattern;
     }
     if (wordLibraryExport is Rime)
     {
         ((Rime)wordLibraryExport).CodeType = pattern.CodeType;
         ((Rime)wordLibraryExport).OS       = pattern.OS;
     }
     if (wordLibraryImport is LingoesLd2)
     {
         var ld2Import = ((LingoesLd2)wordLibraryImport);
         ld2Import.WordEncoding = wordEncoding;
         if (xmlEncoding != null)
         {
             ld2Import.XmlEncoding    = xmlEncoding;
             ld2Import.IncludeMeaning = true;
         }
     }
     if (importPaths.Count > 0 && exportPath != "")
     {
         var mainBody = new MainBody();
         mainBody.Export = wordLibraryExport;
         mainBody.Import = wordLibraryImport;
         mainBody.SelectedWordRankGenerater = this.wordRankGenerater;
         mainBody.Filters        = this.filters;
         mainBody.ProcessNotice += MainBody_ProcessNotice;
         Console.WriteLine("转换开始...");
         //foreach (string importPath in importPaths)
         //{
         //    Console.WriteLine("开始转换文件:" + importPath);
         //    wordLibraryList.AddWordLibraryList(wordLibraryImport.Import(importPath));
         //}
         //string str = wordLibraryExport.Export(wordLibraryList);
         if (exportPath.EndsWith("*"))
         {
             mainBody.Convert(importPaths, exportPath.Substring(0, exportPath.Length - 1));
         }
         else
         {
             string str = mainBody.Convert(importPaths);
             FileOperationHelper.WriteFile(exportPath, wordLibraryExport.Encoding, str);
         }
         Console.WriteLine("转换完成,共转换" + mainBody.Count + "个");
     }
     Console.WriteLine("输入 -? 可获取帮助");
 }
Ejemplo n.º 19
0
        private void LoadData()
        {
            //try
            //{
            string path = GetText();

            if (path == "")
            {
                MessageBox.Show("请选择一个搜狗词库的文件");
                return;
            }
            string str = FileOperationHelper.ReadFile(path);

            string[] lines = str.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            int      count = lines.Length;
            var      wls   = new Dictionary <string, string>();

            for (int i = 0; i < count; i++)
            {
                string line = lines[i];
                if (line[0] == ';') //说明
                {
                    continue;
                }
                string[] hzpy = line.Split(' ');
                string   py   = hzpy[0];
                string   hz   = hzpy[1];
                if (NeedSave(hz, py))
                {
                    //多音字做如下处理
                    if (!wls.ContainsKey(hz))
                    {
                        wls.Add(hz, py);
                    }
                }
                processString = i + "/" + count;
            }
            ShowTextMessage("开始载入现有的注音库");
            string pylibString = FileOperationHelper.ReadFile(ConstantString.PinyinLibPath);

            lines = pylibString.Split(new[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
            for (int i = 0; i < lines.Length; i++)
            {
                string   line = lines[i];
                string[] hzpy = line.Split(' ');
                string   py   = hzpy[0];
                string   hz   = hzpy[1];

                if (!wls.ContainsKey(hz))
                {
                    wls.Add(hz, py);
                }
                processString = i + "/" + count;
            }


            ShowTextMessage("载入全部完成,开始去除重复");
            Dictionary <string, string> rst = RemoveDuplicateWords(wls);


            ShowTextMessage("去除重复完成,开始写入文件");
            StreamWriter sw = FileOperationHelper.WriteFile(ConstantString.PinyinLibPath, Encoding.Unicode); //清空注音库文件

            foreach (string key in rst.Keys)
            {
                string line = rst[key] + " " + key;
                FileOperationHelper.WriteFileLine(sw, line);
            }
            sw.Close();
            toolStripStatusLabel1.Text = "完成!";
            ShowTextMessage("完成!");
            timer1.Stop();
            MessageBox.Show("完成!");
            //}
            //catch (Exception ex)
            //{
            //    ShowTextErrorMessage(ex.Message);
            //}
        }