private static string OnPackageReceived(JSONValue jval, Package package) { string text = "unknown"; try { if (!jval.ContainsKey("id")) { return(null); } 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) { return(string.Concat(new string[] { "Malformed metadata response for package '", package.Name, "' field '", text, "': ", ex.Message })); } catch (KeyNotFoundException ex2) { return(string.Concat(new string[] { "Malformed metadata response for package. '", package.Name, "' field '", text, "': ", ex2.Message })); } return(null); }