using System.Collections.Generic; public DateTime LookedAt; public string Label { get { return Name ?? "Roblox (reading...)"; } } public static List<Instance> Read(List<Instance> known, Settings s, string dir) var list = new List<Instance>(); var now = DateTime.UtcNow; foreach (var h in RobloxWindow.All()) var had = known == null ? null : known.FirstOrDefault(i => i.Handle == h); if (had != null && (had.Name != null || now - had.LookedAt < TimeSpan.FromSeconds(30))) { list.Add(had); continue; } var head = HeaderIn(h, s); list.Add(new Instance { Handle = h, Head = head, Name = head == null || !Accounts.Plausible(head.Name) ? null : Accounts.Known(dir, Accounts.Tidy(head.Name.Trim())), LookedAt = now }); internal static Instance Pick(List<Instance> open, string account, bool pickedClosed) var named = open.Where(i => i.Name != null).ToList(); return named.FirstOrDefault(i => Accounts.Same(i.Name, account)) ?? (pickedClosed ? named.FirstOrDefault() : null); public static bool SameWindows(List<Instance> a, List<Instance> b) if (a == null || b == null || a.Count != b.Count) return false; for (int i = 0; i < a.Count; i++) if (a[i].Handle != b[i].Handle || a[i].Name != b[i].Name) return false; internal static Header HeaderIn(IntPtr h, Settings s) var g = new Game(msg => { }, () => false); if (!g.Win.Find() || g.Win.Minimized) return null; using (var f = g.Win.Capture()) if (v.Problem != null) return null; return g.ReadHeader(f, v); catch (Exception) { return null; }