public static void Return(HList <NewLike> list) => likesPool.Return(list);
/// <inheritdoc /> public override HElement GetContents(SessionData sessionData, string requestedAction, WalkableQueue <Tuple <ID, string> > positionQueue) { if (positionQueue.AtEnd()) { HElement list = new HList(HList.EListType.UnorderedList, (from s in _subNodes select GetLink(s.Value.Name, s.Key, positionQueue, positionQueue.Position, null)).ToArray()) { Class = "subnodes" }; if (((HList)list).IsEmpty()) { list = new HItalic("This DebugNode includes no Subnodes.") { Class = "subnodes" } } ; else { list = new HHeadline("Subnodes of this DebugNode", 3) { Class = "subnodes" } } +list; return(new HHeadline(Name) + new HLine() { Class = "start" } +(_description == null ? new HText(_description) : (HElement) new HString()) + new HContainer(GetElements(sessionData)) + new HLine() { Class = "subnodes" } +list); } else { HLink navlink = GetLink(this); navlink.Class = "nav"; HInlineContainer name = new HInlineContainer() { Elements = { navlink } }; DebugResponseNode node = null; positionQueue.Pop(); if (_subNodes) { node = _subNodes[positionQueue.Peek().Item1]; } if (ReferenceEquals(node, null)) { HElement list = new HList(HList.EListType.UnorderedList, (from s in _subNodes select GetLink(s.Value.Name, s.Value.URL)).ToArray()) { Class = "subnodes" }; if (((HList)list).IsEmpty()) { list = new HItalic("This DebugNode includes no Subnodes.") { Class = "subnodes" } } ; else { list = new HHeadline("Subnodes of this DebugNode", 3) { Class = "subnodes" } } +list; return(name + new HHeadline(Name) + new HLine() { Class = "start" } +new HText($"The ID '{positionQueue.Peek().Item1.Value}' is not a child of this {nameof(DebugContainerResponseNode)}.") { Class = "invalid" } +new HLine() { Class = "subnodes" } +list); } else { return(name + node.GetContents(sessionData, positionQueue.Peek().Item2, positionQueue)); } } }
public bool Return(HList <NewLike> obj) { obj.ClearFast(); return(true); }
public GameplaySettingsPane(GameConfig gameConfig) { hlLang = new HList(); foreach (Language lang in GameConfig.SupportedLanguages) { hlLang.add(new TextItem(lang.Title, "fonts/menu_font1")); } VList vlNames = new VList(new TextItem(gameConfig.Language.translate("Language"), "fonts/menu_font1")); VPane vpSettings = new VPane(hlLang); hlLang.VisibleRange = 2; vlNames.SelectedEvent += (sender, args) => hlLang.IsFocused = args.SelectedIndex == 0; vlNames.CancelEvent += (sender, args) => { hlLang.IsFocused = false; hide(0.5f); }; hlLang.SelectedEvent += (sender, args) => gameConfig.Language = GameConfig.SupportedLanguages[args.SelectedIndex]; Language[] langs = GameConfig.SupportedLanguages; int index = langs.Length - 1; for (; index >= 0 && gameConfig.Language.ID != langs[index].ID; --index) { ; } hlLang.select(index < 0 ? 0 : index); hlLang.SelectedColor = Color.White; vlNames.PercentWidth = 30; vlNames.PercentHeight = 100; vlNames.HAlignment = HAlignment.Left; vlNames.EffectAlpha = 0.5f; vlNames.Color = Color.Black; vpSettings.PercentWidth = 70; vpSettings.PercentHeight = 100; vpSettings.HAlignment = HAlignment.Left; vpSettings.EffectAlpha = 0.5f; vpSettings.Color = Color.Gray; FocusRequestEvent += (s, a) => { vlNames.select(0); vlNames.IsFocused = true; }; FocusLossEvent += (s, a) => { vlNames.IsFocused = false; vlNames.SelectedIndex = -1; }; HPane hpMain = new HPane(vlNames, vpSettings); hpMain.PercentWidth = 100; hpMain.PercentHeight = 100; add(hpMain); }
/* * Build a ClientHello using the provided cipher suites. * Returned array contains the complete message with its * 4-byte header (but not the record header). */ byte[] MakeClientHello(int[] ccs) { /* * Assemble ClientHello. */ HList chs = new HList(0xFFFFFF); /* * Maximum protocol version. */ M.Write2(chs, maxVersion); /* * Client random. The first four bytes encode the * current time. */ byte[] clientRandom = new byte[32]; M.Enc32be((int)(M.CurrentTimeMillis() / 1000), clientRandom, 0); M.Rand(clientRandom, 4, clientRandom.Length - 4); chs.Write(clientRandom, 0, clientRandom.Length); /* * Session ID, for session resumption. */ if (sessionID == null) { M.Write1(chs, 0); } else { M.Write1(chs, sessionID.Length); chs.Write(sessionID, 0, sessionID.Length); } /* * Cipher suites. */ List <int> lcs = new List <int>(); if (ccs != null) { foreach (int s in ccs) { lcs.Add(s); } if (renegotiationSCSV) { lcs.Add(M.TLS_EMPTY_RENEGOTIATION_INFO_SCSV); } if (fallbackSCSV) { lcs.Add(M.TLS_FALLBACK_SCSV); } } M.Write2(chs, lcs.Count << 1); foreach (int s in lcs) { M.Write2(chs, s); } /* * Compression support: the NULL compression must * always be specified; optionally, Deflate compression * can be supported. */ if (deflateCompress) { M.Write1(chs, 2); M.Write1(chs, 1); M.Write1(chs, 0); } else { M.Write1(chs, 1); M.Write1(chs, 0); } /* * Extensions. */ HList exs = new HList(0xFFFF); /* * With TLS 1.2, the "signature algorithms" extension is * _always_ included, even if all other extensions are * disabled. */ if (maxVersion >= M.TLSv12) { M.Write2(exs, M.EXT_SIGNATURE_ALGORITHMS); M.Write2(exs, 38); M.Write2(exs, 36); for (int s = 3; s >= 1; s--) { for (int h = 6; h >= 1; h--) { M.Write1(exs, h); M.Write1(exs, s); } } } if (serverName != null) { M.Write2(exs, M.EXT_SERVER_NAME); HList sndata = new HList(0xFFFF); HList snles = new HList(0xFFFF); snles.WriteByte(0); HList snes = new HList(0xFFFF); snes.Write(Encoding.UTF8.GetBytes(serverName)); snles.Write(snes.ToArray()); sndata.Write(snles.ToArray()); exs.Write(sndata.ToArray()); } if (renegotiationExtension) { M.Write2(exs, M.EXT_RENEGOTIATION_INFO); M.Write2(exs, 1); M.Write1(exs, 0); } if (encryptThenMACExtension) { M.Write2(exs, M.EXT_ENCRYPT_THEN_MAC); M.Write2(exs, 0); } if (supportedCurves != null && supportedCurves.Length > 0) { M.Write2(exs, M.EXT_SUPPORTED_CURVES); HList ecdata = new HList(0xFFFF); HList ecl = new HList(0xFFFF); foreach (int ec in supportedCurves) { M.Write2(ecl, ec); } ecdata.Write(ecl.ToArray()); exs.Write(ecdata.ToArray()); } if (exs.Length != 0) { chs.Write(exs.ToArray()); } byte[] msg = chs.ToArray(); MemoryStream ms = new MemoryStream(); ms.WriteByte(M.CLIENT_HELLO); ms.Write(msg, 0, msg.Length); return(ms.ToArray()); }
public AudioSettingsPane(GameConfig gameConfig) { hlMusic = new HList(new TextItem("Off", "fonts/menu_font1")); hlSFX = new HList(new TextItem("Off", "fonts/menu_font1")); for (int i = 10; i <= 100; i += 10) { hlMusic.add(new TextItem(" " + i.ToString() + " ", "fonts/menu_font1")); hlSFX.add(new TextItem(" " + i.ToString() + " ", "fonts/menu_font1")); } VList vlNames = new VList( new TextItem("Music Volume", "fonts/menu_font1"), new TextItem("Audio Volume", "fonts/menu_font1") ); hlSFX.VisibleRange = 4; hlMusic.VisibleRange = 4; VPane vpSettings = new VPane(hlMusic, hlSFX); vlNames.SelectedEvent += (sender, args) => { hlMusic.IsFocused = args.SelectedIndex == 0; hlSFX.IsFocused = args.SelectedIndex == 1; }; vlNames.CancelEvent += (sender, args) => { hlMusic.IsFocused = false; hlSFX.IsFocused = false; vlNames.select(0); hide(0.5f); }; hlMusic.SelectedEvent += (sender, args) => gameConfig.MusicVolume = args.SelectedIndex * 10; hlSFX.SelectedEvent += (sender, args) => gameConfig.SFXVolume = args.SelectedIndex * 10; hlMusic.select(gameConfig.MusicVolume / 10); hlSFX.select(gameConfig.SFXVolume / 10); hlMusic.SelectedColor = Color.White; hlSFX.SelectedColor = Color.White; vlNames.PercentWidth = 30; vlNames.PercentHeight = 100; vlNames.HAlignment = HAlignment.Left; vlNames.EffectAlpha = 0.5f; vlNames.Color = Color.Black; vpSettings.PercentWidth = 70; vpSettings.PercentHeight = 100; vpSettings.HAlignment = HAlignment.Left; vpSettings.EffectAlpha = 0.5f; vpSettings.Color = Color.Gray; FocusRequestEvent += (s, a) => { vlNames.select(0); vlNames.IsFocused = true; }; FocusLossEvent += (s, a) => { vlNames.IsFocused = false; vlNames.SelectedIndex = -1; }; HPane hpMain = new HPane(vlNames, vpSettings); hpMain.PercentWidth = 100; hpMain.PercentHeight = 100; add(hpMain); }
private void initGrid() { if (vlGrid != null) { remove(vlGrid); } grid = new StackPane[width, height]; vlGrid = new VList(); vlGrid.PercentWidth = 100; vlGrid.PercentHeight = 50; vlGrid.MillisPerInput = 128; vlGrid.InputSingleMode = true; vlGrid.CancelEvent += (sender, args) => { if (!setFormation()) { ParentScreen.ScreenManager .AddScreen(new ConfirmDialog(ParentScreen as BesmashScreen, (a) => { if (a == 0) { hide(); // yes -> hide() } if (a == 1) { ; // no -> do nothing } if (a == 2) { ; // cancel -> do nothing } }, "No Leader assigned", "Omit changes?"), null); } else { hide(); } }; vlGrid.SelectedEvent += (sender, args) => { if (args.SelectedItem is HList) { HList row = args.SelectedItem as HList; row.IsFocused = true; row.select(columnIndex); } }; vlGrid.DeselectedEvent += (sender, args) => { if (args.SelectedItem is HList) { HList row = args.SelectedItem as HList; row.IsFocused = false; row.SelectedIndex = -1; } }; for (int x, y = 0, c = 0; y < height; ++y) { HList row = new HList(); row.PercentWidth = 100; row.PercentHeight = (int)(100f / height); row.IsStatic = true; row.MillisPerInput = 128; row.InputSingleMode = true; row.SelectedEvent += (sender, args) => { Container cell = args.SelectedItem as Container; columnIndex = args.SelectedIndex; // if(cell.Children.Count > 0) // cell.Children[0].EffectScale = 1.2f; if (cursor != null) { // if(cursor.ParentContainer != null) // cursor.ParentContainer.remove(cursor); if (cursor.ParentContainer != null) { // image switching if (selected != null && cell.Children.Count > 0) { cursor.ParentContainer.add(cell.Children[0]); cell.remove(cell.Children[0]); } cursor.ParentContainer.remove(cursor); } cell.add(cursor); } }; row.ActionEvent += (sender, args) => { Container cell = args.SelectedItem as Container; ImageItem pick = cell.Children.Count > 0 ? cell.Children[0] as ImageItem : null; if (pick != null) { cell.remove(pick); cursor.prepend(pick); pick.EffectScale = 1.2f; } if (selected != null) { cell.prepend(selected); cursor.remove(selected); selected.EffectScale = 1; } selected = pick; }; for (x = 0; x < width; ++x, ++c) { StackPane cell = new StackPane(); cell.PercentWidth = (int)(100f / width); cell.PercentHeight = 100; cell.Color = (c % 2) == 0 ? Color.Black : Color.Gray; cell.Alpha = 0.5f; grid[x, y] = cell; row.add(cell); } vlGrid.add(row); } add(vlGrid); }
public void Slethus() { HList.Remove(SelectedHus); GemData(); }