コード例 #1
0
 private void startConvertBtn_Click(object sender, EventArgs e)
 {
     if (fileDGView.Rows.Count < 1)
     {
         MessageBox.Show("无待转换文件");
         return;
     }
     foreach (DataGridViewRow row in fileDGView.Rows)
     {
         if (!row.IsNewRow)
         {
             var path = row.Cells["FileName"].Value.ToString();
             //Encoding encode = TxtFileEncoder.GetEncoding(i);
             Encoding encode = TxtFileEncoder.GetEncoding((Stream) new FileStream(path, FileMode.Open));
             string   s      = PFDataHelper.ReadFileToString(path, encode);
             PFDataHelper.SaveStringToFile(s, Path.Combine(PFDataHelper.BaseDirectory, "OutFile", Path.GetFileName(path)));
         }
     }
     System.Diagnostics.Process.Start(Path.Combine(PFDataHelper.BaseDirectory, "OutFile"));
 }