Skip to content

Commit

Permalink
修复读写配置文件的bug问题
Browse files Browse the repository at this point in the history
  • Loading branch information
nl8590687 committed Oct 23, 2019
1 parent 89987f4 commit 48c4164
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ASRT_SpeechClient_WPF/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public MainWindow()
string[] conf_lines = System.IO.File.ReadAllLines(filename_conf);
url = conf_lines[0];
token = conf_lines[1];
textbox_url.Text = url;
}
asr = new SpeechRecognizer(url, token);
asr.OnReceiveText += SpeechRecognizer_OnReceiveText;
Expand Down Expand Up @@ -68,10 +69,8 @@ private async void btn_change_url_Click(object sender, RoutedEventArgs e)
asr = new SpeechRecognizer(url_new, token);
asr.OnReceiveText += SpeechRecognizer_OnReceiveText;

if (!System.IO.File.Exists(filename_conf))
{
System.IO.File.WriteAllText(filename_conf, url_new + "\n" + token);
}
System.IO.File.WriteAllText(filename_conf, url_new + "\n" + token);

}
}

Expand Down

0 comments on commit 48c4164

Please sign in to comment.