private static void Parse_INTERNAL(string file, List <DeviceInfo> output, ParseDeviceResolutionType type) { output.Clear(); var data = Resources.Load("UI.Windows/DevicePreview/" + file) as TextAsset; if (data != null) { var lines = data.text.Split('\n'); foreach (var line in lines) { var info = line.Trim().Split(','); var device = new DeviceInfo(); device.manufacturer = info[0].Trim(); device.model = info[1].Trim(); device.orientation = ScreenOrientation.Landscape; if (device.model == "{SCREEN}") { device.current = true; device.model = "MY SCREEN"; device.width = Screen.width; device.height = Screen.height; device.ppi = Screen.dpi; } else { device.current = false; var res = info[2].Trim(); var sres = res.Split('x'); device.width = int.Parse(sres[0]); device.height = int.Parse(sres[1]); if (type == ParseDeviceResolutionType.PPI) { device.ppi = float.Parse(info[3].Trim()); } else if (type == ParseDeviceResolutionType.INCHES) { device.ppi = Parser.ConvertInchesToPPI(float.Parse(info[3]), device.width, device.height); } } var devOutput = info.Length > 4 ? info[4].Trim() : string.Empty; device.deviceOutput = devOutput; output.Add(device); if (Parser.manufacturerToDevices.ContainsKey(device.manufacturer) == true) { Parser.manufacturerToDevices[device.manufacturer].Add(device); } else { Parser.manufacturerToDevices.Add(device.manufacturer, new List <DeviceInfo>() { device }); } } } }
private static void Parse_INTERNAL(string file, List<DeviceInfo> output, ParseDeviceResolutionType type) { output.Clear(); var data = Resources.Load("UI.Windows/DevicePreview/" + file) as TextAsset; if (data != null) { var lines = data.text.Split('\n'); foreach (var line in lines) { var info = line.Trim().Split(','); var device = new DeviceInfo(); device.manufacturer = info[0].Trim(); device.model = info[1].Trim(); device.orientation = ScreenOrientation.Landscape; if (device.model == "{SCREEN}") { device.current = true; device.model = "MY SCREEN"; device.width = Screen.width; device.height = Screen.height; device.ppi = Screen.dpi; } else { device.current = false; var res = info[2].Trim(); var sres = res.Split('x'); device.width = int.Parse(sres[0]); device.height = int.Parse(sres[1]); if (type == ParseDeviceResolutionType.PPI) { device.ppi = float.Parse(info[3].Trim()); } else if (type == ParseDeviceResolutionType.INCHES) { device.ppi = Parser.ConvertInchesToPPI(float.Parse(info[3]), device.width, device.height); } } var devOutput = info.Length > 4 ? info[4].Trim() : string.Empty; device.deviceOutput = devOutput; output.Add(device); if (Parser.manufacturerToDevices.ContainsKey(device.manufacturer) == true) { Parser.manufacturerToDevices[device.manufacturer].Add(device); } else { Parser.manufacturerToDevices.Add(device.manufacturer, new List<DeviceInfo>() { device }); } } } }