Exemplo n.º 1
0
 //const string MBCFG_FILENAME = "/core/disk/modbus.cfg";
 public MainForm()
 {
     InitializeComponent();
     m_portConfigFile_default = new PortConfigFile(Config.Resource.Resource.DefaultCfg);
     SetConnectStateDisplay();
     SourceFile = System.Windows.Forms.Application.StartupPath + "\\configfile" + "\\modbus.cfg";
     TargetFile = "/core/disk/modbus.cfg";
 }
Exemplo n.º 2
0
 private void Openfile(string fileName)
 {
     m_portConfigFile = new PortConfigFile(fileName);
     if (tvPortInfo.Nodes.Count > 0)
     {
         tvPortInfo.Nodes.Clear();
     }
     SetPortConfigDisplay();
     if (m_portConfigFile.Errors != Config.EditType.EDIT_NONE)
     {
         MessageBox.Show("Configuration file errors!");
     }
 }
Exemplo n.º 3
0
        public MainForm()
        {
            InitializeComponent();
            m_portConfigFile_default = new PortConfigFile();
            SetConnectStateDisplay();
            m_spPort.ReceivedDataHandle = m_atc.ReceivedFunc;

            string ftpHomeDir;

            ftpHomeDir = System.Windows.Forms.Application.StartupPath + "\\configfile";
            DirectoryInfo dir = new DirectoryInfo(ftpHomeDir);

            dir.Create();
#if Telnet_Enable
            /*
             * 服务器的最大连接数
             */
            m_ftpServer.Capacity = 1000;

            /*
             * 连接超时时间
             */
            m_ftpServer.HeartBeatPeriod = 120000;  //120秒

            /*
             * 创建一个使用FTP的用户,
             */
            FtpUser user = new FtpUser("ftp");
            user.Password   = "******";
            user.AllowWrite = true;
            //dir.Create();

            user.HomeDir = ftpHomeDir;

            /*
             * 限制该帐号的用户的连接服务器的最大连接数
             * 也就是限制该使用该帐号的FTP同时连接服务器的数量。
             */
            user.MaxConnectionCount = 2;

            /*
             * 限制用户的最大上传文件为20M,超过这个值上传文件会失败。
             * 默认不限制该值,可以传输大文件。
             */
            user.MaxUploadFileLength = 1024 * 1024 * 20;
            m_ftpServer.AddUser(user);

            //把当前目录作为匿名用户的目录,测试目的(必须指定)
            m_ftpServer.AnonymousUser.HomeDir = System.Windows.Forms.Application.StartupPath + "\\configfile";
#endif
        }
Exemplo n.º 4
0
        public MainForm()
        {
            InitializeComponent();
            m_portConfigFile_default = new PortConfigFile(Config.Resource.Resource.DefaultCfg);
            SetConnectStateDisplay();
            m_spPort.ReceivedDataHandle = m_atc.ReceivedFunc;

            string ftpHomeDir;

            ftpHomeDir = System.Windows.Forms.Application.StartupPath + "\\configfile";
            DirectoryInfo dir = new DirectoryInfo(ftpHomeDir);

            dir.Create();
        }
Exemplo n.º 5
0
        private void tsNew_Click(object sender, EventArgs e)
        {
            SaveFileDialog SaveFileDialog1 = new SaveFileDialog();

            SaveFileDialog1.InitialDirectory = System.Windows.Forms.Application.StartupPath + "\\configfile";
            SaveFileDialog1.Filter           = "CFG files (*.cfg)|*.cfg";
            SaveFileDialog1.FilterIndex      = 1;
            SaveFileDialog1.RestoreDirectory = true;

            if (SaveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                m_portConfigFile = new PortConfigFile(Config.Resource.Resource.DefaultCfg);
                m_portConfigFile.SaveFile(SaveFileDialog1.FileName);
                if (tvPortInfo.Nodes.Count > 0)
                {
                    tvPortInfo.Nodes.Clear();
                }
                SetPortConfigDisplay();
            }
        }