public async Task LoadFromHistory(XbmcServer server) { await SaveCurrentInHistory(); VlcPassword = server.VlcPassword; VlcPort = server.VlcPort; VlcUseQSV = server.VlcUseQsv; Set(server.Host, server.WebInterfacePort, server.User, server.Password); }
private async Task Init() { var disc = new DiscoveryRaw(); var server = await disc.GetMediaServer(); var discoveredXBMCs = new List <XbmcServer>(); foreach (var device in server) { if (device.FriendlyName.StartsWith("XBMC (")) { var discoveredXBMC = new XbmcServer(device.FriendlyName, device.ContentDirectoryControlUri); discoveredXBMCs.Add(discoveredXBMC); discoveredXBMC.CheckWebIf(); if (await IsXbmcHost(device.ContentDirectoryControlUri)) { discoveredXBMC.IsCurrent = true; _xbmcMediaServer = device; } } } DiscoveredXBMCs = discoveredXBMCs; IsAvailable = _xbmcMediaServer != null; if (IsAvailable) { var renderDevices = await disc.GetMediaRenderer(); var availableRenderDevices = new List <MediaRendererDevice>(); foreach (var renderer in renderDevices) { //#if !DEBUG if (!(renderer.FriendlyName.StartsWith("XBMC (") && await IsXbmcHost(renderer.AVTransportControlUrl))) //#endif { availableRenderDevices.Add(renderer); } } AvailableRenderDevices = availableRenderDevices.ToArray(); //MediaRendererDevice rendererUpnp = null; //foreach (var device in AvailableRenderDevices) //{ // if (device.AVTransportControlUrl == null) continue; // if (device.FriendlyName.StartsWith("WDTV")) // { // rendererUpnp = device; // break; // } //} } }
public XbmcServer GetCurrentAsHistoryItem() { var server = new XbmcServer(); server.WebInterfacePort = (int)Port; server.Host = Host; server.User = User; server.Password = Password; server.VlcPassword = VlcPassword; server.VlcPort = VlcPort; server.VlcUseQsv = VlcUseQSV; return(server); }
public async Task SaveCurrentInHistory() { if (string.IsNullOrWhiteSpace(Host)) { return; } XbmcServer server = _history.FirstOrDefault(h => h.Host == Host && h.WebInterfacePort == Port); if (server == null) { server = new XbmcServer(); server.WebInterfacePort = (int)Port; server.Host = Host; _history.Add(server); } server.User = User; server.Password = Password; server.VlcPassword = VlcPassword; server.VlcPort = VlcPort; server.VlcUseQsv = VlcUseQSV; await _settingsManager.SaveData(HistoryFile, _history, false); }