public static byte[] ReadFromBytes(string path, UIB_FileTypes kind) { var ext = ""; byte[] fileData = null; switch (kind) { case UIB_FileTypes.Images: ext = ".jpg"; if (File.Exists(path + ext)) { fileData = File.ReadAllBytes(path + ext); } ext = ".jpeg"; if (File.Exists(path + ext)) { fileData = File.ReadAllBytes(path + ext); } ext = ".png"; if (File.Exists(path + ext)) { fileData = File.ReadAllBytes(path + ext); } break; case UIB_FileTypes.Videos: Debug.Log("Videos"); break; case UIB_FileTypes.Text: Debug.Log("Text"); break; default: Debug.Log("Default case"); break; } return(fileData); }
internal static bool FileExists(string path, UIB_FileTypes kind) { var ext = ""; switch (kind) { case UIB_FileTypes.Images: ext = ".jpg"; if (File.Exists(path + ext)) { return(true); } ext = ".jpeg"; if (File.Exists(path + ext)) { return(true); } ext = ".png"; if (File.Exists(path + ext)) { return(true); } break; case UIB_FileTypes.Videos: Debug.Log("Videos"); break; case UIB_FileTypes.Text: Debug.Log("Text"); break; default: Debug.Log("Default case"); break; } return(false); }