/// <summary> /// NbHttpException発生時にResponseからエラー情報を取得する /// </summary> /// <param name="response">Response情報</param> /// <param name="error">Responseから情報を取得するキー</param> /// <returns>エラー情報</returns> public static string GetErrorInfo(HttpResponseMessage response, string error = "error") { if (response.Content != null) { var bodyString = response.Content.ReadAsStringAsync().Result; var responseJson = NbJsonObject.Parse(bodyString); return((string)responseJson[error]); } return(null); }
/// <summary> /// ストレージからJsonを読み出す /// </summary> /// <returns>読み出した値</returns> protected NbJsonObject GetJsonFromStorage() { var attributes = File.GetAttributes(InstallationFilename); if ((attributes & FileAttributes.ReparsePoint) == FileAttributes.ReparsePoint) { // シンボリックリンクの場合は例外を投げる throw new FileNotFoundException(); } var jsonString = System.IO.File.ReadAllText(InstallationFilename); return(NbJsonObject.Parse(jsonString)); }
/// <summary> /// ストレージからJsonを読み出す /// </summary> /// <returns>読み出した値</returns> public static NbJsonObject GetJsonFromStorage() { var jsonString = System.IO.File.ReadAllText(InstallationFilename); return(NbJsonObject.Parse(jsonString)); }