private static string OnPackageReceived(JSONValue jval, Package package) { string text = "unknown"; try { if (!jval.ContainsKey("id")) { string result = null; return(result); } string empty = string.Empty; string empty2 = string.Empty; string empty3 = string.Empty; string empty4 = string.Empty; string empty5 = string.Empty; bool isCompleteProjects = false; string empty6 = string.Empty; string empty7 = string.Empty; string empty8 = string.Empty; text = "id"; if (!jval[text].IsNull()) { package.versionId = int.Parse(jval[text].AsString(false)); } text = "name"; jval.Copy(text, ref empty, false); text = "version_name"; jval.Copy(text, ref empty2, false); text = "root_guid"; jval.Copy(text, ref empty3, false); text = "root_path"; jval.Copy(text, ref empty4, false); text = "project_path"; jval.Copy(text, ref empty5, false); text = "is_complete_project"; jval.Copy(text, ref isCompleteProjects); text = "preview_url"; jval.Copy(text, ref empty6); text = "icon_url"; jval.Copy(text, ref empty7); text = "status"; jval.Copy(text, ref empty8); package.Name = empty; package.VersionName = empty2; package.RootGUID = empty3; package.RootPath = empty4; package.ProjectPath = empty5; package.IsCompleteProjects = isCompleteProjects; package.PreviewURL = empty6; package.SetStatus(empty8); if (!string.IsNullOrEmpty(empty7)) { package.SetIconURL(empty7); } } catch (JSONTypeException ex) { string result = string.Concat(new string[] { "Malformed metadata response for package '", package.Name, "' field '", text, "': ", ex.Message }); return(result); } catch (KeyNotFoundException ex2) { string result = string.Concat(new string[] { "Malformed metadata response for package. '", package.Name, "' field '", text, "': ", ex2.Message }); return(result); } return(null); }
private static string OnPackageReceived(JSONValue jval, Package package) { string str; string str1 = "unknown"; try { if (jval.ContainsKey("id")) { string empty = string.Empty; string empty1 = string.Empty; string empty2 = string.Empty; string str2 = string.Empty; string empty3 = string.Empty; bool flag = false; string str3 = string.Empty; string empty4 = string.Empty; string str4 = string.Empty; str1 = "id"; if (!jval[str1].IsNull()) { JSONValue item = jval[str1]; package.versionId = int.Parse(item.AsString(false)); } str1 = "name"; jval.Copy(str1, ref empty, false); str1 = "version_name"; jval.Copy(str1, ref empty1, false); str1 = "root_guid"; jval.Copy(str1, ref empty2, false); str1 = "root_path"; jval.Copy(str1, ref str2, false); str1 = "project_path"; jval.Copy(str1, ref empty3, false); str1 = "is_complete_project"; jval.Copy(str1, ref flag); str1 = "preview_url"; jval.Copy(str1, ref str3); str1 = "icon_url"; jval.Copy(str1, ref empty4); str1 = "status"; jval.Copy(str1, ref str4); package.Name = empty; package.VersionName = empty1; package.RootGUID = empty2; package.RootPath = str2; package.ProjectPath = empty3; package.IsCompleteProjects = flag; package.PreviewURL = str3; package.SetStatus(str4); if (!string.IsNullOrEmpty(empty4)) { package.SetIconURL(empty4); } return(null); } else { str = null; } } catch (JSONTypeException jSONTypeException1) { JSONTypeException jSONTypeException = jSONTypeException1; str = string.Concat(new string[] { "Malformed metadata response for package '", package.Name, "' field '", str1, "': ", jSONTypeException.Message }); } catch (KeyNotFoundException keyNotFoundException1) { KeyNotFoundException keyNotFoundException = keyNotFoundException1; str = string.Concat(new string[] { "Malformed metadata response for package. '", package.Name, "' field '", str1, "': ", keyNotFoundException.Message }); } return(str); }