// Token: 0x060006E4 RID: 1764 RVA: 0x0002BC68 File Offset: 0x00029E68
        public OidEnums GetEnums(string enumName)
        {
            OidEnums oidEnums = new OidEnums();

            if (string.IsNullOrEmpty(enumName))
            {
                return(oidEnums);
            }
            using (OleDbConnection dbconnection = MibHelper.GetDBConnection())
            {
                dbconnection.Open();
                using (OleDbCommand oleDbCommand = new OleDbCommand())
                {
                    oleDbCommand.CommandText = string.Format("Select {0} from Enums WHERE Name=@name order by Value;", "Name, Value, Enum");
                    oleDbCommand.Parameters.AddWithValue("name", enumName);
                    using (IDataReader dataReader = OleDbHelper.ExecuteReader(oleDbCommand, dbconnection))
                    {
                        while (dataReader.Read())
                        {
                            oidEnums.Add(new OidEnum
                            {
                                Id   = DatabaseFunctions.GetDouble(dataReader, 1).ToString(),
                                Name = DatabaseFunctions.GetString(dataReader, 2)
                            });
                        }
                    }
                }
            }
            return(oidEnums);
        }
        // Token: 0x060006E1 RID: 1761 RVA: 0x0002BA34 File Offset: 0x00029C34
        public Dictionary <string, MemoryStream> GetIcons()
        {
            byte[] buffer = new byte[0];
            Dictionary <string, MemoryStream> dictionary = new Dictionary <string, MemoryStream>();

            using (OleDbConnection dbconnection = MibHelper.GetDBConnection())
            {
                using (OleDbCommand oleDbCommand = new OleDbCommand())
                {
                    dbconnection.Open();
                    oleDbCommand.CommandText = "Select OID, [Small Icon] From Icons";
                    using (IDataReader dataReader = OleDbHelper.ExecuteReader(oleDbCommand, dbconnection))
                    {
                        while (dataReader.Read())
                        {
                            if (!(dataReader["Small Icon"] is DBNull))
                            {
                                buffer = (byte[])dataReader["Small Icon"];
                                dictionary.Add(dataReader["OID"].ToString(), new MemoryStream(buffer, true));
                            }
                        }
                    }
                }
            }
            return(dictionary);
        }
Example #3
0
        public Oids GetSearchingOidsByName(string searchCriteria)
        {
            List <string> stringList = new List <string>();
            Oids          oids       = new Oids();

            using (OleDbConnection connection = MibHelper.GetDBConnection())
            {
                connection.Open();
                MibDAL.CancellationTokenSource = new CancellationTokenSource();
                using (OleDbCommand oleDbCommand = new OleDbCommand())
                {
                    oleDbCommand.CommandText = string.Format("SELECT TOP 250 {0} FROM Tree WHERE (Primary = -1) AND ( Name LIKE @SearchValue OR Description LIKE '%' + @SearchValue + '%' OR Mib LIKE @SearchValue)", (object)"Index, MIB, Name, Primary, OID, Description, Access, Status, Units, Enum, TypeS");
                    oleDbCommand.Parameters.AddWithValue("@SearchValue", (object)searchCriteria);
                    using (IDataReader reader = OleDbHelper.ExecuteReader(oleDbCommand, connection))
                    {
                        using (IEnumerator <Oid> enumerator = ((Collection <string, Oid>)Task.Factory.StartNew <Oids>((Func <Oids>)(() => this.getOidsFromReader(reader, connection)), MibDAL.CancellationTokenSource.Token).Result).GetEnumerator())
                        {
                            while (((IEnumerator)enumerator).MoveNext())
                            {
                                Oid current = enumerator.Current;
                                ((Collection <string, Oid>)oids).Add((object)current);
                            }
                        }
                    }
                }
            }
            return(oids);
        }
Example #4
0
        public OidEnums GetEnums(string enumName)
        {
            OidEnums oidEnums = new OidEnums();

            if (string.IsNullOrEmpty(enumName))
            {
                return(oidEnums);
            }
            using (OleDbConnection dbConnection = MibHelper.GetDBConnection())
            {
                dbConnection.Open();
                using (OleDbCommand oleDbCommand = new OleDbCommand())
                {
                    oleDbCommand.CommandText = string.Format("Select {0} from Enums WHERE Name=@name order by Value;", (object)"Name, Value, Enum");
                    oleDbCommand.Parameters.AddWithValue("name", (object)enumName);
                    using (IDataReader dataReader = OleDbHelper.ExecuteReader(oleDbCommand, dbConnection))
                    {
                        while (dataReader.Read())
                        {
                            OidEnum oidEnum = new OidEnum();
                            oidEnum.set_Id(DatabaseFunctions.GetDouble(dataReader, 1).ToString());
                            oidEnum.set_Name(DatabaseFunctions.GetString(dataReader, 2));
                            ((Collection <string, OidEnum>)oidEnums).Add((object)oidEnum);
                        }
                    }
                }
            }
            return(oidEnums);
        }
Example #5
0
 private Oid GetOid(string oid, bool clean)
 {
     using (OleDbConnection dbConnection = MibHelper.GetDBConnection())
     {
         dbConnection.Open();
         return(this.GetOid(oid, dbConnection, clean));
     }
 }
        // Token: 0x060006DE RID: 1758 RVA: 0x0002B94C File Offset: 0x00029B4C
        private Oid GetOid(string oid, bool clean)
        {
            Oid oid2;

            using (OleDbConnection dbconnection = MibHelper.GetDBConnection())
            {
                dbconnection.Open();
                oid2 = this.GetOid(oid, dbconnection, clean);
            }
            return(oid2);
        }
Example #7
0
        public Oids GetChildOids(string parentOid)
        {
            List <string> uniqueChildOids = this.GetUniqueChildOids(parentOid);
            Oids          oids            = new Oids();

            using (OleDbConnection dbConnection = MibHelper.GetDBConnection())
            {
                dbConnection.Open();
                foreach (string oid1 in uniqueChildOids)
                {
                    Oid oid2 = this.GetOid(oid1, dbConnection, true) ?? this.GetOid(oid1, dbConnection, false);
                    ((Collection <string, Oid>)oids).Add((object)oid2);
                }
            }
            return(oids);
        }
        // Token: 0x060006E2 RID: 1762 RVA: 0x0002BB10 File Offset: 0x00029D10
        public Oids GetChildOids(string parentOid)
        {
            List <string> uniqueChildOids = this.GetUniqueChildOids(parentOid);
            Oids          oids            = new Oids();

            using (OleDbConnection dbconnection = MibHelper.GetDBConnection())
            {
                dbconnection.Open();
                foreach (string oid in uniqueChildOids)
                {
                    Oid oid2 = this.GetOid(oid, dbconnection, true);
                    if (oid2 == null)
                    {
                        oid2 = this.GetOid(oid, dbconnection, false);
                    }
                    oids.Add(oid2);
                }
            }
            return(oids);
        }
        // Token: 0x060006E3 RID: 1763 RVA: 0x0002BBB0 File Offset: 0x00029DB0
        public List <string> GetUniqueChildOids(string parentOid)
        {
            List <string> list = new List <string>();

            using (OleDbConnection dbconnection = MibHelper.GetDBConnection())
            {
                dbconnection.Open();
                using (OleDbCommand oleDbCommand = new OleDbCommand())
                {
                    oleDbCommand.CommandText = string.Format("Select DISTINCT Name, OID, Index from Tree WHERE Primary = -1 AND ParentOID=@parentOid order by index;", "Index, MIB, Name, Primary, OID, Description, Access, Status, Units, Enum, TypeS");
                    oleDbCommand.Parameters.AddWithValue("parentOid", parentOid);
                    using (IDataReader dataReader = OleDbHelper.ExecuteReader(oleDbCommand, dbconnection))
                    {
                        while (dataReader.Read())
                        {
                            list.Add(DatabaseFunctions.GetString(dataReader, "OID"));
                        }
                    }
                }
            }
            return(list);
        }
        // Token: 0x060006E7 RID: 1767 RVA: 0x0002BD84 File Offset: 0x00029F84
        public Oids GetSearchingOidsByName(string searchCriteria)
        {
            new List <string>();
            Oids oids = new Oids();

            using (OleDbConnection connection = MibHelper.GetDBConnection())
            {
                connection.Open();
                MibDAL.CancellationTokenSource = new CancellationTokenSource();
                using (OleDbCommand oleDbCommand = new OleDbCommand())
                {
                    oleDbCommand.CommandText = string.Format("SELECT TOP 250 {0} FROM Tree WHERE (Primary = -1) AND ( Name LIKE @SearchValue OR Description LIKE '%' + @SearchValue + '%' OR Mib LIKE @SearchValue)", "Index, MIB, Name, Primary, OID, Description, Access, Status, Units, Enum, TypeS");
                    oleDbCommand.Parameters.AddWithValue("@SearchValue", searchCriteria);
                    using (IDataReader reader = OleDbHelper.ExecuteReader(oleDbCommand, connection))
                    {
                        foreach (Oid value in Task.Factory.StartNew <Oids>(() => this.getOidsFromReader(reader, connection), MibDAL.CancellationTokenSource.Token).Result)
                        {
                            oids.Add(value);
                        }
                    }
                }
            }
            return(oids);
        }