public static DlcVersionInfo FromJson(string jsonString) { DlcVersionInfo result = new DlcVersionInfo(); try { JsonData jsonData = JsonMapper.ToObject(jsonString); result.Version = VersionNumber.Parse(jsonData["version"].ToString()); result.Url = jsonData["url"].ToString(); return(result); } catch (Exception e) { Debug.LogError(e); return(null); } }
public static GetDlcListResponseMessage FromJson(string jsonString) { GetDlcListResponseMessage result = new GetDlcListResponseMessage(); try { JsonData jsonData = JsonMapper.ToObject(jsonString); result.DlcVersionInfoList = new List <DlcVersionInfo>(); for (int i = 0; i < jsonData["message"].Count; i++) { result.DlcVersionInfoList.Add(DlcVersionInfo.FromJson(jsonData["message"][i].ToJson())); } result.DlcVersionInfoList.Sort(DlcVersionInfo.SortCore); return(result); } catch (Exception e) { Debug.LogError(e); return(null); } }
public static int SortCore(DlcVersionInfo dlcVersionInfo1, DlcVersionInfo dlcVersionInfo2) { return(dlcVersionInfo1.Version.CompareTo(dlcVersionInfo2.Version)); }