Ejemplo n.º 1
0
        private static NetStatInfo ParseNetStatItem(XmlElement element)
        {
            var processIdElement      = element.GetElementsByTagName("processId").Item(0);
            var processNameElement    = element.GetElementsByTagName("processName").Item(0);
            var protocolTypeElement   = element.GetElementsByTagName("protocolType").Item(0);
            var stateElement          = element.GetElementsByTagName("state").Item(0);
            var localEndpointElement  = element.GetElementsByTagName("localEndPoint").Item(0) as XmlElement;
            var remoteEndpointElement = element.GetElementsByTagName("remoteEndPoint").Item(0) as XmlElement;

            var processName    = processNameElement.InnerText;
            var processId      = processIdElement.InnerText;
            var protocolType   = protocolTypeElement.InnerText;
            var state          = stateElement.InnerText;
            var localEndpoint  = ParseEndpoint(localEndpointElement);
            var remoteEndpoint = ParseEndpoint(remoteEndpointElement);

            var result = new NetStatInfo
            {
                ProcessId      = processId,
                ProcessName    = processName,
                ProtocolType   = protocolType,
                State          = state,
                LocalEndpoint  = localEndpoint,
                RemoteEndpoint = remoteEndpoint
            };

            return(result);
        }
Ejemplo n.º 2
0
 public ViewModelItem(NetStatInfo netStatInfo)
 {
     _netStatInfo = netStatInfo;
 }