private List <AgentInfo> GetAgentsFromReader(IDataReader reader)
        {
            List <AgentInfo> agentInfoList = new List <AgentInfo>();
            AgentInfo        agentInfo1    = (AgentInfo)null;

            while (reader.Read())
            {
                OsType result1;
                if (!Enum.TryParse <OsType>(DatabaseFunctions.GetString(reader, "OSType"), true, out result1))
                {
                    result1 = (OsType)0;
                }
                AgentInfo agentInfo2 = new AgentInfo();
                agentInfo2.set_AgentId(DatabaseFunctions.GetInt32(reader, "AgentId"));
                agentInfo2.set_AgentGuid(DatabaseFunctions.GetGuid(reader, "AgentGuid"));
                agentInfo2.set_NodeID(DatabaseFunctions.GetNullableInt32(reader, "NodeId"));
                agentInfo2.set_NodeSubType(DatabaseFunctions.GetString(reader, "ObjectSubType", (string)null));
                agentInfo2.set_Uri(DatabaseFunctions.GetString(reader, "Uri"));
                agentInfo2.set_PollingEngineId(DatabaseFunctions.GetInt32(reader, "PollingEngineId"));
                agentInfo2.set_AgentStatus(DatabaseFunctions.GetInt32(reader, "AgentStatus"));
                agentInfo2.set_AgentStatusMessage(DatabaseFunctions.GetString(reader, "AgentStatusMessage"));
                agentInfo2.set_ConnectionStatus(DatabaseFunctions.GetInt32(reader, "ConnectionStatus"));
                agentInfo2.set_ConnectionStatusMessage(DatabaseFunctions.GetString(reader, "ConnectionStatusMessage"));
                agentInfo2.set_OsType(result1);
                agentInfo2.set_OsDistro(DatabaseFunctions.GetString(reader, "OSDistro"));
                AgentInfo agentInfo3 = agentInfo2;
                agentInfo3.set_Name(DatabaseFunctions.GetString(reader, "Name"));
                agentInfo3.set_HostName(DatabaseFunctions.GetString(reader, "HostName"));
                agentInfo3.set_IPAddress(DatabaseFunctions.GetString(reader, "IP"));
                Version result2;
                if (Version.TryParse(DatabaseFunctions.GetString(reader, "OSVersion"), out result2))
                {
                    agentInfo3.set_OsVersion(result2);
                }
                if (agentInfo1 == null || agentInfo1.get_AgentId() != agentInfo3.get_AgentId())
                {
                    agentInfoList.Add(agentInfo3);
                    agentInfo1 = agentInfo3;
                }
                AgentPluginInfo agentPluginInfo1 = new AgentPluginInfo();
                agentPluginInfo1.set_PluginId(DatabaseFunctions.GetString(reader, "PluginId", (string)null));
                AgentPluginInfo agentPluginInfo2 = agentPluginInfo1;
                if (agentPluginInfo2.get_PluginId() != null)
                {
                    agentPluginInfo2.set_Status(DatabaseFunctions.GetInt32(reader, "Status"));
                    agentPluginInfo2.set_StatusMessage(DatabaseFunctions.GetString(reader, "StatusMessage"));
                    agentInfo1.AddPlugin(agentPluginInfo2);
                }
            }
            return(agentInfoList);
        }
        // Token: 0x060006AE RID: 1710 RVA: 0x00029E60 File Offset: 0x00028060
        private List <AgentInfo> GetAgentsFromReader(IDataReader reader)
        {
            List <AgentInfo> list      = new List <AgentInfo>();
            AgentInfo        agentInfo = null;

            while (reader.Read())
            {
                OsType osType;
                if (!Enum.TryParse <OsType>(DatabaseFunctions.GetString(reader, "OSType"), true, out osType))
                {
                    osType = 0;
                }
                AgentInfo agentInfo2 = new AgentInfo
                {
                    AgentId                 = DatabaseFunctions.GetInt32(reader, "AgentId"),
                    AgentGuid               = DatabaseFunctions.GetGuid(reader, "AgentGuid"),
                    NodeID                  = DatabaseFunctions.GetNullableInt32(reader, "NodeId"),
                    NodeSubType             = DatabaseFunctions.GetString(reader, "ObjectSubType", null),
                    Uri                     = DatabaseFunctions.GetString(reader, "Uri"),
                    PollingEngineId         = DatabaseFunctions.GetInt32(reader, "PollingEngineId"),
                    AgentStatus             = DatabaseFunctions.GetInt32(reader, "AgentStatus"),
                    AgentStatusMessage      = DatabaseFunctions.GetString(reader, "AgentStatusMessage"),
                    ConnectionStatus        = DatabaseFunctions.GetInt32(reader, "ConnectionStatus"),
                    ConnectionStatusMessage = DatabaseFunctions.GetString(reader, "ConnectionStatusMessage"),
                    OsType                  = osType,
                    OsDistro                = DatabaseFunctions.GetString(reader, "OSDistro")
                };
                agentInfo2.Name      = DatabaseFunctions.GetString(reader, "Name");
                agentInfo2.HostName  = DatabaseFunctions.GetString(reader, "HostName");
                agentInfo2.IPAddress = DatabaseFunctions.GetString(reader, "IP");
                if (agentInfo == null || agentInfo.AgentId != agentInfo2.AgentId)
                {
                    list.Add(agentInfo2);
                    agentInfo = agentInfo2;
                }
                AgentPluginInfo agentPluginInfo = new AgentPluginInfo
                {
                    PluginId = DatabaseFunctions.GetString(reader, "PluginId", null)
                };
                if (agentPluginInfo.PluginId != null)
                {
                    agentPluginInfo.Status        = DatabaseFunctions.GetInt32(reader, "Status");
                    agentPluginInfo.StatusMessage = DatabaseFunctions.GetString(reader, "StatusMessage");
                    agentInfo.AddPlugin(agentPluginInfo);
                }
            }
            return(list);
        }