Skip to content

Commit

Permalink
修复特殊符号&造成的部分翻译API无法输出翻译的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
hanmin0822 committed Jul 2, 2020
1 parent 751f386 commit ae388f7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion MisakaTranslator-WPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ private void HookGuideBtn_Click(object sender, RoutedEventArgs e)

private void OCRGuideBtn_Click(object sender, RoutedEventArgs e)
{
HandyControl.Controls.MessageBox.Show("根据部分用户反映,OCR功能目前存在热键失效的BUG,作者正在修复中,建议优先使用Hook功能!");
var ggw = new GameGuideWindow(2);
ggw.Show();
}
Expand Down
4 changes: 2 additions & 2 deletions MisakaTranslator-WPF/TranslateWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ private void OCR()
source = source.Replace("<br>", "").Replace("</br>", "").Replace("\n", "").Replace("\t", "").Replace("\r", "");
}
//去乱码
source = source.Replace("_", "").Replace("-", "").Replace("+", "");
source = source.Replace("_", "").Replace("-", "").Replace("+", "").Replace("&", "");

//4.翻译前预处理
string beforeString = _beforeTransHandle.AutoHandle(source);
Expand Down Expand Up @@ -472,7 +472,7 @@ public void DataRecvEventHandler(object sender, SolvedDataRecvEventArgs e)
repairedText = repairedText.Replace("<br>", "").Replace("</br>", "").Replace("\n", "").Replace("\t", "").Replace("\r", "");
}
//去乱码
repairedText = repairedText.Replace("_", "").Replace("-", "").Replace("+", "");
repairedText = repairedText.Replace("_", "").Replace("-", "").Replace("+", "").Replace("&", "");

//补充:如果去重之后的文本长度超过100,直接不翻译、不显示
if (repairedText.Length <= 100)
Expand Down

0 comments on commit ae388f7

Please sign in to comment.