public static ppFormat GetFormat(string path) { ppHeader header = null; for (int i = 0; i < ppHeader.Array.Length; i++) { try { if ((header = ppHeader.Array[i].TryHeader(path)) != null) { break; } } catch { } } ppFormat resultFormat = null; if (header != null) { if (header.ppFormats.Length == 1) { resultFormat = header.ppFormats[0]; } else { List <IWriteFile> subfiles = header.ReadHeader(path, null); for (int i = 0; i < subfiles.Count; i++) { if ((resultFormat = TryFile((ppSubfile)subfiles[i], header.ppFormats)) != null) { break; } } } if (resultFormat == null) { resultFormat = header.ppFormats[0]; Report.ReportLog("Couldn't auto-detect the ppFormat for " + path + ". Using " + resultFormat.Name + " instead"); } } return(resultFormat); }
public static ppFormat GetFormat(FileStream stream, out ppHeader header) { header = null; for (int i = 0; i < ppHeader.Array.Length; i++) { try { if ((header = ppHeader.Array[i].TryHeader(stream)) != null) { break; } } catch { } } ppFormat resultFormat = null; if (header != null) { if (header.ppFormats.Length == 1) { resultFormat = header.ppFormats[0]; } else { List <IWriteFile> subfiles = header.ReadHeader(stream, null); for (int i = 0; i < subfiles.Count; i++) { if ((resultFormat = TryFile(stream, (ppSubfile)subfiles[i], header.ppFormats)) != null) { break; } } } } return(resultFormat); }
public static ppFormat GetFormat(FileStream stream, out ppHeader header) { header = null; for (int i = 0; i < ppHeader.Array.Length; i++) { try { if ((header = ppHeader.Array[i].TryHeader(stream)) != null) { break; } } catch { } } ppFormat resultFormat = null; if (header != null) { if (header.ppFormats.Length == 1) { resultFormat = header.ppFormats[0]; } else { List<IWriteFile> subfiles = header.ReadHeader(stream, null); for (int i = 0; i < subfiles.Count; i++) { if ((resultFormat = TryFile(stream, (ppSubfile)subfiles[i], header.ppFormats)) != null) { break; } } } } return resultFormat; }