void OnInfo(AMCPParserEventArgs e) { List <ChannelInfo> channelInfo = new List <ChannelInfo>(); foreach (string channelData in e.Data) { string[] data = channelData.Split(' '); int id = Int32.Parse(data[0]); // VideoMode vm = (VideoMode)Enum.Parse(typeof(VideoMode), data[1]); // ChannelStatus cs = (ChannelStatus)Enum.Parse(typeof(ChannelStatus), data[2]); channelInfo.Add(new ChannelInfo(id, VideoMode.Unknown, ChannelStatus.Stopped, "")); } device_.OnUpdatedChannelInfo(channelInfo); }
void OnInfo(AMCPParserEventArgs e) { ACMPInfoKind infoKind; if (Enum.TryParse(e.Subcommand, out infoKind)) { switch (infoKind) { case ACMPInfoKind.SERVER: device_.OnUpdatedChannelInfo(string.Join("\n", e.Data)); break; case ACMPInfoKind.RECORDERS: device_.OnUpdatedRecorderInfo(string.Join("\n", e.Data)); break; } } }
void OnInfo(AMCPParserEventArgs e) { if (e.Subcommand == string.Empty) { device_.OnUpdatedServerInfo(e.Data); //for 2.2 and newer } else if (Enum.TryParse(e.Subcommand, out ACMPInfoKind infoKind)) { switch (infoKind) { case ACMPInfoKind.SERVER: device_.OnUpdatedChannelInfo(string.Join("\n", e.Data)); break; case ACMPInfoKind.RECORDERS: device_.OnUpdatedRecorderInfo(string.Join("\n", e.Data)); break; } } }
void OnInfo(AMCPParserEventArgs e) { List <ChannelInfo> channelInfo = new List <ChannelInfo>(); foreach (string data in e.Data) { try { XmlDocument doc = new XmlDocument(); doc.LoadXml(data); device_.OnUpdateInfo(doc); } catch { try { string[] infos = data.Split(' '); int id = Int32.Parse(infos[0]); VideoMode vm = VideoMode.Unknown; switch (infos[1].Trim().ToLower()) { case "pal43": vm = VideoMode.PAL43; break; case "pal169": vm = VideoMode.PAL169; break; case "ntsc": vm = VideoMode.NTSC; break; case "576p2500": vm = VideoMode.SD576p2500; break; case "720p5000": vm = VideoMode.HD720p5000; break; case "1080i5000": vm = VideoMode.HD1080i5000; break; default: vm = VideoMode.Unknown; break; } ChannelStatus cs = (ChannelStatus)Enum.Parse(typeof(ChannelStatus), infos[2], true); channelInfo.Add(new ChannelInfo(id, vm, cs, "")); } catch { } } } if (channelInfo.Count > 0) { device_.OnUpdatedChannelInfo(channelInfo); } }