Exemplo n.º 1
0
        public System.Collections.Generic.Dictionary <string, bool> SetDeviceThresholds(System.Collections.Generic.List <DevSnmpConfig> configs, DeviceThreshold deviceThreshold)
        {
            DevAccessCfg instance = DevAccessCfg.GetInstance();

            System.Collections.Generic.List <SnmpConfiger> list = new System.Collections.Generic.List <SnmpConfiger>();
            foreach (DevSnmpConfig current in configs)
            {
                DevModelConfig deviceModelConfig = instance.getDeviceModelConfig(current.modelName, current.fmwareVer);
                SnmpConfiger   item = new SnmpConfiger(instance.getSnmpConfig(current), deviceModelConfig, current.devMac, current.devID);
                list.Add(item);
            }
            System.Collections.Generic.List <string>             list2      = new AppSnmpExecutors(list).SetDevThresholds(deviceThreshold);
            System.Collections.Generic.Dictionary <string, bool> dictionary = new System.Collections.Generic.Dictionary <string, bool>();
            foreach (string current2 in list2)
            {
                string[] array = current2.Split(new char[]
                {
                    ':'
                });
                dictionary.Add(array[0], System.Convert.ToBoolean(array[1]));
            }
            return(dictionary);
        }
Exemplo n.º 2
0
        private void filteronlinedev()
        {
            this.dgvFwDevice.Rows.Clear();
            this.cbsel.Checked = true;
            string text  = null;
            string strB  = null;
            string text2 = null;
            string text3 = "";
            string text4 = "";

            if (this.tbFileNm.Text.Length > 0)
            {
                System.IO.FileInfo fileInfo = new System.IO.FileInfo(this.tbFileNm.Text);
                text  = fileInfo.Name.ToUpper();
                text2 = fileInfo.Extension;
                if (text2 != null)
                {
                    text2 = text2.ToUpper();
                }
                strB = this.getDevFWflg(this.tbFileNm.Text, ref text3, ref text4);
            }
            DevAccessCfg instance = DevAccessCfg.GetInstance();

            if (text4.Length == 0)
            {
                using (System.Collections.Generic.List <string[]> .Enumerator enumerator = this.m_allRows.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        string[] current = enumerator.Current;
                        string   text5   = current[6];
                        string   text6   = current[7];
                        string   text7   = current[4];
                        if (text != null)
                        {
                            DevModelConfig deviceModelConfig = instance.getDeviceModelConfig(current[3], text7);
                            if (deviceModelConfig.FWvalidate != 0)
                            {
                                if ((deviceModelConfig.FWnms.Length > 0 && !text.StartsWith(deviceModelConfig.FWnms)) || (deviceModelConfig.FWext.Length > 0 && (text2 == null || !text2.Equals(deviceModelConfig.FWext))))
                                {
                                    continue;
                                }
                                switch (deviceModelConfig.FWvalidate)
                                {
                                case 1:
                                    if (!text3.Equals("ATEN") || (this.cbMainFw.Checked && text7.CompareTo(strB) >= 0))
                                    {
                                        continue;
                                    }
                                    break;
                                }
                            }
                        }
                        string[] obj = new string[]
                        {
                            "1",
                            current[1],
                            current[2],
                            current[3],
                            text7,
                            current[5],
                            text5,
                            text6
                        };
                        ControlAccess.ConfigControl config = delegate(Control control, object param)
                        {
                            DataGridView dataGridView = control as DataGridView;
                            string[]     array2       = param as string[];
                            dataGridView.Rows.Add(new object[]
                            {
                                true,
                                array2[1],
                                array2[2],
                                array2[3],
                                array2[4],
                                array2[5],
                                array2[6],
                                array2[7]
                            });
                        };
                        ControlAccess controlAccess = new ControlAccess(this, config);
                        controlAccess.Access(this.dgvFwDevice, obj);
                    }
                    goto IL_37E;
                }
            }
            string[] array = text4.Split(new char[]
            {
                '/'
            });
            foreach (string[] current2 in this.m_allRows)
            {
                string text5 = current2[6];
                string text6 = current2[7];
                string text7 = current2[4];
                if (text != null)
                {
                    bool flag = false;
                    for (int i = 0; i < array.Length; i++)
                    {
                        string text8 = array[i];
                        int    num   = text8.IndexOf("*");
                        if (num >= 0)
                        {
                            text8 = text8.Substring(0, num);
                            if (current2[3].IndexOf(text8) >= 0)
                            {
                                flag = true;
                                break;
                            }
                        }
                        else
                        {
                            if (current2[3].Equals(array[i]))
                            {
                                flag = true;
                                break;
                            }
                        }
                    }
                    if (!flag || (this.cbMainFw.Checked && text7.CompareTo(strB) >= 0))
                    {
                        continue;
                    }
                }
                string[] obj2 = new string[]
                {
                    "1",
                    current2[1],
                    current2[2],
                    current2[3],
                    text7,
                    current2[5],
                    text5,
                    text6
                };
                ControlAccess.ConfigControl config2 = delegate(Control control, object param)
                {
                    DataGridView dataGridView = control as DataGridView;
                    string[]     array2       = param as string[];
                    dataGridView.Rows.Add(new object[]
                    {
                        true,
                        array2[1],
                        array2[2],
                        array2[3],
                        array2[4],
                        array2[5],
                        array2[6],
                        array2[7]
                    });
                };
                ControlAccess controlAccess2 = new ControlAccess(this, config2);
                controlAccess2.Access(this.dgvFwDevice, obj2);
            }
            IL_37E :
            ControlAccess.ConfigControl config3 = delegate(Control control, object param)
            {
                this.cbMainFw.Enabled  = true;
                this.butBrowse.Enabled = true;
                this.butUpdate.Enabled = true;
                this.cbsel.Enabled     = true;
            };
            ControlAccess controlAccess3 = new ControlAccess(this, config3);

            controlAccess3.Access(this.dgvFwDevice, null);
        }