Пример #1
0
        public static ServerListItem Parse(CommandParameterGroup currentParameterGroup, CommandParameterGroup firstParameterGroup)
        {
            if (currentParameterGroup == null)
            {
                throw new ArgumentNullException("currentParameterGroup");
            }

            string statusString        = currentParameterGroup.GetParameterValue("virtualserver_status");
            VirtualServerStatus status = VirtualServerStatusHelper.Parse(statusString);
            uint?uptime = currentParameterGroup.GetParameterValue <uint?>("virtualserver_uptime");

            return(new ServerListItem
            {
                UniqueId = currentParameterGroup.GetParameterValue("virtualserver_unique_identifier"),
                ServerId = currentParameterGroup.GetParameterValue <uint>("virtualserver_id"),
                ServerPort = currentParameterGroup.GetParameterValue <ushort>("virtualserver_port"),
                ServerStatus = status,
                ServerNumberOfClientsOnline = currentParameterGroup.GetParameterValue <uint?>("virtualserver_clientsonline"),
                ServerNumberOfQueryClientsOnline = currentParameterGroup.GetParameterValue <uint?>("virtualserver_queryclientsonline"),
                ServerMaximumClientsAllowed = currentParameterGroup.GetParameterValue <uint?>("virtualserver_maxclients"),
                ServerUptime = uptime.HasValue ? (TimeSpan?)TimeSpan.FromSeconds(uptime.Value) : null,
                ServerName = currentParameterGroup.GetParameterValue("virtualserver_name"),
                ServerAutoStart = currentParameterGroup.GetParameterValue("virtualserver_autostart") == "1",
                ServerMachineId = currentParameterGroup.GetParameterValue("virtualserver_machine_id"),
            });
        }
        public static ServerListItemBase Parse(CommandParameterGroup currentParameterGroup, CommandParameterGroup firstParameterGroup)
        {
            if (currentParameterGroup == null)
            {
                throw new ArgumentNullException("currentParameterGroup");
            }

            string statusString        = currentParameterGroup.GetParameterValue("virtualserver_status");
            VirtualServerStatus status = VirtualServerStatusHelper.Parse(statusString);

            return(new ServerListItemBase
            {
                ServerId = currentParameterGroup.GetParameterValue <uint>("virtualserver_id"),
                ServerPort = currentParameterGroup.GetParameterValue <ushort>("virtualserver_port"),
                ServerStatus = status,
            });
        }