예제 #1
0
 public ConnctConfig()
 {
     InitializeComponent();
     this.showToolStripMenuItem.Click += showToolStripMenuItem_Click;
     this.exitToolStripMenuItem.Click += exitMenuItem_Click;
     validComportList = SerialPort.GetPortNames();
     //lmcFtpServer.start();
     if (File.Exists(configFileName))
     {
         tcaTSLsetPath                       = IniFileOperator.getKeyValue("tslPath", "", configFileName);
         defaultComportNmae                  = IniFileOperator.getKeyValue("defaultComPortName", "", configFileName);
         serverPort                          = IniFileOperator.getKeyValue("serverPort", "", configFileName);
         textBox_TCATSLPath.Text             = tcaTSLsetPath;
         textBox_ServerPort.Text             = serverPort;
         comboBox_ComportList.Text           = defaultComportNmae;
         fSMConfiguration.tslPath            = tcaTSLsetPath;
         fSMConfiguration.defaultComPortName = defaultComportNmae;
         fSMConfiguration.serverPort         = serverPort;
         telnetServer                        = new TelnetServer(fSMConfiguration);
     }
     else
     {
         MessageBox.Show("Can not load the configuration file, please configure the infomation and restart the server !",
                         "configuration load error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         textBox_ServerPort.Text = "11000";
         IniFileOperator.setKeyValue("serverPort", "11000", configFileName);
         comboBox_ComportList.DataSource = validComportList;
     }
 }
예제 #2
0
 private void comboBox_ComportList_SelectedIndexChanged(object sender, EventArgs e)
 {
     defaultComportNmae = comboBox_ComportList.SelectedValue.ToString();
     fSMConfiguration.defaultComPortName = defaultComportNmae;
     if (telnetServer != null)
     {
         telnetServer.updateFSMConfiguration(fSMConfiguration);
     }
     IniFileOperator.setKeyValue("defaultComPortName", defaultComportNmae, configFileName);
 }
예제 #3
0
 private void textBox_ServerPort_TextChanged(object sender, EventArgs e)
 {
     try
     {
         if (int.Parse(textBox_ServerPort.Text) > 65535 || int.Parse(textBox_ServerPort.Text) < 0 || int.Parse(textBox_ServerPort.Text) == 12001)
         {
             MessageBox.Show("please input the number between the 0-65535,and don't use the special port(like 22,21) and server reserve prot: 12001  ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             textBox_ServerPort.Text = "11000";
             return;
         }
         serverPort = textBox_ServerPort.Text;
         fSMConfiguration.serverPort = serverPort;
         if (telnetServer != null)
         {
             telnetServer.updateFSMConfiguration(fSMConfiguration);
         }
         IniFileOperator.setKeyValue("serverPort", serverPort, configFileName);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
예제 #4
0
        private void textBox_TCATSLPath_TextChanged(object sender, EventArgs e)
        {
            string tslPath = textBox_TCATSLPath.Text;

            if (File.Exists(tslPath))
            {
                tcaTSLsetPath            = tslPath;
                fSMConfiguration.tslPath = tcaTSLsetPath;
                if (telnetServer != null)
                {
                    telnetServer.updateFSMConfiguration(fSMConfiguration);
                }
                IniFileOperator.setKeyValue("tslPath", tcaTSLsetPath, configFileName);
            }
            else if (tslPath.Length == 0)
            {
                return;
            }
            else
            {
                textBox_TCATSLPath.Clear();
                MessageBox.Show("Can not find the [TSL.exe] from folder:" + tslPath, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }