public static byte[] GetImage(string sPath) { byte[] data = null; try { var s = Directory.GetCurrentDirectory(); var c = GetDirectory.TryGetSolutionDirectoryInfo(s); var Path = c.FullName + @"\eKino.Model\Images\" + sPath; FileInfo fInfo = new FileInfo(Path); long numBytes = fInfo.Length; FileStream fStream = new FileStream(Path, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fStream); data = br.ReadBytes((int)numBytes); } catch (Exception) { return(null); } return(data); }
public static string GetImagePath(string sPath) { var s = Directory.GetCurrentDirectory(); var c = GetDirectory.TryGetSolutionDirectoryInfo(s); var Path = c.FullName + @"\eKino.Model\Images\" + sPath; return(Path); }