From 01f9aeec3701eae38728f4a3692b489a4b4a1178 Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 3 Mar 2015 00:20:54 +0000 Subject: [PATCH] oops, add a file I forgot --- .../EmulatorWindowList.cs | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 BizHawk.Client.MultiHawk/EmulatorWindowList.cs diff --git a/BizHawk.Client.MultiHawk/EmulatorWindowList.cs b/BizHawk.Client.MultiHawk/EmulatorWindowList.cs new file mode 100644 index 0000000000..3e037d2398 --- /dev/null +++ b/BizHawk.Client.MultiHawk/EmulatorWindowList.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using Newtonsoft.Json; + +namespace BizHawk.Client.MultiHawk +{ + public class EmulatorWindowList : List + { + public string SessionName { get; set; } + + public EmulatorWindow Master + { + get + { + if (this.Any()) + { + return this.First(); + } + + return null; + } + } + + public IEnumerable Session + { + get + { + return this.Select(ew => new RomSessionEntry + { + RomName = ew.CurrentRomPath, + Wndx = ew.Location.X, + Wndy = ew.Location.Y + }); + } + } + + public string SessionJson + { + get + { + return JsonConvert.SerializeObject(Session); + } + } + + public static IEnumerable FromJson(string json) + { + return JsonConvert.DeserializeObject>(json); + } + + public new void Clear() + { + SessionName = string.Empty; + base.Clear(); + } + + public class RomSessionEntry + { + public string RomName { get; set; } + public int Wndx { get; set; } + public int Wndy { get; set; } + } + } +}