Пример #1
0
        /// <summary>
        /// Get the Local Computers Name and Description
        /// </summary>
        /// <returns>LocalComputer</returns>
        public LocalComputer GetLocalComputer()
        {
            API_Response apiresponse = GetAPIResponse("/localComputer", Connect.Method.GET);

            if (apiresponse.StatusCode == 200)
            {
                LocalComputer localcomputer = JSON.Deserialize <LocalComputer>(apiresponse.Response);
                if (localcomputer != null)
                {
                    return(localcomputer);
                }
            }

            return(null);
        }
Пример #2
0
        /// <summary>
        /// Returns a Full Channel list including their details.
        /// </summary>
        /// <returns>A list with all Channel ID and Detials combind</returns>
        public List <ChannelDetail> GetChannelDetails()
        {
            List <Channel> channels = GetChannels();

            if (channels != null)
            {
                List <ChannelDetail> channeldetails = new List <ChannelDetail>();

                LocalComputer localcomputer = GetLocalComputer();
                if (localcomputer != null)
                {
                    NodeInfo localnode = new NodeInfo();
                    localnode.Name        = localcomputer.Name;
                    localnode.Description = localcomputer.Description;

                    if (channels.Count > 0)
                    {
                        NodeInfo thisnode = GetNode(channels[0].NodeUuID);
                        localnode.Active       = thisnode.Active;
                        localnode.MacAddress   = thisnode.MacAddress;
                        localnode.SerialNumber = thisnode.SerialNumber;
                        localnode.Type         = thisnode.Type;
                        localnode.Uuid         = thisnode.Uuid;
                    }

                    ChannelDetail localchannel = new ChannelDetail();
                    localchannel.Id   = 0;
                    localchannel.Node = localnode;
                    channeldetails.Add(localchannel);
                }

                for (int i = 1; i < channels.Count; i++)
                {
                    NodeInfo node = GetNode(channels[i].NodeUuID);
                    if (node != null)
                    {
                        ChannelDetail channeldetail = new ChannelDetail();
                        channeldetail.Id   = channels[i].Id;
                        channeldetail.Node = node;
                        channeldetails.Add(channeldetail);
                    }
                }

                return(channeldetails);
            }

            return(null);
        }