コード例 #1
0
 private void FireNodeRemovingEvent(LocalNodeInfo node)
 {
     try
     {
         var info = new LocalNodeUpdateEventArgs()
         {
             nodeInfo = node, PCinfos = new List <SSDPPCInfo>()
         };
         OnNodeUpdate?.Invoke(this, info);
     }
     catch (Exception exception)
     {
         logger.LogError(exception, $"Error getting info for node: {node.Url}");
     }
 }
コード例 #2
0
        private async Task OnNewNodeDiscovered(LocalNodeInfo node, HttpResponseMessage req)
        {
            var res = JsonConvert.DeserializeObject <List <SSDPPCInfo> >(await req.Content.ReadAsStringAsync().ConfigureAwait(false));

            if (res == null)
            {
                res = new List <SSDPPCInfo>();
            }
            try
            {
                node.PcIds = res.Select(x => x.Id).ToList();
                var info = new LocalNodeUpdateEventArgs()
                {
                    nodeInfo = node, PCinfos = res
                };
                OnNodeUpdate?.Invoke(this, info);
            }
            catch (Exception exception)
            {
                logger.LogError(exception, $"Error getting info for node: {node.Url}");
            }

            SyncSharePCs(node, res);
        }