Ejemplo n.º 1
0
        public ClientForm()
        {
            InitializeComponent();
            InitializeCanvas();
            InitializeNetwork();

            _config = TeamPainterClientConfig.FromIni();
        }
        public static TeamPainterClientConfig FromIni()
        {
            TeamPainterClientConfig cfg = new TeamPainterClientConfig();
            IniFile ini = IniFile.Load(Environment.CurrentDirectory, _iniName);

            ini.DefaultSection = _configSection;

            string ip             = ini.ReadValue(_ipIni);
            string port           = ini.ReadValue(_portIni);
            string updatePI_s     = ini.ReadValue(_updIntervalIni);
            string packSize_s     = ini.ReadValue(_mspSizeIni);
            string packInterval_s = ini.ReadValue(_mspIntervalIni);

            try
            {
                IPEndPoint endPoint = NetHelper.GetIPEndPoint(ip, port);
                if (endPoint != null)
                {
                    cfg.RemoteEndPoint = endPoint;
                }
            }
            catch (Exception ex) {  }

            int  updateinterval = 0;
            bool upi            = int.TryParse(updatePI_s, out updateinterval);

            if (upi)
            {
                cfg.PictureUpdateInterval = updateinterval;
            }

            int  packInt = 0;
            bool pi      = int.TryParse(packInterval_s, out packInt);

            if (pi)
            {
                cfg.SendPacketInterval = packInt;
            }

            int  packSize = 0;
            bool ps       = int.TryParse(packSize_s, out packSize);

            if (ps)
            {
                cfg.SendPacketSize = packSize;
            }

            return(cfg);
        }
Ejemplo n.º 3
0
        public SettingsForm(TeamPainterClientConfig config)
        {
            InitializeComponent();
            if (config == null)
            {
                this.DialogResult = DialogResult.Cancel;
            }

            _config = config;

            tbIP.Text             = _config.RemoteEndPoint.Address.ToString();
            tbPort.Text           = _config.RemoteEndPoint.Port.ToString();
            tbUpdInterval.Text    = _config.PictureUpdateInterval.ToString();
            tbPacketInterval.Text = _config.SendPacketInterval.ToString();
            tbPacketSize.Text     = _config.SendPacketSize.ToString();
        }