Exemplo n.º 1
0
 private void ReportPending(string strSuccessList, string failedList)
 {
     char[] separator = new char[]
     {
         ';'
     };
     string[] array = strSuccessList.Split(separator, System.StringSplitOptions.RemoveEmptyEntries);
     System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
     string[] array2 = array;
     for (int i = 0; i < array2.Length; i++)
     {
         string text = array2[i];
         if (!string.IsNullOrEmpty(text))
         {
             if (stringBuilder.Length + text.Length + 1 > 65023)
             {
                 if (DevAccessAPI.cbOnDeviceChanged != null && stringBuilder.Length > 0)
                 {
                     DevAccessAPI.cbOnDeviceChanged("pending more", stringBuilder.ToString());
                 }
                 stringBuilder = new System.Text.StringBuilder();
             }
             if (stringBuilder.Length > 0)
             {
                 stringBuilder.Append(";");
             }
             stringBuilder.Append(text);
         }
     }
     if (stringBuilder.Length > 0 && DevAccessAPI.cbOnDeviceChanged != null)
     {
         DevAccessAPI.cbOnDeviceChanged("pending", stringBuilder.ToString());
     }
 }
Exemplo n.º 2
0
        public bool RebootOutlet(int outletIndex)
        {
            bool result = this.se.RebootOutlet(outletIndex);

            if (DevAccessAPI.cbOnDeviceChanged != null)
            {
                DevAccessAPI.cbOnDeviceChanged("pending", this.snmpCfg.devID + ":" + outletIndex);
            }
            return(result);
        }
Exemplo n.º 3
0
        public bool TurnOnAllOutlets()
        {
            bool result = this.se.TurnOnOutlets();

            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            for (int i = 1; i <= this.mc.portNum; i++)
            {
                if (this.mc.isOutletSwitchable(i - 1))
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.Append(",");
                    }
                    stringBuilder.Append(i.ToString());
                }
            }
            if (DevAccessAPI.cbOnDeviceChanged != null)
            {
                DevAccessAPI.cbOnDeviceChanged("pending", this.snmpCfg.devID + ":" + stringBuilder.ToString());
            }
            return(result);
        }
Exemplo n.º 4
0
        public bool RebootBank_Slave(int bankIndex)
        {
            bool result = this.se.RebootBank(bankIndex);

            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            for (int i = this.mc.bankOutlets[bankIndex - 1].fromPort; i <= this.mc.bankOutlets[bankIndex - 1].toPort; i++)
            {
                if (this.mc.isOutletSwitchable(i - 1))
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.Append(",");
                    }
                    stringBuilder.Append(i.ToString());
                }
            }
            if (DevAccessAPI.cbOnDeviceChanged != null)
            {
                DevAccessAPI.cbOnDeviceChanged("pending", this.snmpCfg.devID + ":" + stringBuilder.ToString());
            }
            return(result);
        }
Exemplo n.º 5
0
        public bool RebootGroupOutlets_Slave(System.Collections.Generic.List <int> outlets)
        {
            bool result = this.se.RebootGroupOutlets(outlets);

            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            foreach (int current in outlets)
            {
                if (this.mc.isOutletSwitchable(current - 1))
                {
                    if (stringBuilder.Length > 0)
                    {
                        stringBuilder.Append(",");
                    }
                    stringBuilder.Append(current.ToString());
                }
            }
            if (DevAccessAPI.cbOnDeviceChanged != null)
            {
                DevAccessAPI.cbOnDeviceChanged("pending", this.snmpCfg.devID + ":" + stringBuilder.ToString());
            }
            return(result);
        }