Esempio n. 1
0
 public void pageInit()
 {
     if (Sys_Para.GetBPFlag() == 0)
     {
         this.cbEnableBP.Checked      = false;
         this.tbBPlistenport.Enabled  = false;
         this.tbBPlistenport.Text     = System.Convert.ToString(Sys_Para.GetBPPort());
         this.tbBPsecuritystr.Enabled = false;
         this.tbBPsecuritystr.Text    = Sys_Para.GetBPSecurity();
     }
     else
     {
         this.cbEnableBP.Checked      = true;
         this.tbBPlistenport.Enabled  = true;
         this.tbBPlistenport.Text     = System.Convert.ToString(Sys_Para.GetBPPort());
         this.tbBPsecuritystr.Enabled = true;
         this.tbBPsecuritystr.Text    = Sys_Para.GetBPSecurity();
     }
     this.lbManagerPort.Hide();
     this.tbManagerPort.Hide();
 }
Esempio n. 2
0
        private void btnsavePort_Click(object sender, System.EventArgs e)
        {
            if (!this.tbManagerPort.Visible)
            {
                int num  = 0;
                int num2 = 0;
                int num3 = 0;
                if (this.tbTrapPort.Visible)
                {
                    if (!this.portparacheck(this.lbTrapPort, this.tbTrapPort, 1))
                    {
                        return;
                    }
                    num = System.Convert.ToInt32(this.tbTrapPort.Text);
                }
                if (this.tbBillingPort.Visible)
                {
                    if (!this.portparacheck(this.lbBillingPort, this.tbBillingPort, 3))
                    {
                        return;
                    }
                    num2 = System.Convert.ToInt32(this.tbBillingPort.Text);
                    if (num2 == num)
                    {
                        this.tbBillingPort.Focus();
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[]
                        {
                            this.tbBillingPort.Text
                        }));
                        return;
                    }
                }
                if (this.tbGatewayPort.Visible)
                {
                    if (!this.portparacheck(this.lbGatewayPort, this.tbGatewayPort, 2))
                    {
                        return;
                    }
                    num3 = System.Convert.ToInt32(this.tbGatewayPort.Text);
                    if (num3 == num || num3 == num2)
                    {
                        this.tbGatewayPort.Focus();
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[]
                        {
                            this.tbGatewayPort.Text
                        }));
                        return;
                    }
                }
                if (this.tbTrapPort.Visible)
                {
                    new Sys_Para
                    {
                        TrapPort = num
                    }.update();
                    string valuePair = ValuePairs.getValuePair("Username");
                    if (!string.IsNullOrEmpty(valuePair))
                    {
                        LogAPI.writeEventLog("0130022", new string[]
                        {
                            valuePair
                        });
                    }
                    else
                    {
                        LogAPI.writeEventLog("0130022", new string[0]);
                    }
                }
                if (this.tbBillingPort.Visible)
                {
                    Sys_Para.SetBPPort(num2);
                    InSnergyService.RestartBillingProtocol(Sys_Para.GetBPFlag() == 1, num2, Sys_Para.GetBPSecurity());
                }
                if (this.tbGatewayPort.Visible)
                {
                    Sys_Para.SetISGPort(num3);
                    if (Sys_Para.GetISGFlag() == 0)
                    {
                        InSnergyService.Restart(false, num3);
                    }
                    else
                    {
                        InSnergyService.Restart(true, num3);
                    }
                }
                base.DialogResult = DialogResult.OK;
                return;
            }
            if (!this.portparacheck(this.lbManagerPort, this.tbManagerPort, 0))
            {
                return;
            }
            int value = System.Convert.ToInt32(this.tbManagerPort.Text);

            ValuePairs.setValuePair("ServicePort", System.Convert.ToString(value));
            ValuePairs.SaveValueKeyToRegistry(true);
            base.DialogResult = DialogResult.OK;
        }
Esempio n. 3
0
        private void butSysparaSave_Click(object sender, System.EventArgs e)
        {
            int    bPFlag     = Sys_Para.GetBPFlag();
            int    num        = 0;
            int    bPPort     = Sys_Para.GetBPPort();
            int    num2       = bPPort;
            string bPSecurity = Sys_Para.GetBPSecurity();
            string text       = Sys_Para.GetBPSecurity();
            bool   flag       = false;

            if (this.cbEnableBP.Checked)
            {
                num = 1;
                Ecovalidate.checkTextIsNull(this.tbBPlistenport, ref flag);
                if (flag)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                    {
                        this.lbBPlistenPort.Text
                    }));
                    return;
                }
                if (!Ecovalidate.Rangeint(this.tbBPlistenport, 1, 65535))
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Range, new string[]
                    {
                        this.lbBPlistenPort.Text,
                        "1",
                        "65535"
                    }));
                    return;
                }
                num2 = System.Convert.ToInt32(this.tbBPlistenport.Text);
                if (bPPort != num2)
                {
                    bool flag2 = NetworkShareAccesser.TcpPortInUse(num2);
                    if (flag2)
                    {
                        this.tbBPlistenport.Focus();
                        EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Portconflict, new string[]
                        {
                            this.tbBPlistenport.Text
                        }));
                        return;
                    }
                }
                Ecovalidate.checkTextIsNull(this.tbBPsecuritystr, ref flag);
                if (flag)
                {
                    EcoMessageBox.ShowError(EcoLanguage.getMsg(LangRes.Required, new string[]
                    {
                        this.lbBPsecuritystr.Text
                    }));
                    return;
                }
                text = this.tbBPsecuritystr.Text;
            }
            if (bPFlag != num || bPPort != num2 || !bPSecurity.Equals(text))
            {
                Sys_Para.SetBPFlag(num);
                Sys_Para.SetBPPort(num2);
                Sys_Para.SetBPSecurity(text);
                InSnergyService.RestartBillingProtocol(num == 1, num2, text);
            }
            EcoMessageBox.ShowInfo(EcoLanguage.getMsg(LangRes.OPsucc, new string[0]));
        }