static DeviceScreen ToDeviceInfo(DeviceJson json) { return(new DeviceScreen( json.Name, new Size <Pixels>(json.Width, json.Height), json.PixelsPerPoint, json.PhysicalPixelsPerInch, json.PhysicalPixelsPerPixel, json.DefaultOrientation.ToUpper() == "LANDSCAPE" ? DeviceOrientation.Landscape : DeviceOrientation.Portrait, json.IsDefault)); }
/// <exception cref="MalformedDeviceInfo"></exception> public static ImmutableList <DeviceScreen> LoadDevicesFrom(Stream stream) { try { return(DeviceJson .LoadFrom(stream) .Select(ToDeviceInfo) .ToImmutableList()); } catch (Exception e) { throw new MalformedDeviceInfo(e); } }