public override void Load() { this.chanLstBin = new ChanLstBin(); this.chanLstBin.Load(this.FileName, msg => this.logMessages.AppendLine(msg)); this.dataFilePaths.Add(this.FileName); if (chanLstBin.VersionMajor >= 25 && chanLstBin.VersionMajor <= 45) // need VC2010 Redist for the SQLite library { DepencencyChecker.AssertVc2010RedistPackageX86Installed(); } var dir = Path.GetDirectoryName(this.FileName) ?? ""; var channellib = Path.Combine(dir, "channellib"); var s2channellib = Path.Combine(dir, "s2channellib"); if (chanLstBin.VersionMajor <= 11) { LoadDvbCT(dvbtChannels, Path.Combine(channellib, "AntennaDigSrvTable"), "CableDigSrvTable_entry"); LoadDvbCTPresets(dvbtChannels, Path.Combine(channellib, "AntennaPresetTable")); LoadDvbCT(dvbcChannels, Path.Combine(channellib, "CableDigSrvTable"), "CableDigSrvTable_entry"); LoadDvbCTPresets(dvbcChannels, Path.Combine(channellib, "CablePresetTable")); LoadDvbsSatellites(Path.Combine(s2channellib, "satellite.dat")); LoadDvbsTransponders(Path.Combine(s2channellib, "tuneinfo.dat")); LoadDvbS(satChannels, Path.Combine(s2channellib, "service.dat"), "service.dat_entry"); LoadDvbsFavorites(Path.Combine(s2channellib, "favorite.dat")); var db_file_info = Path.Combine(s2channellib, "db_file_info.dat"); if (File.Exists(db_file_info)) { this.dataFilePaths.Add(db_file_info); } } else if (chanLstBin.VersionMajor >= 25 && chanLstBin.VersionMajor <= 45) { // version 25-45 LoadDvbCT(dvbtChannels, Path.Combine(channellib, "TerrestrialDb.bin"), "Map45_CableDb.bin_entry"); LoadDvbCT(dvbcChannels, Path.Combine(channellib, "CableDb.bin"), "Map45_CableDb.bin_entry"); LoadDvbS(satChannels, Path.Combine(s2channellib, "SatelliteDb.bin"), "Map45_SatelliteDb.bin_entry"); var tvDbFile = Path.Combine(dir, "tv.db"); if (File.Exists(tvDbFile)) { this.dataFilePaths.Add(tvDbFile); } } // for a proper ChanSort backup/restore with .bak files, the Philips _backup.dat files must also be included foreach (var file in this.dataFilePaths.ToList()) { if (file.Contains(".dat")) { this.dataFilePaths.Add(file.Replace(".dat", "_backup.dat")); } } }
public override void Load() { // read all files from a directory structure that looks like // ./CM_TPM1013E_LA_CK.xml // - or - // ChannelMap_100/ChannelList/channellib/DVBC.xml // ChannelMap_100/ChannelList/channellib/DVBT.xml // ChannelMap_100/ChannelList/s2channellib/DVBS.xml // ChannelMap_100/ChannelList/s2channellib/DVBSall.xml // ChannelMap_100/ChannelList/chanLst.bin // + optionally // ChannelMap_100/ChannelList/channelFile.bin // ChannelMap_100/ChannelList/Favorite.xml // ChannelMap_100/ChannelList/satInfo.bin var dataFiles = new[] { @"channellib\DVBC.xml", @"channellib\DVBT.xml", @"s2channellib\DVBS.xml", @"s2channellib\DVBSall.xml", @"Favorite.xml" }; // support for files in a ChannelMap_xxx directory structure bool isChannelMapFolderStructure = false; var dir = Path.GetDirectoryName(this.FileName); var dirName = Path.GetFileName(dir).ToLower(); if (dirName == "channellib" || dirName == "s2channellib") { dir = Path.GetDirectoryName(dir); isChannelMapFolderStructure = true; } var binFile = Path.Combine(dir, "chanLst.bin"); // the .bin file is used as a proxy for the whole directory structure if (File.Exists(binFile)) { this.FileName = binFile; isChannelMapFolderStructure = true; this.chanLstBin = new ChanLstBin(); this.chanLstBin.Load(this.FileName, msg => this.logMessages.AppendLine(msg)); } else if (Path.GetExtension(this.FileName).ToLower() == ".bin") { // older Philips models export a visible file like Repair\CM_T911_LA_CK.BIN and an invisible (hidden+system) .xml file with the same name var xmlPath = Path.Combine(dir, Path.GetFileNameWithoutExtension(this.FileName) + ".xml"); if (File.Exists(xmlPath)) { try { File.SetAttributes(xmlPath, FileAttributes.Archive); } catch { /**/ } this.FileName = xmlPath; } } if (isChannelMapFolderStructure) { foreach (var file in dataFiles) { var fullPath = Path.GetFullPath(Path.Combine(dir, file)); this.LoadFile(fullPath); } if (this.fileDataList.Count == 0) { throw new FileLoadException("No XML files found in folder structure"); } } else { // otherwise load the single file that was originally selected by the user LoadFile(this.FileName); } }