private DBHeader ExtractHeader(BinaryReader dbReader) { DBHeader header = null; string signature = dbReader.ReadString(4); if (string.IsNullOrWhiteSpace(signature)) { return(null); } if (signature[0] != 'W') { signature = signature.Reverse(); } switch (signature) { case "WDBC": header = new WDBC(); break; case "WDB2": case "WCH2": header = new WDB2(); break; case "WDB5": header = new WDB5(); break; case "WCH5": header = new WCH5(FileName); break; case "WCH7": header = new WCH7(FileName); break; case "WCH8": header = new WCH8(FileName); break; case "WMOB": case "WGOB": case "WQST": case "WIDB": case "WNDB": case "WITX": case "WNPC": case "WPTX": case "WRDN": header = new WDB(); break; } header?.ReadHeader(ref dbReader, signature); return(header); }
private static DBHeader ReadHeader(BinaryReader dbReader, DBHeader counterpart = null) { DBHeader header = null; string signature = dbReader.ReadString(4); if (string.IsNullOrWhiteSpace(signature)) { return(null); } if (signature[0] != 'W') { signature = signature.Reverse(); } switch (signature) { case "WDBC": header = new WDBC(); break; case "WDB2": case "WCH2": header = new WDB2(); break; case "WDB5": header = new WDB5(); break; case "WDB6": header = new WDB6(); break; case "WCH5": header = new WCH5(counterpart); break; case "WCH7": header = new WCH7(counterpart); break; case "WCH8": header = new WCH8(counterpart); break; case "WMOB": case "WGOB": case "WQST": case "WIDB": case "WNDB": case "WITX": case "WNPC": case "WPTX": case "WRDN": header = new WDB(); break; case "HTFX": header = new HTFX(); break; } header?.ReadHeader(ref dbReader, signature); return(header); }