在Winform窗口中藏匿“字符串指令”
private void MainWindow_KeyPress(object sender, KeyPressEventArgs e) { var k = e.KeyChar; if (char.IsLetterOrDigit(k)) { sb.Append(k); } else if ((Keys)k == Keys.Space) { //string CurrentCfgFilePath = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile; MessageBox.Show(CurrentCfgFilePath); var keyString = sb.ToString(); if (keyString == "open") { const string path = @".\NewMT20GUI.exe.config"; System.Diagnostics.Process.Start(path); //配置文档的打开操作 MessageBox.Show("配置文件打开成功!"); } else if (keyString == "load") { InitializeCfgData(); //string str = string.Format("p={0}", _pValue); string str = string.Format("_alarmTemperature={0}", _alarmTemperature); MessageBox.Show("配置文件加载成功!"+str); } sb.Clear(); } }