mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-02-05 22:19:03 +01:00
some more code cleanup and a few minor fixes
This commit is contained in:
@@ -56,7 +56,7 @@ Special thanks to Hisense for supporting ChanSort with technical information and
|
||||
|
||||
**Samsung**
|
||||
.scm files: B (2009)*, B (2013), C, D, E, F, H, J series
|
||||
.zip files: H, J, K, M, N and Q series
|
||||
.zip files: H, J, K, M, N and Q, R series
|
||||
Lists: Air analog, Air digital, Cable analog, Cable digital,
|
||||
Cable Prime, Sat digital, Astra HD+, Freesat, TivuSat,
|
||||
Canal Digital Sat, Digital+, Cyfra+
|
||||
|
||||
@@ -55,7 +55,7 @@ Besonderen Dank an Hisense f
|
||||
|
||||
**Samsung**
|
||||
.scm Dateien: Serien B (2009)*, B (2013), C, D, E, F, H, J
|
||||
.zip Dateien: Serien H, J, K, M, N and Q series
|
||||
.zip Dateien: Serien H, J, K, M, N, Q, R
|
||||
Listen: Air analog, Air digital, Cable analog, Cable digital,
|
||||
Cable Prime, Sat digital, Astra HD+, Freesat, TivuSat,
|
||||
Canal Digital Sat, Digital+, Cyfra+
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Data" />
|
||||
|
||||
@@ -10,7 +10,6 @@ namespace ChanSort.Api
|
||||
public DataRoot DataRoot;
|
||||
public ChannelList ChannelList;
|
||||
public int SubListIndex;
|
||||
private UnsortedChannelMode unsortedChannelMode;
|
||||
|
||||
#region AddChannels()
|
||||
|
||||
@@ -344,75 +343,6 @@ namespace ChanSort.Api
|
||||
|
||||
#endregion
|
||||
|
||||
#region AutoNumberingForUnassignedChannels()
|
||||
|
||||
public void AutoNumberingForUnassignedChannels(UnsortedChannelMode mode)
|
||||
{
|
||||
this.unsortedChannelMode = mode;
|
||||
foreach (var list in DataRoot.ChannelLists)
|
||||
{
|
||||
if (list.IsMixedSourceFavoritesList)
|
||||
continue;
|
||||
|
||||
// sort the channels by assigned numbers, then unassigned by original order or alphabetically, then deleted channels
|
||||
var sortedChannels = list.Channels.OrderBy(ChanSortCriteria).ToList();
|
||||
int maxProgNr = 0;
|
||||
|
||||
foreach (var appChannel in sortedChannels)
|
||||
{
|
||||
if (appChannel.IsProxy)
|
||||
continue;
|
||||
|
||||
if (appChannel.NewProgramNr == -1)
|
||||
{
|
||||
if (mode == UnsortedChannelMode.Delete)
|
||||
appChannel.IsDeleted = true;
|
||||
else // append (hidden if possible)
|
||||
{
|
||||
appChannel.Hidden = true;
|
||||
appChannel.Skip = true;
|
||||
}
|
||||
|
||||
// assign a valid number or 0 .... because -1 will never be a valid value for the TV
|
||||
appChannel.NewProgramNr = mode != UnsortedChannelMode.Delete || this.DataRoot.DeletedChannelsNeedNumbers ? ++maxProgNr : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (appChannel.NewProgramNr > maxProgNr)
|
||||
maxProgNr = appChannel.NewProgramNr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region ChanSortCriteria()
|
||||
|
||||
private string ChanSortCriteria(ChannelInfo channel)
|
||||
{
|
||||
// explicitly sorted
|
||||
var pos = channel.NewProgramNr;
|
||||
if (pos != -1)
|
||||
return pos.ToString("d5");
|
||||
|
||||
// eventually hide unsorted channels
|
||||
if (this.unsortedChannelMode == UnsortedChannelMode.Delete)
|
||||
return "Z" + channel.RecordIndex.ToString("d5");
|
||||
|
||||
// eventually append in old order
|
||||
if (this.unsortedChannelMode == UnsortedChannelMode.AppendInOrder)
|
||||
return "B" + channel.OldProgramNr.ToString("d5");
|
||||
|
||||
// sort alphabetically, with "." and "" on the bottom
|
||||
if (channel.Name == ".")
|
||||
return "B";
|
||||
if (channel.Name == "")
|
||||
return "C";
|
||||
return "A" + channel.Name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region SetFavorites()
|
||||
public void SetFavorites(List<ChannelInfo> list, Favorites favorites, bool set)
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ChanSort.Api
|
||||
{
|
||||
public abstract class SerializerBase
|
||||
public abstract class SerializerBase : IDisposable
|
||||
{
|
||||
#region class SupportedFeatures
|
||||
|
||||
@@ -33,10 +33,6 @@ namespace ChanSort.Api
|
||||
public bool MixedSourceFavorites { get; set; }
|
||||
public bool AllowGapsInFavNumbers { get; set; }
|
||||
|
||||
public bool CanDeleteChannelsWithFlag => this.DeleteMode == DeleteMode.FlagWithPrNr || this.DeleteMode == DeleteMode.FlagWithoutPrNr;
|
||||
public bool CanDeleteChannelsFromFile => this.DeleteMode == DeleteMode.Physically;
|
||||
public bool DeletedChannelsNeedNumbers => this.DeleteMode == DeleteMode.FlagWithPrNr;
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -107,43 +103,67 @@ namespace ChanSort.Api
|
||||
|
||||
// common implementation helper methods
|
||||
|
||||
protected string UnzipFileToTempFolder()
|
||||
{
|
||||
var tempDir = this.FileName + ".tmp";
|
||||
protected string TempPath { get; set; }
|
||||
|
||||
if (Directory.Exists(tempDir))
|
||||
Directory.Delete(tempDir, true);
|
||||
Directory.CreateDirectory(tempDir);
|
||||
ZipFile.ExtractToDirectory(this.FileName, tempDir);
|
||||
this.DeleteOnExit(tempDir);
|
||||
return tempDir;
|
||||
#region UnzipToTempFolder(), ZipToOutputFile()
|
||||
|
||||
protected void UnzipFileToTempFolder()
|
||||
{
|
||||
this.DeleteTempPath();
|
||||
this.TempPath = Path.Combine(Path.GetTempPath(), "ChanSort_" + Path.GetRandomFileName());
|
||||
|
||||
if (Directory.Exists(this.TempPath))
|
||||
Directory.Delete(this.TempPath, true);
|
||||
Directory.CreateDirectory(this.TempPath);
|
||||
ZipFile.ExtractToDirectory(this.FileName, this.TempPath);
|
||||
}
|
||||
|
||||
protected void ZipToOutputFile(string tvOutputFile)
|
||||
{
|
||||
var tempDir = this.FileName + ".tmp";
|
||||
File.Delete(tvOutputFile);
|
||||
ZipFile.CreateFromDirectory(tempDir, tvOutputFile);
|
||||
ZipFile.CreateFromDirectory(this.TempPath, tvOutputFile);
|
||||
this.FileName = tvOutputFile;
|
||||
}
|
||||
#endregion
|
||||
|
||||
// TODO: replace this with a SerializerBase implementing IDisposable
|
||||
protected virtual void DeleteOnExit(string fileOrFolder)
|
||||
#region IDisposable
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Application.ApplicationExit += (sender, args) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(fileOrFolder))
|
||||
Directory.Delete(fileOrFolder, true);
|
||||
else if (File.Exists(fileOrFolder))
|
||||
File.Delete(fileOrFolder);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
};
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
~SerializerBase()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
this.DeleteTempPath();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region DeleteTempPath()
|
||||
protected void DeleteTempPath()
|
||||
{
|
||||
var path = this.TempPath;
|
||||
if (string.IsNullOrEmpty(path))
|
||||
return;
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(path))
|
||||
Directory.Delete(path, true);
|
||||
else if (File.Exists(path))
|
||||
File.Delete(path);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ChanSort.Api
|
||||
@@ -21,7 +22,7 @@ namespace ChanSort.Api
|
||||
public bool SortedFavorites => this.loader.Features.SortedFavorites;
|
||||
public bool MixedSourceFavorites => this.loader.Features.MixedSourceFavorites;
|
||||
public bool AllowGapsInFavNumbers => this.loader.Features.AllowGapsInFavNumbers;
|
||||
public bool DeletedChannelsNeedNumbers => this.loader.Features.DeletedChannelsNeedNumbers;
|
||||
public bool DeletedChannelsNeedNumbers => this.loader.Features.DeleteMode == SerializerBase.DeleteMode.FlagWithPrNr;
|
||||
|
||||
public DataRoot(SerializerBase loader)
|
||||
{
|
||||
@@ -142,6 +143,73 @@ namespace ChanSort.Api
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region AssignNumbersToUnsortedAndDeletedChannels()
|
||||
|
||||
public void AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode mode)
|
||||
{
|
||||
foreach (var list in this.ChannelLists)
|
||||
{
|
||||
if (list.IsMixedSourceFavoritesList)
|
||||
continue;
|
||||
|
||||
// sort the channels by assigned numbers, then unassigned by original order or alphabetically, then deleted channels
|
||||
var sortedChannels = list.Channels.OrderBy(ch => ChanSortCriteria(ch, mode));
|
||||
int maxProgNr = 0;
|
||||
|
||||
foreach (var appChannel in sortedChannels)
|
||||
{
|
||||
if (appChannel.IsProxy)
|
||||
continue;
|
||||
|
||||
if (appChannel.NewProgramNr == -1)
|
||||
{
|
||||
if (mode == UnsortedChannelMode.Delete)
|
||||
appChannel.IsDeleted = true;
|
||||
else // append (hidden if possible)
|
||||
{
|
||||
appChannel.Hidden = true;
|
||||
appChannel.Skip = true;
|
||||
}
|
||||
|
||||
// assign a valid number or 0 .... because -1 will never be a valid value for the TV
|
||||
appChannel.NewProgramNr = mode != UnsortedChannelMode.Delete || this.DeletedChannelsNeedNumbers ? ++maxProgNr : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
appChannel.IsDeleted = false;
|
||||
if (appChannel.NewProgramNr > maxProgNr)
|
||||
maxProgNr = appChannel.NewProgramNr;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private string ChanSortCriteria(ChannelInfo channel, UnsortedChannelMode mode)
|
||||
{
|
||||
// explicitly sorted
|
||||
var pos = channel.NewProgramNr;
|
||||
if (pos != -1)
|
||||
return pos.ToString("d5");
|
||||
|
||||
// eventually hide unsorted channels
|
||||
if (mode == UnsortedChannelMode.Delete)
|
||||
return "Z" + channel.RecordIndex.ToString("d5");
|
||||
|
||||
// eventually append in old order
|
||||
if (mode == UnsortedChannelMode.AppendInOrder)
|
||||
return "B" + channel.OldProgramNr.ToString("d5");
|
||||
|
||||
// sort alphabetically, with "." and "" on the bottom
|
||||
if (channel.Name == ".")
|
||||
return "B";
|
||||
if (channel.Name == "")
|
||||
return "C";
|
||||
return "A" + channel.Name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region ValidateAfterSave()
|
||||
public virtual void ValidateAfterSave()
|
||||
{
|
||||
|
||||
@@ -98,15 +98,14 @@ namespace ChanSort.Loader.Panasonic
|
||||
if (cypherMode == CypherMode.None)
|
||||
return this.FileName;
|
||||
|
||||
var tempFile = this.FileName + ".tmp";
|
||||
File.Delete(tempFile);
|
||||
this.DeleteOnExit(tempFile);
|
||||
this.TempPath = Path.GetTempFileName();
|
||||
this.DeleteTempPath();
|
||||
|
||||
if (cypherMode == CypherMode.Encryption)
|
||||
this.CypherFile(this.FileName, tempFile, false);
|
||||
this.CypherFile(this.FileName, this.TempPath, false);
|
||||
else
|
||||
this.RemoveHeader(this.FileName, tempFile);
|
||||
return tempFile;
|
||||
this.RemoveHeader(this.FileName, this.TempPath);
|
||||
return this.TempPath;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -105,33 +105,33 @@ namespace ChanSort.Loader.Samsung
|
||||
#region Load()
|
||||
public override void Load()
|
||||
{
|
||||
var tempDir = this.UnzipFileToTempFolder();
|
||||
this.UnzipFileToTempFolder();
|
||||
|
||||
DetectModelConstants(tempDir);
|
||||
DetectModelConstants(this.TempPath);
|
||||
Features.SupportedFavorites = c.supportedFavorites;
|
||||
Features.SortedFavorites = c.SortedFavorites == FavoritesIndexMode.IndividuallySorted;
|
||||
|
||||
ReadAnalogFineTuning(tempDir);
|
||||
ReadAnalogChannels(tempDir, "map-AirA", this.avbtChannels, out this.avbtFileContent, this.avbtFrequency);
|
||||
ReadAnalogChannels(tempDir, "map-CableA", this.avbcChannels, out this.avbcFileContent, this.avbcFrequency);
|
||||
ReadAnalogChannels(tempDir, "map-AirCableMixedA", this.avbxChannels, out this.avbxFileContent, this.avbcFrequency);
|
||||
ReadDvbTransponderFrequenciesFromPtc(tempDir, "PTCAIR", this.dvbtFrequency);
|
||||
ReadDvbServiceProviders(tempDir);
|
||||
ReadDvbctChannels(tempDir, "map-AirD", this.dvbtChannels, out this.dvbtFileContent, this.dvbtFrequency);
|
||||
ReadDvbTransponderFrequenciesFromPtc(tempDir, "PTCCABLE", this.dvbcFrequency);
|
||||
ReadDvbctChannels(tempDir, "map-CableD", this.dvbcChannels, out this.dvbcFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(tempDir, "map-AirCableMixedD", this.dvbxChannels, out this.dvbxFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(tempDir, "map-CablePrime_D", this.primeChannels, out this.primeFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(tempDir, "map-FreesatD", this.freesatChannels, out this.freesatFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(tempDir, "map-TivusatD", this.tivusatChannels, out this.tivusatFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(tempDir, "map-CanalDigitalSatD", this.canalDigitalChannels, out this.canalDigitalFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(tempDir, "map-DigitalPlusD", this.digitalPlusChannels, out this.digitalPlusFileContent, this.dvbcFrequency);
|
||||
ReadSatellites(tempDir);
|
||||
ReadTransponder(tempDir, "UserTransponderDataBase.dat"); // read user data first so it has priority over overridden default transponsers
|
||||
ReadTransponder(tempDir, "TransponderDataBase.dat");
|
||||
ReadDvbsChannels(tempDir, "map-SateD", this.dvbsChannels, out this.dvbsFileContent, c.dvbsChannelLength);
|
||||
ReadDvbsChannels(tempDir, "map-CyfraPlusD", this.cyfraPlusChannels, out this.cyfraPlusFileContent, c.cyfraPlusChannelSize);
|
||||
ReadAstraHdPlusChannels(tempDir);
|
||||
ReadAnalogFineTuning(this.TempPath);
|
||||
ReadAnalogChannels(this.TempPath, "map-AirA", this.avbtChannels, out this.avbtFileContent, this.avbtFrequency);
|
||||
ReadAnalogChannels(this.TempPath, "map-CableA", this.avbcChannels, out this.avbcFileContent, this.avbcFrequency);
|
||||
ReadAnalogChannels(this.TempPath, "map-AirCableMixedA", this.avbxChannels, out this.avbxFileContent, this.avbcFrequency);
|
||||
ReadDvbTransponderFrequenciesFromPtc(this.TempPath, "PTCAIR", this.dvbtFrequency);
|
||||
ReadDvbServiceProviders(this.TempPath);
|
||||
ReadDvbctChannels(this.TempPath, "map-AirD", this.dvbtChannels, out this.dvbtFileContent, this.dvbtFrequency);
|
||||
ReadDvbTransponderFrequenciesFromPtc(this.TempPath, "PTCCABLE", this.dvbcFrequency);
|
||||
ReadDvbctChannels(this.TempPath, "map-CableD", this.dvbcChannels, out this.dvbcFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(this.TempPath, "map-AirCableMixedD", this.dvbxChannels, out this.dvbxFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(this.TempPath, "map-CablePrime_D", this.primeChannels, out this.primeFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(this.TempPath, "map-FreesatD", this.freesatChannels, out this.freesatFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(this.TempPath, "map-TivusatD", this.tivusatChannels, out this.tivusatFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(this.TempPath, "map-CanalDigitalSatD", this.canalDigitalChannels, out this.canalDigitalFileContent, this.dvbcFrequency);
|
||||
ReadDvbctChannels(this.TempPath, "map-DigitalPlusD", this.digitalPlusChannels, out this.digitalPlusFileContent, this.dvbcFrequency);
|
||||
ReadSatellites(this.TempPath);
|
||||
ReadTransponder(this.TempPath, "UserTransponderDataBase.dat"); // read user data first so it has priority over overridden default transponsers
|
||||
ReadTransponder(this.TempPath, "TransponderDataBase.dat");
|
||||
ReadDvbsChannels(this.TempPath, "map-SateD", this.dvbsChannels, out this.dvbsFileContent, c.dvbsChannelLength);
|
||||
ReadDvbsChannels(this.TempPath, "map-CyfraPlusD", this.cyfraPlusChannels, out this.cyfraPlusFileContent, c.cyfraPlusChannelSize);
|
||||
ReadAstraHdPlusChannels(this.TempPath);
|
||||
|
||||
|
||||
foreach (var list in this.DataRoot.ChannelLists)
|
||||
@@ -630,7 +630,7 @@ namespace ChanSort.Loader.Samsung
|
||||
#region Save()
|
||||
public override void Save(string tvOutputFile)
|
||||
{
|
||||
string zip = this.FileName + ".tmp";
|
||||
string zip = this.TempPath;
|
||||
this.SaveChannels(zip, "map-AirA", this.avbtChannels, this.avbtFileContent);
|
||||
this.SaveChannels(zip, "map-CableA", this.avbcChannels, this.avbcFileContent);
|
||||
this.SaveChannels(zip, "map-AirCableMixedA", this.avbxChannels, this.avbxFileContent);
|
||||
|
||||
@@ -16,7 +16,6 @@ namespace ChanSort.Loader.SamsungJ
|
||||
{
|
||||
private readonly Dictionary<long, DbChannel> channelById = new Dictionary<long, DbChannel>();
|
||||
private readonly Dictionary<ChannelList, string> dbPathByChannelList = new Dictionary<ChannelList, string>();
|
||||
private string tempDir;
|
||||
|
||||
private enum FileType { Unknown, SatDb, ChannelDbDvb, ChannelDbAnalog }
|
||||
|
||||
@@ -39,12 +38,12 @@ namespace ChanSort.Loader.SamsungJ
|
||||
{
|
||||
try
|
||||
{
|
||||
this.tempDir = this.UnzipFileToTempFolder();
|
||||
if (File.Exists(tempDir + "\\sat"))
|
||||
this.UnzipFileToTempFolder();
|
||||
if (File.Exists(this.TempPath + "\\sat"))
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var conn = new SQLiteConnection("Data Source=" + tempDir + "\\sat"))
|
||||
using (var conn = new SQLiteConnection("Data Source=" + this.TempPath + "\\sat"))
|
||||
{
|
||||
conn.Open();
|
||||
this.ReadSatDatabase(conn);
|
||||
@@ -55,7 +54,7 @@ namespace ChanSort.Loader.SamsungJ
|
||||
}
|
||||
}
|
||||
|
||||
var files = Directory.GetFiles(tempDir, "*.");
|
||||
var files = Directory.GetFiles(this.TempPath, "*.");
|
||||
if (files.Length == 0)
|
||||
throw new FileLoadException("The Samsung .zip channel list archive does not contain any supported files.");
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@ namespace ChanSort.Loader.Toshiba
|
||||
{
|
||||
class DbSerializer : SerializerBase
|
||||
{
|
||||
private const string FILE_chmgt_db = "chmgt_type001\\chmgt.db";
|
||||
private const string FILE_dvbSysData_db = "dvb_type001\\dvbSysData.db";
|
||||
private const string FILE_dvbMainData_db = "dvb_type001\\dvbMainData.db";
|
||||
private const string FILE_chmgt_db = "\\chmgt_type001\\chmgt.db";
|
||||
private const string FILE_dvbSysData_db = "\\dvb_type001\\dvbSysData.db";
|
||||
private const string FILE_dvbMainData_db = "\\dvb_type001\\dvbMainData.db";
|
||||
|
||||
private readonly ChannelList atvChannels = new ChannelList(SignalSource.AnalogCT, "Analog");
|
||||
private readonly ChannelList dtvTvChannels = new ChannelList(SignalSource.DvbCT | SignalSource.Tv, "DTV");
|
||||
@@ -18,8 +18,6 @@ namespace ChanSort.Loader.Toshiba
|
||||
private readonly ChannelList satRadioChannels = new ChannelList(SignalSource.DvbS | SignalSource.Radio, "Sat-Radio");
|
||||
private readonly Dictionary<string, bool> channelInfoByUid = new Dictionary<string, bool>();
|
||||
|
||||
private string tempDir;
|
||||
|
||||
#region ctor()
|
||||
public DbSerializer(string inputFile) : base(inputFile)
|
||||
{
|
||||
@@ -39,9 +37,9 @@ namespace ChanSort.Loader.Toshiba
|
||||
#region Load()
|
||||
public override void Load()
|
||||
{
|
||||
this.tempDir = this.UnzipFileToTempFolder() + "\\";
|
||||
this.UnzipFileToTempFolder();
|
||||
|
||||
string sysDataConnString = "Data Source=" + tempDir + FILE_dvbSysData_db;
|
||||
string sysDataConnString = "Data Source=" + this.TempPath + FILE_dvbSysData_db;
|
||||
using (var conn = new SQLiteConnection(sysDataConnString))
|
||||
{
|
||||
conn.Open();
|
||||
@@ -53,7 +51,7 @@ namespace ChanSort.Loader.Toshiba
|
||||
}
|
||||
}
|
||||
|
||||
string mainDataConnString = "Data Source=" + tempDir + FILE_dvbMainData_db;
|
||||
string mainDataConnString = "Data Source=" + this.TempPath + FILE_dvbMainData_db;
|
||||
using (var conn = new SQLiteConnection(mainDataConnString))
|
||||
{
|
||||
conn.Open();
|
||||
@@ -63,7 +61,7 @@ namespace ChanSort.Loader.Toshiba
|
||||
}
|
||||
}
|
||||
|
||||
string channelConnString = "Data Source=" + tempDir + FILE_chmgt_db;
|
||||
string channelConnString = "Data Source=" + this.TempPath + FILE_chmgt_db;
|
||||
using (var conn = new SQLiteConnection(channelConnString))
|
||||
{
|
||||
conn.Open();
|
||||
@@ -236,7 +234,7 @@ namespace ChanSort.Loader.Toshiba
|
||||
#region Save()
|
||||
public override void Save(string tvOutputFile)
|
||||
{
|
||||
string channelConnString = "Data Source=" + this.tempDir + FILE_chmgt_db;
|
||||
string channelConnString = "Data Source=" + this.TempPath + FILE_chmgt_db;
|
||||
using (var conn = new SQLiteConnection(channelConnString))
|
||||
{
|
||||
conn.Open();
|
||||
|
||||
@@ -498,9 +498,10 @@ namespace ChanSort.Ui
|
||||
var errorMsgs = new StringBuilder();
|
||||
foreach (var plugin in candidates)
|
||||
{
|
||||
SerializerBase serializer = null;
|
||||
try
|
||||
{
|
||||
var serializer = plugin.CreateSerializer(inputFileName);
|
||||
serializer = plugin.CreateSerializer(inputFileName);
|
||||
if (serializer != null)
|
||||
{
|
||||
serializer.DefaultEncoding = this.defaultEncoding;
|
||||
@@ -511,6 +512,7 @@ namespace ChanSort.Ui
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
serializer?.Dispose();
|
||||
errorMsgs.AppendLine($"{plugin.DllName} ({plugin.PluginName}): {ex}\n\n");
|
||||
if (ex is ArgumentException)
|
||||
{
|
||||
@@ -551,6 +553,8 @@ namespace ChanSort.Ui
|
||||
if (!this.PromptSaveAndContinue())
|
||||
return false;
|
||||
|
||||
this.currentTvSerializer?.Dispose();
|
||||
|
||||
serializer.DataRoot.ValidateAfterLoad();
|
||||
this.SetFileName(tvDataFile);
|
||||
this.currentPlugin = plugin;
|
||||
@@ -795,7 +799,7 @@ namespace ChanSort.Ui
|
||||
{
|
||||
foreach (var channel in list.Channels)
|
||||
{
|
||||
if (channel.NewProgramNr < 0 && (!channel.IsDeleted /* || DataRoot.DeletedChannelsNeedNumbers */))
|
||||
if (channel.NewProgramNr < 0 && !channel.IsDeleted)
|
||||
{
|
||||
hasUnsorted = true;
|
||||
break;
|
||||
@@ -812,7 +816,7 @@ namespace ChanSort.Ui
|
||||
using (var dlg = new ActionBoxDialog(msg))
|
||||
{
|
||||
dlg.AddAction(Resources.MainForm_PromptHandlingOfUnsortedChannels_Append, DialogResult.Yes, dlg.FullList);
|
||||
if (this.currentTvSerializer.Features.CanDeleteChannelsWithFlag || this.currentTvSerializer.Features.CanDeleteChannelsFromFile)
|
||||
if (this.currentTvSerializer.Features.DeleteMode != SerializerBase.DeleteMode.NotSupported)
|
||||
dlg.AddAction(Resources.MainForm_PromptHandlingOfUnsortedChannels_Delete, DialogResult.No, dlg.Delete);
|
||||
dlg.AddAction(Resources.MainForm_Cancel, DialogResult.Cancel, dlg.Cancel);
|
||||
res = dlg.ShowDialog(this);
|
||||
@@ -825,7 +829,7 @@ namespace ChanSort.Ui
|
||||
}
|
||||
|
||||
// ensure unsorted and deleted channels have a valid program number
|
||||
this.Editor.AutoNumberingForUnassignedChannels(mode);
|
||||
this.DataRoot.AssignNumbersToUnsortedAndDeletedChannels(mode);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2543,7 +2547,10 @@ namespace ChanSort.Ui
|
||||
try
|
||||
{
|
||||
if (this.PromptSaveAndContinue())
|
||||
{
|
||||
this.SaveSettings();
|
||||
this.currentTvSerializer?.Dispose();
|
||||
}
|
||||
else
|
||||
e.Cancel = true;
|
||||
}
|
||||
|
||||
@@ -1246,7 +1246,7 @@
|
||||
<value>globalImageCollection1</value>
|
||||
</data>
|
||||
<data name=">>globalImageCollection1.Type" xml:space="preserve">
|
||||
<value>ChanSort.Ui.GlobalImageCollection, ChanSort, Version=1.0.7248.39737, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ChanSort.Ui.GlobalImageCollection, ChanSort, Version=1.0.7251.34158, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>gviewRight.Name" xml:space="preserve">
|
||||
<value>gviewRight</value>
|
||||
@@ -1933,7 +1933,7 @@
|
||||
<value>DevExpress.XtraEditors.XtraForm, DevExpress.Utils.v19.2, Version=19.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
|
||||
</data>
|
||||
<data name="SharedImageCollection.Timestamp" type="System.DateTime, mscorlib">
|
||||
<value>11/05/2019 22:23:13</value>
|
||||
<value>11/08/2019 19:29:15</value>
|
||||
</data>
|
||||
<data name="SharedImageCollection.ImageSize" type="System.Drawing.Size, System.Drawing">
|
||||
<value>16, 16</value>
|
||||
|
||||
13
source/ChanSort/ReferenceListForm.Designer.cs
generated
13
source/ChanSort/ReferenceListForm.Designer.cs
generated
@@ -7,19 +7,6 @@
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -27,6 +27,16 @@ namespace ChanSort.Ui
|
||||
this.UpdateButtons();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
this.components?.Dispose();
|
||||
this.serializer.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region UpdateButtons()
|
||||
private void UpdateButtons()
|
||||
{
|
||||
@@ -91,6 +101,8 @@ namespace ChanSort.Ui
|
||||
#region SetInput()
|
||||
private void SetInput(SerializerBase ser)
|
||||
{
|
||||
this.serializer?.Dispose();
|
||||
|
||||
this.serializer = ser;
|
||||
this.edFile.Text = serializer.FileName;
|
||||
this.rbAuto.Enabled = this.rbManual.Enabled = true;
|
||||
|
||||
@@ -83,9 +83,7 @@ namespace Test.Loader.GlobalClone
|
||||
Assert.IsFalse(orf2w.IsDeleted);
|
||||
|
||||
orf2w.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2w.IsDeleted);
|
||||
Assert.AreNotEqual(-1, orf2w.NewProgramNr);
|
||||
|
||||
@@ -72,9 +72,7 @@ namespace Test.Loader.Hisense
|
||||
Assert.IsFalse(orf2e.IsDeleted);
|
||||
|
||||
orf2e.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.AppendInOrder);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.AppendInOrder);
|
||||
|
||||
Assert.IsFalse(orf2e.IsDeleted);
|
||||
Assert.IsTrue(orf2e.NewProgramNr > 0);
|
||||
|
||||
@@ -71,9 +71,7 @@ namespace Test.Loader.Hisense2017
|
||||
Assert.IsFalse(orf2e.IsDeleted);
|
||||
|
||||
orf2e.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2e.IsDeleted);
|
||||
Assert.IsTrue(orf2e.NewProgramNr > 0);
|
||||
|
||||
@@ -62,9 +62,7 @@ namespace Test.Loader.LG
|
||||
Assert.IsFalse(orf2.IsDeleted);
|
||||
|
||||
orf2.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2.IsDeleted);
|
||||
Assert.AreEqual(0, orf2.NewProgramNr);
|
||||
|
||||
@@ -72,9 +72,7 @@ namespace Test.Loader.Panasonic
|
||||
Assert.IsFalse(orf2e.IsDeleted);
|
||||
|
||||
orf2e.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2e.IsDeleted);
|
||||
Assert.IsTrue(orf2e.NewProgramNr == 0);
|
||||
|
||||
@@ -80,9 +80,7 @@ namespace Test.Loader.PhilipsXml
|
||||
Assert.IsFalse(ntvHd.IsDeleted);
|
||||
|
||||
ntvHd.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(ntvHd.IsDeleted);
|
||||
Assert.IsTrue(ntvHd.NewProgramNr == 0);
|
||||
|
||||
@@ -166,9 +166,7 @@ namespace Test.Loader.Samsung
|
||||
Assert.IsFalse(orf2w.IsDeleted);
|
||||
|
||||
orf2w.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2w.IsDeleted);
|
||||
Assert.AreNotEqual(-1, orf2w.NewProgramNr);
|
||||
@@ -218,9 +216,7 @@ namespace Test.Loader.Samsung
|
||||
Assert.IsFalse(orf2w.IsDeleted);
|
||||
|
||||
orf2w.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2w.IsDeleted);
|
||||
Assert.AreNotEqual(-1, orf2w.NewProgramNr);
|
||||
|
||||
@@ -54,9 +54,6 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.SharpZipLib">
|
||||
<HintPath>..\DLL\ICSharpCode.SharpZipLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<Choose>
|
||||
|
||||
@@ -85,9 +85,7 @@ namespace Test.Loader.SamsungJ
|
||||
Assert.IsFalse(orf2e.IsDeleted);
|
||||
|
||||
orf2e.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2e.IsDeleted);
|
||||
Assert.AreNotEqual(-1, orf2e.NewProgramNr);
|
||||
|
||||
@@ -66,9 +66,7 @@ namespace Test.Loader.SilvaSchneider
|
||||
Assert.IsFalse(orf2e.IsDeleted);
|
||||
|
||||
orf2e.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2e.IsDeleted);
|
||||
Assert.IsTrue(orf2e.NewProgramNr == 0);
|
||||
|
||||
@@ -102,9 +102,7 @@ namespace Test.Loader.Sony
|
||||
Assert.IsFalse(orf2e.IsDeleted);
|
||||
|
||||
orf2e.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2e.IsDeleted);
|
||||
Assert.IsTrue(orf2e.NewProgramNr > 0);
|
||||
@@ -151,9 +149,7 @@ namespace Test.Loader.Sony
|
||||
Assert.IsFalse(orf2e.IsDeleted);
|
||||
|
||||
orf2e.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2e.IsDeleted);
|
||||
Assert.IsTrue(orf2e.NewProgramNr == 0);
|
||||
|
||||
@@ -89,9 +89,7 @@ namespace Test.Loader.Toshiba
|
||||
Assert.IsFalse(orf2e.IsDeleted);
|
||||
|
||||
orf2e.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2e.IsDeleted);
|
||||
Assert.IsTrue(orf2e.NewProgramNr == 0);
|
||||
|
||||
@@ -60,9 +60,7 @@ namespace Test.Loader.VDR
|
||||
Assert.IsFalse(orf2e.IsDeleted);
|
||||
|
||||
orf2e.NewProgramNr = -1;
|
||||
var editor = new Editor();
|
||||
editor.DataRoot = data;
|
||||
editor.AutoNumberingForUnassignedChannels(UnsortedChannelMode.Delete);
|
||||
data.AssignNumbersToUnsortedAndDeletedChannels(UnsortedChannelMode.Delete);
|
||||
|
||||
Assert.IsTrue(orf2e.IsDeleted);
|
||||
Assert.IsTrue(orf2e.NewProgramNr == 0);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
cd /d %~dp0
|
||||
set curdate=%date:~6,4%-%date:~3,2%-%date:~0,2%
|
||||
set target=%cd%\..\..\ChanSort_%curdate%
|
||||
set DXversion=19.1
|
||||
set DXversion=19.2
|
||||
mkdir "%target%" 2>nul
|
||||
del /s /q "%target%\*"
|
||||
copy debug\ChanSort.exe* "%target%"
|
||||
|
||||
Reference in New Issue
Block a user