public void RemoteListener(LiveServer s) { if (this.ImageCaptured != null) { //this.ImageCaptured -= s.ImageCaptured; } }
public async Task <LiveMatch> GetLiveMatch(string url) { var doc = await LoadHtmlDocAsync(url); if (doc == null) { return(null); } var match = new LiveMatch(); var streamInfo = doc.SelectSingleNode("//div[@class='content']/div[@class='row-news']//div[@class='stream-info']"); if (streamInfo == null) { return(null); } // champion match.Champion = streamInfo.SelectSingleNode("./div[@class='shortInfo']").InnerText(); match.DateTime = streamInfo.SelectSingleNode(".//span[@class='time-by-timezone']").InnerText(); match.OriginServer = doc.SelectSingleNode("//div[@class='content']//div[@class='news-articles']/div[@id='zone-match-livetv-stream']/iframe").AttributeValue("src", string.Empty); // stream info match.TeamA.TeamName = streamInfo.SelectSingleNode("./div[@class='competeTeams']/span[contains(@class,'teamA') and contains(@class, 'tright')]").InnerText(); match.TeamB.TeamName = streamInfo.SelectSingleNode("./div[@class='competeTeams']/span[contains(@class,'teamA') and contains(@class, 'tleft')]").InnerText(); match.TeamA.Score = streamInfo.SelectSingleNode(".//span[@class='score-teamA']").InnerText(); match.TeamB.Score = streamInfo.SelectSingleNode(".//span[@class='score-teamB']").InnerText(); match.TeamA.TeamFlag = streamInfo.SelectSingleNode("./span[@class='bageTeamA']/img").AttributeValue("src", string.Empty); match.TeamB.TeamFlag = streamInfo.SelectSingleNode("./span[@class='bageTeamB']/img").AttributeValue("src", string.Empty); // server var arrServers = doc.SelectNodes("//div[@class='content']//div[@id='zone-other-livetv']/a"); if (arrServers != null && arrServers.Count > 0) { var count = arrServers.Count; for (int i = 0; i < count; i++) { var a = arrServers[i]; var server = new LiveServer(); server.Id = a.GetAttributeValue("data-pid", string.Empty); if (string.IsNullOrEmpty(server.Id)) { // try get by title if data-pid cannot get value server.Id = a.GetAttributeValue("title", string.Empty); } // a.SelectSingleNode("") server.Text = a.InnerText; if (string.IsNullOrEmpty(server.Text) == false) { server.Text = server.Text.Replace(" ", string.Empty); } server.Flags = a.SelectSingleNode("./span").AttributeValue("class", string.Empty); match.Servers.Add(server); } } return(match); }
private static async void Start() { try { var port = 81; var server = new LiveServer("/Users/alois/SkiaSharp.Components/src/SkiaSharp.Components.Samples", "*.skml"); var t = server.StartAsync($"http://+:{port}/"); Console.WriteLine($"Listening ws://{GetLocalIPAddress()}:{port}..."); await t; } catch (Exception ex) { Console.WriteLine($"ERROR: {ex.Message}"); } }
public void StartServer(object serverPort) { if (liveServer == null) { liveServer = new TcpListener((int)serverPort); liveServer.Start(1); } while (true) { TcpClient client = liveServer.AcceptTcpClient(); System.Diagnostics.Debug.WriteLine("accept connection:" + client.Client.RemoteEndPoint); LiveServer ls = new LiveServer(client, this); ls.Start(); } }