public void TestNext() { var pool = new IDPool(10, 10, 1); Assert.Equal(10, pool.Next()); Assert.Equal(11, pool.Next()); Assert.Equal(12, pool.Next()); Assert.Equal(13, pool.Next()); }
public void TestRelease() { var pool = new IDPool(10, 10, 1); Assert.Equal(10, pool.Next()); Assert.Equal(11, pool.Next()); pool.Release(10); pool.Release(11); Assert.Equal(11, pool.Next()); Assert.Equal(10, pool.Next()); }
public static void Stop() { if (ChatServer != null) { Console.WriteLine("VaserChat Server is closing..."); //Teardown myPool = new IDPool(10000); Client.ClientList.Clear(); //close the server ChatServer.Stop(); ChatServer = null; } }
public static void Stop() { if (ChatServer != null) { Console.WriteLine("VaserChat Server is closing..."); //Teardown myPool = new IDPool(10000); Client.ClientList.Clear(); //close the server ChatServer.Stop(); ChatServer = null; } }
public Main() { InitializeComponent(); Data = new Dictionary <string, ActionTemplateWrapper>(); effects = new Dictionary <string, EffectTemplateWrapper>(); Requirements = new Dictionary <string, ActionRequirementWrapper>(); AOPanel = new ActionOverviewPanel(); RQPanel = new RequirementPanel(); EFPanel = new EffectsPanel(); Ids = new IDPool(1000); Current = this; TV = tv; workingDataNode = new TreeNode(); // dummy vars; saveActionDialog.DefaultExt = ".ACT"; openFileDialog1.DefaultExt = ".ACT"; vm = new VM(); }
private static void _SetupPool <T>(string map_file_name, IDPool <T> pool, Action <string, string> add_method) { using (Stream stream = _Assembly.GetManifestResourceStream($"Content/gungeon_id_map/{map_file_name}")) { using (StreamReader reader = new StreamReader(stream)) { string line; while (true) { line = reader.ReadLine(); if (line == null) { break; } Console.WriteLine($"STARTS WITH HASH? {line.StartsWithInvariant("#")}"); if (line.StartsWithInvariant("#")) { continue; } string[] split = line.Split(' '); add_method.Invoke(split[0], split[1]); } } } pool.LockNamespace("gungeon"); }