/// <summary> /// Get Info for an Image /// </summary> /// <param name="dir">Dirname</param> /// <param name="filename">Filename</param> /// <returns>Json-String with Imageinformation</returns> public bool GetImageInfo(string dir, string filename) { bool ret = false; try { string filepath = dir + "/" + filename; if (dir == "latest") { filepath = dir; } string url; url = String.Format(urlGetFileInfo, CameraIP, filepath); if (simCamera) { Content = File.ReadAllText(@"simfiles\info.txt"); ErrCode = ""; } else { http.HttpSend(url, "GET", "", out Content, out ErrCode); } if (!String.IsNullOrEmpty(ErrCode)) { throw new Exception(ErrCode); } else { PhotoInfo = http.JsonDeserialize <photoinfo>(Content); } ret = true; LastErrorStr = ""; } catch (Exception ex) { if (ex.InnerException == null) { LastErrorStr = String.Format("Error GetImageInfo: {0}", ex.Message); } else { LastErrorStr = String.Format("Error GetImageInfo: {0}, InnerEx: {1}", ex.Message, ex.InnerException.Message); } log.Error(LastErrorStr); } return(ret); }
/// <summary> /// Get Info for an Image /// </summary> /// <param name="dir">Dirname</param> /// <param name="filename">Filename</param> /// <returns>Json-String with Imageinformation</returns> public bool GetImageInfo(string dir, string filename) { bool ret = false; try { string filepath = dir + "/" + filename; if (dir == "latest") filepath = dir; string url; url = String.Format(urlGetFileInfo, CameraIP, filepath); if (simCamera) { Content = File.ReadAllText(@"simfiles\info.txt"); ErrCode = ""; } else { http.HttpSend(url, "GET", "", out Content, out ErrCode); } if (!String.IsNullOrEmpty(ErrCode)) { throw new Exception(ErrCode); } else { PhotoInfo = http.JsonDeserialize<photoinfo>(Content); } ret = true; LastErrorStr = ""; } catch (Exception ex) { if (ex.InnerException == null) LastErrorStr = String.Format("Error GetImageInfo: {0}", ex.Message); else LastErrorStr = String.Format("Error GetImageInfo: {0}, InnerEx: {1}", ex.Message, ex.InnerException.Message); log.Error(LastErrorStr); } return ret; }