/// <summary> /// According to hardwareId, return model and chip type. /// </summary> /// <param name="hardwareId"></param> /// <returns>DeviceInfo</returns> public static ModelInfo GetDeviceInfo(this ModelInfoDic dic, string hardwareId) { ModelInfo info; if (dic.TryGetValue(hardwareId, out info)) { return(info); } return(dic[""]); //Unknown }
static ModelInfoDic LoadModelInfoDic() { var bundlePath = NSBundle.MainBundle.BundlePath; var filename = System.IO.Path.Combine(bundlePath, "ModelInfo.json"); try { var s = System.IO.File.ReadAllText(filename); return(ModelInfoDic.Create(s)); } catch (Exception ex) { Console.WriteLine(ex.ToString()); throw; } }