private void btn_Add_Click(object sender, EventArgs e) { ServerListItem item; if (!_dicServerlist.ContainsKey(tb_ServerName.Text)) { item = new ServerListItem(); } else { item = _dicServerlist[tb_ServerName.Text]; } item.Anonymus = cb_Anonymus.Checked; item.ServerName = tb_ServerName.Text; item.Url = tb_URL.Text; item.User = tb_User.Text; item.PasswordUnhashed = tb_Password.Text; if (tb_Password.Text != "") { item.Password = md5hash.hex_md5(tb_Password.Text).ToString(); } if (!_dicServerlist.ContainsKey(tb_ServerName.Text)) { _serverlist.Add(item); _dicServerlist.Add(item.ServerName, item); lB_Serverliste.Items.Add(item.ServerName); clearTextBoxes(); } }
/// <summary> /// Used by network descovery script to add found server to discovered servers list /// </summary> /// <param name="info"></param> public void OnDiscoveredServer(ServerResponse info) { //Check if server already found if (discoveredServers.ContainsKey(info.serverId)) { //Update Server display } else { // Note that you can check the versioning to decide if you can connect to the server or not using this method discoveredServers.Add(info.serverId, info); GameObject newServerItem = Instantiate(ServerListItem); //create a new list item newServerItem.transform.SetParent(ServerList.transform, false); //set new item as a child of the server list ServerListItem data = newServerItem.GetComponent <ServerListItem>(); //get access to ServerListItem //SET UP ADDITIONAL DATA FROM RESPONSE data.InitServerListItem( info.serverId, info.name, discoveredServers[info.serverId].EndPoint.Address.ToString(), info.currentPlayers, info.maxPlayers ); ServerListItems.Add(info.serverId, newServerItem); } }
private static void OnPostSetUIPatch(ServerListItem __instance, string population, RoomInfo info) { if (info.MaxPlayers != 4) { __instance.serverPopulation.text = population + "/" + info.MaxPlayers; } }
public void LoadMainPage() { ServerListItem server = appSettings.GetServer(); if (server == null) { SettingsFlyoutMain settingFlyout = new SettingsFlyoutMain(); settingFlyout.Show(); return; } App.ReInitializeWebSocket(); try { if (server != null) { Uri mb = new Uri("http://" + server + "/mediabrowser"); mainWebPage.Navigate(mb); } } catch (Exception exeption) { App.AddNotification(new Notification() { Title = "Error Loading Main Page", Message = exeption.Message }); } }
public void OnAddButtonPressed() { // Default values. this.nameInputField.text = "name"; this.ipAddressInputField.text = "0.0.0.0"; this.portInputField.text = "0000"; // Spawn new server button. GameObject newServerListItemObj = GameObject.Instantiate(this.serverListItemPrefab, this.contentHolder, false); // Initialise with default values. ServerDetails newServerDetails = new ServerDetails(this.nameInputField.text, this.ipAddressInputField.text, this.portInputField.text); ServerListItem newItem = newServerListItemObj.GetComponent <ServerListItem>(); newItem.Initialise(this, newServerDetails); // Add to the list and select. Server newServer = new Server(newServerDetails, newItem); this.serverListItems.Add(newServer); this.selectedServer = newServer; this.isAddingNewServer = true; }
public void OnMatchList(bool success, string extendedinfo, List <MatchInfoSnapshot> responsedata) { _status.text = ""; if (responsedata == null) { _status.text = "Couldn't get room list."; return; } foreach (MatchInfoSnapshot response in responsedata) { GameObject roomListItemGO = Instantiate(_roomListInst); roomListItemGO.transform.SetParent(_roomListParent); ServerListItem item = roomListItemGO.GetComponent <ServerListItem>(); if (item != null) { item.Setup(response, JoinRoom); } _roomList.Add(roomListItemGO); } if (_roomList.Count == 0) { _status.text = "No servers found."; } }
private void OnMatchList(bool success, string extendedInfo, List <MatchInfoSnapshot> responseData) { status.text = ""; if (responseData == null) { status.text = "Could'nt get server list."; return; } foreach (var server in responseData) { GameObject _serverListItemGO = Instantiate(serverListItemPrefab); _serverListItemGO.transform.SetParent(serverListParent); ServerListItem _serverListItem = _serverListItemGO.GetComponent <ServerListItem>(); if (_serverListItem != null) { _serverListItem.Setup(server, JoinServer); } serverList.Add(_serverListItemGO); } if (serverList.Count == 0) { status.text = "No server found"; } }
private void serverList_SelectionChanged(object sender, SelectionChangedEventArgs e) { ServerListItem server = serverList.SelectedItem as ServerListItem; if (server != null) { setting_server.Text = server.host; setting_port.Text = server.port; } }
private void UpdateButton_Click(object sender, RoutedEventArgs e) { ServerListItem server = serverList.SelectedItem as ServerListItem; if (server != null) { server.host = setting_server.Text.Trim(); server.port = setting_port.Text.Trim(); } }
public Server(ServerDetails details, ServerListItem item) { this.details = details; this.item = item; if (item != null) { this.item.UpdateVisuals(details); } }
public void SetServerList(List <string[]> list) { for (int i = list.Count - 1; i >= 0; --i) { GameObject go = Instantiate(_listItem) as GameObject; go.transform.SetParent(midGrid); go.transform.localScale = Vector3.one; ServerListItem item = go.GetComponent <ServerListItem>(); item.SetInfo(i, list[i][0], list[i][3]); } }
private void PopulateServerList(ServerDetailsCollection serverData) { foreach (ServerDetails serverDetails in serverData.serverList) { GameObject newServerListItemObj = GameObject.Instantiate(this.serverListItemPrefab, this.contentHolder, false); ServerListItem newItem = newServerListItemObj.GetComponent <ServerListItem>(); newItem.Initialise(this, serverDetails); this.AddServer(new Server(serverDetails, newItem)); } }
/// <summary> /// Initializes the statistic servers. /// </summary> private bool InitializeServers() { if (serverList.Items.Count > 0) { serverList.Items.Clear(); } try { var sourceContent = File.ReadAllText(Program.StatisticServersFilePath); _statisticsServers = Serializer.Deserialize <List <StatisticsServer> >(sourceContent); if (_statisticsServers == null || _statisticsServers.Count == 0) { _statisticsServers = new List <StatisticsServer>(); noServersLabel.Visible = true; } else { noServersLabel.Visible = false; } } catch (Exception ex) { Popup.ShowPopup(this, SystemIcons.Error, "Error while loading the servers.", ex, PopupButtons.Ok); return(false); } foreach (var server in _statisticsServers) { try { var listItem = new ServerListItem { ItemImage = imageList1.Images[0], HeaderText = server.DatabaseName, ItemText = String.Format("Web-URL: \"{0}\" - Database: \"{1}\"", server.WebUrl, server.DatabaseName) }; serverList.Items.Add(listItem); } catch (Exception ex) { Popup.ShowPopup(this, SystemIcons.Error, String.Format("Error while loading \"{0}\"", server.DatabaseName), ex, PopupButtons.Ok); return(false); } } return(true); }
public static bool UiFix(ServerListItem __instance, string __0, string __1, RoomInfo __2) { int num = __0.LastIndexOf("#"); if (num > 0) { __0 = __0.Substring(0, num); } __instance.serverName.text = "Server: " + __0; __instance.serverPopulation.text = __1 + "/" + __2.MaxPlayers; RoomInfoF.SetValue(__instance, __2); return(false); }
/// <summary> /// Invoked when the application is launched normally by the end user. Other entry points /// will be used such as when the application is launched to open a specific file. /// </summary> /// <param name="e">Details about the launch request and process.</param> protected async override void OnLaunched(LaunchActivatedEventArgs e) { #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { //this.DebugSettings.EnableFrameRateCounter = true; } #endif // if there is no server/port then try to discover it ServerListItem server = settings.GetServer(); if (server != null) { // set up WebSocket await socketManager.SetupWebSocket(); } // set up the main page Frame rootFrame = Window.Current.Content as Frame; // Do not repeat app initialization when the Window already has content, // just ensure that the window is active if (rootFrame == null) { // Create a Frame to act as the navigation context and navigate to the first page rootFrame = new Frame(); // Set the default language rootFrame.Language = Windows.Globalization.ApplicationLanguages.Languages[0]; rootFrame.NavigationFailed += OnNavigationFailed; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { //TODO: Load state from previously suspended application } // Place the frame in the current Window Window.Current.Content = rootFrame; } if (rootFrame.Content == null) { // When the navigation stack isn't restored navigate to the first page, // configuring the new page by passing required information as a navigation // parameter rootFrame.Navigate(typeof(MainPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); }
public void HighlightServer(ServerListItem item) { if (_selectedItem != null) { // Reset color _selectedItem.Backgroud.color = _normalColor; } _selectedItem = item; if (item != null) { item.Backgroud.color = _highlightColor; } }
public void HighlightServer(ServerListItem item) { if (_selectedItem != null) { // Reset color _selectedItem.Backgroud.color = _normalColor; } _selectedItem = item; if (item != null) { item.Backgroud.color = _highlightColor; } }
private void OnNavigate(WebView sender, WebViewNavigationStartingEventArgs args) { Uri destination = args.Uri; // block if not to media portal ServerListItem server = appSettings.GetServer(); if (server == null || destination.Host != server.host) { args.Cancel = true; App.AddNotification(new Notification() { Title = "Navigation Error", Message = "Remote sites not allowed" }); } }
private void AddButton_Click(object sender, RoutedEventArgs e) { ObservableCollection <ServerListItem> list = serverList.ItemsSource as ObservableCollection <ServerListItem>; ServerListItem server = new ServerListItem(); server.host = setting_server.Text.Trim(); server.port = setting_port.Text.Trim(); list.Add(server); int selectedIndex = serverList.SelectedIndex; if (selectedIndex == -1 && list.Count > 0) { serverList.SelectedIndex = 0; } }
public void OnServerSelected(ServerListItem serverListItem) { if (serverListItem == null) { return; } foreach (Server server in this.serverListItems) { if (server.item == serverListItem) { this.selectedServer = server; } } this.editButton.interactable = true; this.joinButton.interactable = true; this.removeButton.interactable = true; }
public void Display(IEnumerable <string> servers) { var index = 0; foreach (var server in servers) { ServerListItem item = null; if (index < Servers.Count) { item = Servers[index]; } else { item = Instantiate(SampleItem); Servers.Add(item); } item.ServerName.text = server; item.transform.SetParent(ServerListGroup, false); item.ServerSelection = this; item.gameObject.SetActive(true); index++; } // Hide items that were not used while (index < Servers.Count) { Servers[index].gameObject.SetActive(false); index++; } if (Servers.Count > 0) { } gameObject.SetActive(true); }
private void PlaybackAction(long startAtSeconds) { _seekTo = startAtSeconds; long startTicks = startAtSeconds * 1000 * 10000; ServerListItem server = settings.GetServer(); // get streaming values int videoBitrateSetting = videoBitrateSelected; if (videoBitrateSetting == -1) { videoBitrateSetting = 10000000; } int videoMaxWidthSetting = videoMaxWidthSelected; if (videoMaxWidthSetting == -1) { videoMaxWidthSetting = 1920; } int audioBitrateSetting = audioBitrateSelected; if (audioBitrateSetting == -1) { audioBitrateSetting = 128000; } int audioChannels = audioChannelSelected; if (audioChannels == -1) { audioChannels = 6; } string audioCodecs = audioCodecSelected; if (string.IsNullOrWhiteSpace(audioCodecs)) { audioCodecs = "aac,ac3"; } string enableStreamCopy = enableStreamCopySelected; if (string.IsNullOrWhiteSpace(enableStreamCopy)) { enableStreamCopy = "true"; } string mediaFileUrl = "http://" + server + "/mediabrowser/Videos/" + itemId + "/stream.ts?"; if (audioStreamSelected != -1) { mediaFileUrl += "AudioStreamIndex=" + audioStreamSelected + "&"; } if (subStreamSelected != -1) { mediaFileUrl += "SubtitleStreamIndex=" + subStreamSelected + "&"; //mediaFileUrl += "SubtitleDeliveryMethod=Encode&"; //mediaFileUrl += "SubtitleDeliveryMethod=External&"; } mediaFileUrl += "DeviceId=" + settings.GetDeviceId() + "&" + "Static=false&" + "MediaSourceId=" + itemId + "&" + "VideoCodec=h264&" + "AudioCodec=" + audioCodecs + "&" + "AudioChannels=" + audioChannels + "&" + "MaxWidth=" + videoMaxWidthSetting + "&" + "VideoBitrate=" + videoBitrateSetting + "&" + "AudioBitrate=" + audioBitrateSetting + "&" + "EnableAutoStreamCopy=" + enableStreamCopy + "&" + "StartTimeTicks=" + startTicks; mediaPlayer.Source = new Uri(mediaFileUrl, UriKind.Absolute); /* * // removed for now due to sync issues * // set up subtitle streaming * if (subStreamSelected != -1) * { * string subtitleUrl = "http://" + server + "/mediabrowser/Videos/" + itemId + "/" + itemId + "/Subtitles/" + subStreamSelected + "/" + startTicks + "/Stream.vtt"; * * mediaPlayer.AvailableCaptions.Clear(); * Caption cap = new Caption(); * cap.Source = new Uri(subtitleUrl, UriKind.Absolute); * cap.Description = "Default"; * mediaPlayer.AvailableCaptions.Add(cap); * mediaPlayer.SelectedCaption = mediaPlayer.AvailableCaptions.First(); * } */ //mediaPlayer.Stretch = Stretch.Fill; client.PlaybackCheckinStarted(itemId, startAtSeconds); }
public void Analyze() { mUsedItemIds.Clear(); Logger.LogAllLine("Analyze ServerList================>"); var reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Jet\4.0\Engines\Excel", true); reg.SetValue("TypeGuessRows", 0); ServerList config = new ServerList(); var table = ExcelHelper.LoadDataFromExcel(PathManager.InputConfigServerConfigPath.FullName, PathManager.ServerListTableName); foreach (DataRow row in table.Rows) { bool isValid = true; bool isAllNull = true; for (int i = 0; i < row.ItemArray.Length; i++) { if (row.IsNull(i)) { isValid = false; } else { isAllNull = false; } } if (isValid) { try { var configItem = new ServerListItem(); configItem.Id = Convert.ToUInt32(row["Id"]); var serverUsages = ParseServerUsages(Convert.ToString(row["ServerUsages"])); configItem.ServerUsages.AddRange(serverUsages); foreach (var serverUsageItem in serverUsages) { if (!mUsedItemIds.ContainsKey(serverUsageItem.ServerId)) { mUsedItemIds.Add(serverUsageItem.ServerId, false); } } config.Items.Add(configItem); } catch (Exception ex) { Logger.LogErrorLine(ex.Message); ExcelHelper.PrintRow(row); } } else if (!isAllNull) { Logger.LogErrorLine("Invalid Server Config line:"); ExcelHelper.PrintRow(row); } } using (var file = PathManager.OutputConfigServerListPath.OpenWrite()) { Serializer.Serialize(file, config); } var resourceFile = new FileListFile(PathManager.OutputConfigServerListPath, true, true); FileSystemGenerator.AddFileAndTag(resourceFile); Logger.LogAllLine("Generate:\t{0}", PathManager.OutputConfigServerListPath); }
private void ServerClicked(TableView sender, ServerListItem serverListItem) { ServerSelected?.Invoke(serverListItem.server); }
public BaseRequest(ServerListItem _serverListItem) { this._serverListItem = _serverListItem; }