mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-01-16 04:12:03 +01:00
- Philips loaders will show model and file format version under File / File information...
This commit is contained in:
@@ -138,6 +138,9 @@ namespace ChanSort.Api
|
||||
}
|
||||
#endregion
|
||||
|
||||
public virtual string TvModelName { get; set; }
|
||||
public virtual string FileFormatVersion { get; set; }
|
||||
|
||||
public virtual void ShowDeviceSettingsForm(object parentWindow) { }
|
||||
|
||||
public virtual string CleanUpChannelData() { return ""; }
|
||||
|
||||
@@ -95,6 +95,9 @@ namespace ChanSort.Loader.Philips
|
||||
{
|
||||
this.chanLstBin = new ChanLstBin();
|
||||
this.chanLstBin.Load(this.FileName, msg => this.logMessages.AppendLine(msg));
|
||||
this.TvModelName = this.chanLstBin.ModelName;
|
||||
this.FileFormatVersion = $"{chanLstBin.VersionMajor}.{chanLstBin.VersionMinor}";
|
||||
|
||||
this.dataFilePaths.Add(this.FileName);
|
||||
|
||||
var dir = Path.GetDirectoryName(this.FileName) ?? "";
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace ChanSort.Loader.Philips
|
||||
var actualCrc = Crc16.Calc(data, 0, length);
|
||||
if (actualCrc != expectedCrc)
|
||||
{
|
||||
var msg = $"chanLst.bin: stored CRC for {entry.Key} is {expectedCrc:x4} but calculated {actualCrc:x4}";
|
||||
var msg = $"chanLst.bin: stored CRC for {entry.Key} is {expectedCrc:X4} but calculated {actualCrc:X4}";
|
||||
errors += "\n" + msg;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ reorderRecordsByChannelNumber=false
|
||||
|
||||
|
||||
############################################################################
|
||||
# ChannelMap_45 with list.db, tv.db, HsvDvbCSettings, CableDb.bin, HsvDvbTSettings.bin, TerrestrialDb.bin, SatelliteDb.bin - experimental
|
||||
# ChannelMap_45 with list.db, tv.db, HsvDvbCSettings, CableDb.bin, HsvDvbTSettings.bin, TerrestrialDb.bin, SatelliteDb.bin - stable
|
||||
|
||||
[Map45]
|
||||
incrementFavListVersion=false
|
||||
|
||||
@@ -62,6 +62,9 @@ namespace ChanSort.Loader.Philips
|
||||
var lc = Path.GetFileName(file).ToLowerInvariant();
|
||||
switch (lc)
|
||||
{
|
||||
case "channel_db_ver.db":
|
||||
LoadVersion(file);
|
||||
break;
|
||||
case "mgr_chan_s_fta.db":
|
||||
LoadDvbs(file);
|
||||
validList = true;
|
||||
@@ -72,7 +75,40 @@ namespace ChanSort.Loader.Philips
|
||||
if (!validList)
|
||||
throw new FileLoadException(this.FileName + " is not a supported Philips Repair/mgr_chan_s_fta.db channel list");
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region LoadVersion()
|
||||
private void LoadVersion(string file)
|
||||
{
|
||||
var data = File.ReadAllBytes(file);
|
||||
this.FileFormatVersion = "FLASH/.db";
|
||||
if (data.Length >= 2)
|
||||
this.FileFormatVersion += " " + BitConverter.ToInt16(data, 0);
|
||||
if (data.Length >= 3)
|
||||
this.FileFormatVersion += $"-{data[2]:D2}";
|
||||
if (data.Length >= 4)
|
||||
this.FileFormatVersion += $"-{data[3]:D2}";
|
||||
if (data.Length >= 5)
|
||||
this.FileFormatVersion += $" {data[4]:D2}";
|
||||
if (data.Length >= 6)
|
||||
this.FileFormatVersion += $":{data[5]:D2}";
|
||||
if (data.Length >= 7)
|
||||
this.FileFormatVersion += $":{data[6]:D2}";
|
||||
|
||||
// Philips doesn't export any information about the TV model in this format. For automated stats I manually place modelinfo.txt files in the folders
|
||||
for (var dir = Path.GetDirectoryName(file); dir != ""; dir = Path.GetDirectoryName(dir))
|
||||
{
|
||||
var path = Path.Combine(dir, "modelinfo.txt");
|
||||
if (File.Exists(path))
|
||||
{
|
||||
this.TvModelName = File.ReadAllText(path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region LoadDvbs()
|
||||
private void LoadDvbs(string file)
|
||||
{
|
||||
var data = File.ReadAllBytes(file);
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using ChanSort.Api;
|
||||
@@ -173,6 +174,8 @@ namespace ChanSort.Loader.Philips
|
||||
isChannelMapFolderStructure = true;
|
||||
this.chanLstBin = new ChanLstBin();
|
||||
this.chanLstBin.Load(this.FileName, msg => this.logMessages.AppendLine(msg));
|
||||
this.TvModelName = this.chanLstBin.ModelName;
|
||||
this.FileFormatVersion = $"{chanLstBin.VersionMajor}.{chanLstBin.VersionMinor}";
|
||||
}
|
||||
else if (Path.GetExtension(this.FileName).ToLowerInvariant() == ".bin")
|
||||
{
|
||||
@@ -183,6 +186,11 @@ namespace ChanSort.Loader.Philips
|
||||
try { File.SetAttributes(xmlPath, FileAttributes.Archive);}
|
||||
catch { /**/ }
|
||||
this.FileName = xmlPath;
|
||||
var baseName = Path.GetFileNameWithoutExtension(xmlPath).ToUpperInvariant();
|
||||
if (baseName.StartsWith("CM_"))
|
||||
baseName = baseName.Substring(3);
|
||||
this.TvModelName = baseName;
|
||||
this.FileFormatVersion = "Legacy XML";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1890,17 +1890,25 @@ namespace ChanSort.Ui
|
||||
{
|
||||
if (this.currentTvSerializer == null)
|
||||
return;
|
||||
var info = this.currentTvSerializer.GetFileInformation();
|
||||
|
||||
var info = new StringBuilder();
|
||||
if (!string.IsNullOrEmpty(this.currentTvSerializer.TvModelName))
|
||||
info.AppendLine("TV model name: " + this.currentTvSerializer.TvModelName);
|
||||
if (!string.IsNullOrEmpty(this.currentTvSerializer.FileFormatVersion))
|
||||
info.AppendLine("List format version: " + this.currentTvSerializer.FileFormatVersion);
|
||||
|
||||
info.AppendLine();
|
||||
info.AppendLine(this.currentTvSerializer.GetFileInformation());
|
||||
|
||||
if (this.DataRoot.Warnings.Length > 0)
|
||||
{
|
||||
var lines = this.DataRoot.Warnings.ToString().Split('\n');
|
||||
Array.Sort(lines);
|
||||
var sortedWarnings = string.Join("\n", lines);
|
||||
info += "\r\n\r\n\r\n" + Resources.MainForm_LoadFiles_ValidationWarningMsg + "\r\n\r\n" + sortedWarnings;
|
||||
info.Append("\r\n\r\n\r\n").Append(Resources.MainForm_LoadFiles_ValidationWarningMsg).Append("\r\n\r\n").Append(sortedWarnings);
|
||||
}
|
||||
|
||||
InfoBox.Show(this, info, this.miFileInformation.Caption.Replace("...", "").Replace("&", ""));
|
||||
InfoBox.Show(this, info.ToString(), this.miFileInformation.Caption.Replace("...", "").Replace("&", ""));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in New Issue
Block a user