Skip to content

Commit

Permalink
修正命令方式執行結果錯誤的問題
Browse files Browse the repository at this point in the history
  • Loading branch information
flier268 committed Mar 12, 2019
1 parent 8111cd7 commit ee19e46
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ConvertZZ/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
{
using (Stream stream = new FileStream(f, FileMode.Open, FileAccess.Read, FileShare.Read))
{
using (StreamReader streamReader = new StreamReader(stream))
using (StreamReader streamReader = new StreamReader(stream, encoding[0], false))
{
s = streamReader.ReadToEnd();
}
Expand All @@ -187,7 +187,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
s = ConvertHelper.FileConvert(s, encoding, ToChinese, VocabularyCorrection);
if (ModeIsOneFile)
{
using (StreamWriter streamWriter = new StreamWriter(path2))
using (StreamWriter streamWriter = new StreamWriter(path2, false, encoding[1] == Encoding.UTF8 ? new UTF8Encoding(App.Settings.FileConvert.UnicodeAddBom) : encoding[1]))
{
streamWriter.Write(s);
streamWriter.Flush();
Expand All @@ -210,7 +210,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
}

Directory.CreateDirectory(Path.GetDirectoryName(@string));
using (StreamWriter streamWriter = new StreamWriter(@string))
using (StreamWriter streamWriter = new StreamWriter(@string, false, encoding[1] == Encoding.UTF8 ? new UTF8Encoding(App.Settings.FileConvert.UnicodeAddBom) : encoding[1]))
{
streamWriter.Write(s);
streamWriter.Flush();
Expand All @@ -219,7 +219,7 @@ private void Application_Startup(object sender, StartupEventArgs e)
else
{
Directory.CreateDirectory(Path.GetDirectoryName(path2));
using (StreamWriter streamWriter = new StreamWriter(Path.Combine(Path.GetDirectoryName(path2), Path.GetFileName(f))))
using (StreamWriter streamWriter = new StreamWriter(Path.Combine(Path.GetDirectoryName(path2), Path.GetFileName(f)), false, encoding[1] == Encoding.UTF8 ? new UTF8Encoding(App.Settings.FileConvert.UnicodeAddBom) : encoding[1]))
{
streamWriter.Write(s);
streamWriter.Flush();
Expand Down

0 comments on commit ee19e46

Please sign in to comment.