Exemple #1
0
        public void send(int msg)
        {
            BroadcastModel.log.Trace("send " + msg);
            this.message = msg;
            byte type = 0;

            switch (ConfigureUtil.getClientType())
            {
            case ClientType.TYPE_A:
                type = 1;
                break;

            case ClientType.TYPE_B:
                type = 2;
                break;

            case ClientType.TYPE_C:
                type = 3;
                break;

            case ClientType.TYPE_D:
                type = 4;
                break;
            }
            byte[] data = new byte[]
            {
                type
            };
            this.send(this.MESSAGE, this.appendData(data, msg));
        }
Exemple #2
0
        private void heartbeatThreadStart()
        {
            BroadcastModel.log.Trace("heartbeatThreadStart ");
            while (this.broadcastSocket != null)
            {
                byte type = 0;
                switch (ConfigureUtil.getClientType())
                {
                case ClientType.TYPE_A:
                    type = 1;
                    break;

                case ClientType.TYPE_B:
                    type = 2;
                    break;

                case ClientType.TYPE_C:
                    type = 3;
                    break;

                case ClientType.TYPE_D:
                    type = 4;
                    break;
                }
                byte[] data = new byte[]
                {
                    type
                };
                this.send(this.HEARTBEAT, data);
                Thread.Sleep(1000);
            }
        }
Exemple #3
0
 public static string AdapterIP()
 {
     if (string.IsNullOrEmpty(ConfigureUtil.adapter_ip))
     {
         ConfigureUtil.readIPFromConfigurationFile();
     }
     return(ConfigureUtil.adapter_ip);
 }
Exemple #4
0
 public ControlCheckWindow()
 {
     ControlCheckWindow.log.Trace("ControlCheckWindow");
     this.InitializeComponent();
     ControlCheckWindow.log.Trace("after ControlCheckWindow");
     this.connectModel = new ConnectModel(this);
     this.connectModel.setConnectStatusCallback(this);
     this.OnWirelessFinishListener = new ControlCheckWindow.OnWirelessFinishDelegate(this.OnWirelessFinish);
     this.socketModel = new SocketModel(this);
     this.addSocketCallback();
     this.initView();
     ControlCheckWindow.log.Trace("ip == " + ConfigureUtil.AdapterIP());
     ControlCheckWindow.log.Trace("type = " + ConfigureUtil.getClientType());
 }
Exemple #5
0
        public static ClientType getClientType()
        {
            if (!ConfigureUtil.currentType.Equals(ClientType.NONE))
            {
                return(ConfigureUtil.currentType);
            }
            string ip = ConfigureUtil.AdapterIP();

            if (!string.IsNullOrEmpty(ip))
            {
                string[] ipSplit = ip.Split(new string[]
                {
                    "."
                }, StringSplitOptions.None);
                if (ipSplit != null && ipSplit.Count <string>() > 3)
                {
                    string ipType = ipSplit[3];
                    if (ipType == "88")
                    {
                        ConfigureUtil.currentType = ClientType.TYPE_A;
                        return(ClientType.TYPE_A);
                    }
                    if (ipType == "90")
                    {
                        ConfigureUtil.currentType = ClientType.TYPE_B;
                        return(ClientType.TYPE_B);
                    }
                    if (ipType == "92")
                    {
                        ConfigureUtil.currentType = ClientType.TYPE_C;
                        return(ClientType.TYPE_C);
                    }
                    if (ipType == "94")
                    {
                        ConfigureUtil.currentType = ClientType.TYPE_D;
                        return(ClientType.TYPE_D);
                    }
                }
            }
            ConfigureUtil.currentType = ClientType.TYPE_A;
            return(ClientType.TYPE_A);
        }
Exemple #6
0
 public MainForm()
 {
     this.InitializeComponent();
     Util.Init(this);
     ConfigureUtil.init(this);
     Client.init(this);
     NetworkUtil.Init(this);
     LoopCheckModel.Init(this);
     ThreadPool.RegisterWaitForSingleObject(Program.ProgramStarted, new WaitOrTimerCallback(this.OnProgramStarted), null, -1, false);
     this.appLabel.Text            = Resources.titleText;
     this.backgroundImage.SizeMode = PictureBoxSizeMode.StretchImage;
     this.backgroundImagePanel.BringToFront();
     System.Timers.Timer expr_79 = new System.Timers.Timer(2000.0);
     expr_79.Elapsed           += new ElapsedEventHandler(this.dismissBackgroundImage);
     expr_79.AutoReset          = false;
     expr_79.Enabled            = true;
     this.OnTimerFinishListener = new MainForm.OnTimerFinishDelegate(this.OnTimerFinish);
     LoopCheckModel.setConnectLoopInterruptCallback(this);
     this.OnRecommendedUpdateClick = new BaseForm.OnRecommendedUpdateClickDelegate(this.recommendedUpdateClick);
     this.OnUpdateDialogClose      = new BaseForm.OnUpdateDialogCloseDelegate(this.updateDialogClose);
     this.OnNetworkDialogBackClick = new BaseForm.OnNetworkDialogBackClickDelegate(this.ShowControlCheckWindow);
     this.ShowControlCheckWindow();
 }
Exemple #7
0
 public static void init(Control context)
 {
     ConfigureUtil.sContext = context;
     ConfigureUtil.readIPFromConfigurationFile();
 }