- removed superfluous parameter from SerializerBase.Save()

- added "Pooling=False" parameter to all Sqlite connection strings to prevent open file locks after closing the connection and to avoid extreme delays when using CloseAllPools()
- C# code refactoring "using var" instead of "using ( ) { }" where possible
This commit is contained in:
Horst Beham
2022-11-29 22:00:16 +01:00
parent 6f3df7044e
commit d361d51b8b
57 changed files with 511 additions and 641 deletions

View File

@@ -46,27 +46,25 @@ namespace ChanSort.Api
public override void Load()
{
using (var stream = new StreamReader(this.FileName))
{
var lineNr = 0;
using var stream = new StreamReader(this.FileName);
var lineNr = 0;
var line = stream.ReadLine();
if (line != null && line.StartsWith("--------") && line.Contains(" Program Data!--------"))
throw LoaderException.TryNext("ignoring .csv file with Sharp/Dyon/Blaupunkt/Hisense header line");
var line = stream.ReadLine();
if (line != null && line.StartsWith("--------") && line.Contains(" Program Data!--------"))
throw LoaderException.TryNext("ignoring .csv file with Sharp/Dyon/Blaupunkt/Hisense header line");
try
try
{
while (line != null)
{
while (line != null)
{
this.ReadChannel(line, ++lineNr);
line = stream.ReadLine();
}
}
catch (Exception ex)
{
throw LoaderException.TryNext($"Error in reference file line #{lineNr}: {line}", ex);
this.ReadChannel(line, ++lineNr);
line = stream.ReadLine();
}
}
catch (Exception ex)
{
throw LoaderException.TryNext($"Error in reference file line #{lineNr}: {line}", ex);
}
}
#endregion
@@ -314,18 +312,15 @@ namespace ChanSort.Api
#region Save()
public override void Save(string tvDataFile)
public override void Save()
{
Save(tvDataFile, this.DataRoot);
this.FileName = tvDataFile;
Save(this.FileName, this.DataRoot);
}
public static void Save(string tvDataFile, DataRoot dataRoot)
{
using (var stream = new StreamWriter(tvDataFile))
{
Save(stream, dataRoot);
}
using var stream = new StreamWriter(tvDataFile);
Save(stream, dataRoot);
}
public static void Save(TextWriter stream, DataRoot dataRoot, bool includeDeletedChannels = true)

View File

@@ -84,7 +84,7 @@ namespace ChanSort.Api
}
public abstract void Load();
public abstract void Save(string tvOutputFile);
public abstract void Save();
public virtual Encoding DefaultEncoding
{
@@ -165,11 +165,10 @@ namespace ChanSort.Api
ZipFile.ExtractToDirectory(this.FileName, this.TempPath);
}
protected void ZipToOutputFile(string tvOutputFile, bool compress = true)
protected void ZipToOutputFile(bool compress = true)
{
File.Delete(tvOutputFile);
ZipFile.CreateFromDirectory(this.TempPath, tvOutputFile, compress ? CompressionLevel.Optimal : CompressionLevel.NoCompression, false);
this.FileName = tvOutputFile;
File.Delete(this.FileName);
ZipFile.CreateFromDirectory(this.TempPath, this.FileName, compress ? CompressionLevel.Optimal : CompressionLevel.NoCompression, false);
}
#endregion
@@ -199,6 +198,7 @@ namespace ChanSort.Api
var path = this.TempPath;
if (string.IsNullOrEmpty(path))
return;
try
{
if (Directory.Exists(path))

View File

@@ -52,37 +52,35 @@ namespace ChanSort.Api
{
var lineNr = 0;
using (var file = new StreamReader(this.FileName))
using var file = new StreamReader(this.FileName);
string line;
while ((line = file.ReadLine()) != null)
{
string line;
while ((line = file.ReadLine()) != null)
{
++lineNr;
var parts = line.Split(Separators);
if (parts.Length < 2)
continue;
int progNr;
if (!int.TryParse(parts[0], out progNr))
continue;
++lineNr;
var parts = line.Split(Separators);
if (parts.Length < 2)
continue;
int progNr;
if (!int.TryParse(parts[0], out progNr))
continue;
var channel = new ChannelInfo(SignalSource.All, lineNr, progNr, parts[1]);
if (parts.Length >= 3)
var channel = new ChannelInfo(SignalSource.All, lineNr, progNr, parts[1]);
if (parts.Length >= 3)
{
var subParts = parts[2].Split('-');
if (subParts.Length >= 3)
{
var subParts = parts[2].Split('-');
if (subParts.Length >= 3)
{
int val;
if (int.TryParse(subParts[0], out val))
channel.OriginalNetworkId = val;
if (int.TryParse(subParts[1], out val))
channel.TransportStreamId = val;
if (int.TryParse(subParts[2], out val))
channel.ServiceId = val;
}
int val;
if (int.TryParse(subParts[0], out val))
channel.OriginalNetworkId = val;
if (int.TryParse(subParts[1], out val))
channel.TransportStreamId = val;
if (int.TryParse(subParts[2], out val))
channel.ServiceId = val;
}
this.DataRoot.AddChannel(this.allChannels, channel);
lineNr++;
}
this.DataRoot.AddChannel(this.allChannels, channel);
lineNr++;
}
}
@@ -102,36 +100,33 @@ namespace ChanSort.Api
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
Save(tvOutputFile, this.allChannels);
this.FileName = tvOutputFile;
Save(this.FileName, this.allChannels);
}
public static void Save(string fileName, ChannelList list)
{
var samToolBoxMode = (Path.GetExtension(fileName) ?? "").ToLowerInvariant() == ".chl";
using (var writer = new StreamWriter(fileName, false, Encoding.UTF8))
using var writer = new StreamWriter(fileName, false, Encoding.UTF8);
foreach (var channel in list.GetChannelsByNewOrder())
{
foreach (var channel in list.GetChannelsByNewOrder())
{
if (channel.NewProgramNr == -1) continue;
if (channel.NewProgramNr == -1) continue;
writer.Write(channel.NewProgramNr);
writer.Write(channel.NewProgramNr);
writer.Write(Separators[0]);
writer.Write(channel.Name);
if (!samToolBoxMode)
{
writer.Write(Separators[0]);
writer.Write(channel.Name);
if (!samToolBoxMode)
{
writer.Write(Separators[0]);
writer.Write(channel.OriginalNetworkId);
writer.Write("-");
writer.Write(channel.TransportStreamId);
writer.Write("-");
writer.Write(channel.ServiceId);
}
writer.WriteLine();
writer.Write(channel.OriginalNetworkId);
writer.Write("-");
writer.Write(channel.TransportStreamId);
writer.Write("-");
writer.Write(channel.ServiceId);
}
writer.WriteLine();
}
}
#endregion

View File

@@ -65,21 +65,19 @@ namespace ChanSort.Api
string file = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "", "lookup.csv");
if (!File.Exists(file))
return;
using (var reader = new StreamReader(file, System.Text.Encoding.UTF8))
using var reader = new StreamReader(file, System.Text.Encoding.UTF8);
string line;
while ((line = reader.ReadLine()) != null)
{
string line;
while ((line = reader.ReadLine()) != null)
var fields = CsvFile.Parse(line, ';');
if (fields.Count == 0)
continue;
switch (fields[0].ToLowerInvariant())
{
var fields = CsvFile.Parse(line, ';');
if (fields.Count == 0)
continue;
switch (fields[0].ToLowerInvariant())
{
case "onid": this.ParseNetwork(fields); break;
case "transp": this.ParseTransponder(fields); break;
case "dvbc": this.ParseDvbcChannel(fields); break;
case "servicetype": this.ParseServiceType(fields); break;
}
case "onid": this.ParseNetwork(fields); break;
case "transp": this.ParseTransponder(fields); break;
case "dvbc": this.ParseDvbcChannel(fields); break;
case "servicetype": this.ParseServiceType(fields); break;
}
}
}

View File

@@ -90,19 +90,17 @@ namespace ChanSort.Api
private static bool SetValue(string keyPath, string name, string value, bool force = false)
{
using (var key = Registry.CurrentUser.CreateSubKey(keyPath))
using var key = Registry.CurrentUser.CreateSubKey(keyPath);
var currentValue = key.GetValue(name) as string;
var nameExists = currentValue != null;
if (nameExists)
{
var currentValue = key.GetValue(name) as string;
var nameExists = currentValue != null;
if (nameExists)
{
if (currentValue == value || !force)
return false;
}
key.SetValue(name, value);
return true;
if (currentValue == value || !force)
return false;
}
key.SetValue(name, value);
return true;
}
public static void DeleteAssociations(IEnumerable<string> extensions)
@@ -117,15 +115,13 @@ namespace ChanSort.Api
void DeleteValue(string keyPath, string name)
{
using (var key = Registry.CurrentUser.OpenSubKey(keyPath, true))
using var key = Registry.CurrentUser.OpenSubKey(keyPath, true);
if (key != null)
{
if (key != null)
{
if (name == null)
key.SetValue(null, "");
else
key.DeleteValue(name, false);
}
if (name == null)
key.SetValue(null, "");
else
key.DeleteValue(name, false);
}
}
}

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using Microsoft.Data.Sqlite;
@@ -88,7 +87,7 @@ namespace ChanSort.Loader.Android
#region Load()
public override void Load()
{
using var conn = new SqliteConnection($"Data Source={this.FileName}");
using var conn = new SqliteConnection($"Data Source={this.FileName};Pooling=False");
conn.Open();
using var cmd = conn.CreateCommand();
@@ -161,11 +160,9 @@ namespace ChanSort.Loader.Android
/// <summary>
/// The "tv.db" file was reported to exist as early as in ChannelMap_25 format and has been seen in formats 30 and 45 too
/// </summary>
public override void Save(string outputFile)
public override void Save()
{
this.FileName = outputFile;
using var conn = new SqliteConnection($"Data Source={outputFile}");
using var conn = new SqliteConnection($"Data Source={this.FileName};Pooling=False");
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();

View File

@@ -273,10 +273,8 @@ namespace ChanSort.Loader.CmdbBin
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
// save-as is not supported, the tvOutputFile is ignored
foreach (var path in this.files)
{
var name = Path.GetFileName(path).ToLowerInvariant();
@@ -331,7 +329,7 @@ namespace ChanSort.Loader.CmdbBin
}
}
File.WriteAllBytes(this.FileName, data);
File.WriteAllBytes(path, data);
}
#endregion

View File

@@ -358,7 +358,7 @@ namespace ChanSort.Loader.Enigma2
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
for (int favIndex = 0; favIndex < this.favListFileNames.Count; favIndex++)
{

View File

@@ -300,10 +300,8 @@ namespace ChanSort.Loader.Grundig
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
// "Save As..." is not supported by this loader
foreach (var list in this.DataRoot.ChannelLists)
this.UpdateChannelList(list);

View File

@@ -1,9 +1,7 @@
//#define LOCK_LCN_LISTS
using System;
using System.CodeDom;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
using Microsoft.Data.Sqlite;
using ChanSort.Api;
@@ -143,7 +141,7 @@ namespace ChanSort.Loader.Hisense.ChannelDb
public override void Load()
{
using (var conn = new SqliteConnection("Data Source=" + this.FileName))
using (var conn = new SqliteConnection($"Data Source={this.FileName};Pooling=False"))
{
conn.Open();
using var cmd = conn.CreateCommand();
@@ -466,60 +464,46 @@ namespace ChanSort.Loader.Hisense.ChannelDb
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
Editor.SequentializeFavPos(this.channelLists[6], 4);
if (tvOutputFile != this.FileName)
File.Copy(this.FileName, tvOutputFile, true);
using var conn = new SqliteConnection($"Data Source={this.FileName};Pooling=False");
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
cmd.Transaction = trans;
try
{
using var conn = new SqliteConnection("Data Source=" + tvOutputFile);
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
cmd.Transaction = trans;
try
{
this.CreateFavTables(cmd);
this.CreateFavTables(cmd);
// must truncate and re-fill this table because there is a unique primary key constraint on a data column that needs to be edited
if (this.hasCamelCaseFavSchema)
// must truncate and re-fill this table because there is a unique primary key constraint on a data column that needs to be edited
if (this.hasCamelCaseFavSchema)
{
for (int i = 1; i <= 4; i++)
{
for (int i = 1; i <= 4; i++)
{
cmd.CommandText = $"delete from fav_{i}";
cmd.ExecuteNonQuery();
}
cmd.CommandText = $"delete from fav_{i}";
cmd.ExecuteNonQuery();
}
}
#if !LOCK_LCN_LISTS
this.ResetLcn(cmd);
this.ResetLcn(cmd);
#endif
foreach (var list in this.DataRoot.ChannelLists)
{
if (list.ReadOnly || list.IsMixedSourceFavoritesList)
continue;
foreach (var ci in list.Channels)
this.UpdateChannel(cmd, ci as Channel);
}
trans.Commit();
this.FileName = tvOutputFile;
}
catch
foreach (var list in this.DataRoot.ChannelLists)
{
trans.Rollback();
throw;
if (list.ReadOnly || list.IsMixedSourceFavoritesList)
continue;
foreach (var ci in list.Channels)
this.UpdateChannel(cmd, ci as Channel);
}
trans.Commit();
}
finally
catch
{
// force closing the file and releasing the locks
SqliteConnection.ClearAllPools();
GC.Collect();
GC.WaitForPendingFinalizers();
trans.Rollback();
throw;
}
}
#endregion

View File

@@ -2,7 +2,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using ChanSort.Api;
using Microsoft.Data.Sqlite;
@@ -115,7 +114,7 @@ namespace ChanSort.Loader.Hisense.ServicelistDb
public override void Load()
{
using (var conn = new SqliteConnection("Data Source=" + FileName))
using (var conn = new SqliteConnection($"Data Source={this.FileName};Pooling=False"))
{
conn.Open();
using (var cmd = conn.CreateCommand())
@@ -444,41 +443,27 @@ left outer join {dbSchema.DvbServiceTable} digs on digs.ServiceId=s.Pid
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
if (tvOutputFile != FileName)
File.Copy(FileName, tvOutputFile, true);
using var conn = new SqliteConnection($"Data Source={this.FileName};Pooling=False");
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
try
{
using var conn = new SqliteConnection("Data Source=" + tvOutputFile);
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
try
{
#if !LOCK_LCN_LISTS
ResetLcn(cmd);
ResetLcn(cmd);
#endif
UpdateServices(cmd);
UpdatePhysicalChannelLists(cmd);
UpdateUserFavoriteLists(cmd);
UpdateServices(cmd);
UpdatePhysicalChannelLists(cmd);
UpdateUserFavoriteLists(cmd);
trans.Commit();
FileName = tvOutputFile;
}
catch
{
trans.Rollback();
throw;
}
trans.Commit();
}
finally
catch
{
// force closing the file and releasing the locks
SqliteConnection.ClearAllPools();
GC.Collect();
GC.WaitForPendingFinalizers();
trans.Rollback();
throw;
}
}

View File

@@ -904,7 +904,7 @@ Due to issues with most recent LG firmwares such lists can no longer be modified
// Saving ====================================
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
int newAnalogChannelCount;
int newDvbctChannelCount;
@@ -928,36 +928,34 @@ Due to issues with most recent LG firmwares such lists can no longer be modified
if (this.dvbsSubblockCrcOffset != null)
this.UpdateDvbsChecksums();
using (var file = new BinaryWriter(new FileStream(tvOutputFile, FileMode.Create, FileAccess.Write)))
{
// header
file.Write(this.fileContent, 0, this.analogBlockOffset);
using var file = new BinaryWriter(new FileStream(this.FileName, FileMode.Create, FileAccess.Write));
// header
file.Write(this.fileContent, 0, this.analogBlockOffset);
// analog
file.Write(newAnalogChannelCount*this.actChannelSize + 4);
file.Write(newAnalogChannelCount);
file.Write(fileContent, this.analogBlockOffset + 8, newAnalogChannelCount*this.actChannelSize);
// analog
file.Write(newAnalogChannelCount*this.actChannelSize + 4);
file.Write(newAnalogChannelCount);
file.Write(fileContent, this.analogBlockOffset + 8, newAnalogChannelCount*this.actChannelSize);
// firmware
file.Write(fileContent, this.firmwareBlockOffset, this.firmwareBlockSize + 4);
// firmware
file.Write(fileContent, this.firmwareBlockOffset, this.firmwareBlockSize + 4);
// hospitality models extra block
if (hospitalityBlockOffset != 0)
file.Write(fileContent, this.hospitalityBlockOffset, this.hospitalityBlockSize + 4);
// hospitality models extra block
if (hospitalityBlockOffset != 0)
file.Write(fileContent, this.hospitalityBlockOffset, this.hospitalityBlockSize + 4);
// DVB-CT
file.Write(newDvbctChannelCount*this.actChannelSize + 4);
file.Write(newDvbctChannelCount);
file.Write(fileContent, this.dvbctBlockOffset + 8, newDvbctChannelCount * this.actChannelSize);
// DVB-CT
file.Write(newDvbctChannelCount*this.actChannelSize + 4);
file.Write(newDvbctChannelCount);
file.Write(fileContent, this.dvbctBlockOffset + 8, newDvbctChannelCount * this.actChannelSize);
// DVB-S
if (this.dvbsBlockOffset != 0)
file.Write(fileContent, this.dvbsBlockOffset, this.dvbsBlockSize + 4);
// DVB-S
if (this.dvbsBlockOffset != 0)
file.Write(fileContent, this.dvbsBlockOffset, this.dvbsBlockSize + 4);
// rest (including settings)
if (this.settingsBlockOffset != 0)
file.Write(fileContent, this.settingsBlockOffset, fileContent.Length - this.settingsBlockOffset);
}
// rest (including settings)
if (this.settingsBlockOffset != 0)
file.Write(fileContent, this.settingsBlockOffset, fileContent.Length - this.settingsBlockOffset);
}
#endregion

View File

@@ -67,19 +67,15 @@ from channel c inner join chanseq s on s.listid=c.listid and s.slot=c.slot
if (list == null || list.Count == 0)
return;
using (var conn = SqlClientFactory.Instance.CreateConnection())
{
conn.ConnectionString = "server=(local);database=ChanSort;Integrated Security=true";
conn.Open();
using var conn = SqlClientFactory.Instance.CreateConnection();
conn.ConnectionString = "server=(local);database=ChanSort;Integrated Security=true";
conn.Open();
using (var cmd = conn.CreateCommand())
{
var listId = InsertListData(cmd);
using var cmd = conn.CreateCommand();
var listId = InsertListData(cmd);
InsertChannelLinkedList(cmd, listId);
InsertChannelData(cmd, listId);
}
}
InsertChannelLinkedList(cmd, listId);
InsertChannelData(cmd, listId);
}
#endregion

View File

@@ -292,7 +292,7 @@ namespace ChanSort.Loader.GlobalClone
// saving
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
this.UpdateJsonDoc();
@@ -307,8 +307,7 @@ namespace ChanSort.Loader.GlobalClone
var json = EscapeXml(sw.ToString());
sb.Append(json);
sb.Append(xmlSuffix);
File.WriteAllText(tvOutputFile, sb.ToString());
this.FileName = tvOutputFile;
File.WriteAllText(this.FileName, sb.ToString());
}
#endregion

View File

@@ -52,10 +52,8 @@ namespace ChanSort.Loader.GlobalClone
throw LoaderException.Fail("Invalid GlobalClone/XML file format. Maybe a binary xx*.TLL file?");
textContent = ReplaceInvalidXmlCharacters(textContent);
var settings = new XmlReaderSettings { CheckCharacters = false };
using (var reader = XmlReader.Create(new StringReader(textContent), settings))
{
doc.Load(reader);
}
using var reader = XmlReader.Create(new StringReader(textContent), settings);
doc.Load(reader);
}
catch
{
@@ -354,41 +352,39 @@ namespace ChanSort.Loader.GlobalClone
// A 3 byte UTF-8 envelope is used to encode 2 input bytes: 1110aaaa 10bbbbcc 10ccdddd represents the 16bit little endian integer aaaabbbbccccdddd, which represents bytes ccccdddd, aaaabbbb
// If a remaining byte is >= 0x80, it is encoded in a 2 byte UTF-8 envelope: 110000aa 10aabbbb represents the byte aaaabbbb
// If a remaining byte is < 0x80, it is encoded directly into a 1 byte UTF-8 char. (This can cause invalid XML files for values < 0x20.)
using (MemoryStream ms = new MemoryStream(40))
using MemoryStream ms = new MemoryStream(40);
for (int i = 0, c = bytes.Length; i < c; i++)
{
for (int i = 0, c = bytes.Length; i < c; i++)
int b0 = bytes[i + 0];
if (b0 >= 0xE0) // 3-byte UTF envelope for 2 input bytes
{
int b0 = bytes[i + 0];
if (b0 >= 0xE0) // 3-byte UTF envelope for 2 input bytes
{
int b1 = bytes[i + 1];
int b2 = bytes[i + 2];
int ch1 = ((b1 & 0x03) << 6) | (b2 & 0x3F);
int ch2 = ((b0 & 0x0F) << 4) | ((b1 & 0x3C) >> 2);
ms.WriteByte((byte) ch1);
ms.WriteByte((byte) ch2);
i += 2;
}
else if (b0 >= 0xC0) // 2-byte UTF envelope for 1 input byte >= 0x80
{
int b1 = bytes[i + 1];
int ch = ((b0 & 0x03) << 6) | (b1 & 0x3F);
ms.WriteByte((byte)ch);
i++;
}
else if (b0 < 0x80) // 1-byte UTF envelope for 1 input byte < 0x80
ms.WriteByte(bytes[i]);
int b1 = bytes[i + 1];
int b2 = bytes[i + 2];
int ch1 = ((b1 & 0x03) << 6) | (b2 & 0x3F);
int ch2 = ((b0 & 0x0F) << 4) | ((b1 & 0x3C) >> 2);
ms.WriteByte((byte) ch1);
ms.WriteByte((byte) ch2);
i += 2;
}
else if (b0 >= 0xC0) // 2-byte UTF envelope for 1 input byte >= 0x80
{
int b1 = bytes[i + 1];
int ch = ((b0 & 0x03) << 6) | (b1 & 0x3F);
ms.WriteByte((byte)ch);
i++;
}
else if (b0 < 0x80) // 1-byte UTF envelope for 1 input byte < 0x80
ms.WriteByte(bytes[i]);
}
string longName, shortName;
this.dvbStringDecoder.GetChannelNames(ms.GetBuffer(), 0, (int)ms.Length, out longName, out shortName);
return longName;
}
string longName, shortName;
this.dvbStringDecoder.GetChannelNames(ms.GetBuffer(), 0, (int)ms.Length, out longName, out shortName);
return longName;
}
#endregion
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
foreach (var list in this.DataRoot.ChannelLists)
{
@@ -485,22 +481,20 @@ namespace ChanSort.Loader.GlobalClone
settings.OmitXmlDeclaration = true;
settings.IndentChars = "";
settings.CheckCharacters = false;
using (StringWriter sw = new StringWriter())
using (XmlWriter xw = XmlWriter.Create(sw, settings))
{
doc.Save(xw);
xw.Flush();
string xml = RestoreInvalidXmlCharacters(sw.ToString());
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n" + xml;
xml = xml.Replace("<ATV></ATV>\r\n", "<ATV>\r\n</ATV>\r\n");
xml = xml.Replace("<DTV></DTV>\r\n", "<DTV>\r\n</DTV>\r\n");
xml = xml.Replace("<hexAszTkgsMessage type=\"0\"></hexAszTkgsMessage>", "<hexAszTkgsMessage type=\"0\"> </hexAszTkgsMessage>");
xml = xml.Replace("<aszTkgsMessage type=\"0\"></aszTkgsMessage>", "<aszTkgsMessage type=\"0\"> </aszTkgsMessage>");
using StringWriter sw = new StringWriter();
using XmlWriter xw = XmlWriter.Create(sw, settings);
doc.Save(xw);
xw.Flush();
string xml = RestoreInvalidXmlCharacters(sw.ToString());
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n\r\n" + xml;
xml = xml.Replace("<ATV></ATV>\r\n", "<ATV>\r\n</ATV>\r\n");
xml = xml.Replace("<DTV></DTV>\r\n", "<DTV>\r\n</DTV>\r\n");
xml = xml.Replace("<hexAszTkgsMessage type=\"0\"></hexAszTkgsMessage>", "<hexAszTkgsMessage type=\"0\"> </hexAszTkgsMessage>");
xml = xml.Replace("<aszTkgsMessage type=\"0\"></aszTkgsMessage>", "<aszTkgsMessage type=\"0\"> </aszTkgsMessage>");
if (!xml.EndsWith("\r\n"))
xml += "\r\n";
File.WriteAllText(tvOutputFile, xml, settings.Encoding);
}
if (!xml.EndsWith("\r\n"))
xml += "\r\n";
File.WriteAllText(this.FileName, xml, settings.Encoding);
}
#endregion

View File

@@ -391,7 +391,7 @@ class Serializer : SerializerBase
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
var fav = this.doc["servicelist"]["favorites"];
var elements = fav.GetElementsByTagName("favorite-item");
@@ -456,8 +456,7 @@ class Serializer : SerializerBase
foreach (XmlNode item in lcn)
fav.AppendChild(item);
doc.Save(tvOutputFile);
this.FileName = tvOutputFile;
doc.Save(this.FileName);
}
#endregion

View File

@@ -274,9 +274,9 @@ namespace ChanSort.Loader.M3u
#endregion
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
using var file = new StreamWriter(new FileStream(tvOutputFile, FileMode.Create), this.overrideEncoding ?? this.DefaultEncoding);
using var file = new StreamWriter(new FileStream(this.FileName, FileMode.Create), this.overrideEncoding ?? this.DefaultEncoding);
file.NewLine = this.newLine;
foreach(var line in this.headerLines)
@@ -303,8 +303,6 @@ namespace ChanSort.Loader.M3u
foreach(var line in this.trailingLines)
file.WriteLine(line);
this.FileName = tvOutputFile;
}
#endregion

View File

@@ -183,7 +183,7 @@ internal class IdtvChannelSerializer : SerializerBase
if (!File.Exists(binFile))
throw LoaderException.Fail("expected file not found: " + binFile);
string connString = "Data Source=" + this.dbFile;
string connString = $"Data Source={this.dbFile};Pooling=False";
using var db = new SqliteConnection(connString);
db.Open();
using var cmd = db.CreateCommand();
@@ -409,7 +409,7 @@ internal class IdtvChannelSerializer : SerializerBase
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
// saving the list requires to:
// - update fields inside the .bin file data records and physically reorder the records
@@ -593,66 +593,56 @@ internal class IdtvChannelSerializer : SerializerBase
#region SaveTvDb()
private void SaveTvDb(IDictionary<ushort, int> newChannelIndexMap)
{
try
string connString = $"Data Source={this.dbFile};Pooling=False";
using var db = new SqliteConnection(connString);
db.Open();
using var trans = db.BeginTransaction();
using var upd = db.CreateCommand();
upd.CommandText = "update channels set display_number=@progNr, browsable=@browseable, locked=@locked, favorite=@fav, channel_index=@recIdx where _id=@id"; // searchable=@searchable,
upd.Parameters.Add("@id", SqliteType.Integer);
upd.Parameters.Add("@progNr", SqliteType.Text);
upd.Parameters.Add("@browseable", SqliteType.Integer);
//upd.Parameters.Add("@searchable", SqliteType.Integer);
upd.Parameters.Add("@locked", SqliteType.Integer);
upd.Parameters.Add("@fav", SqliteType.Integer);
upd.Parameters.Add("@recIdx", SqliteType.Integer);
//upd.Parameters.Add("@ipf2", SqliteType.Integer);
upd.Prepare();
using var del = db.CreateCommand();
del.CommandText = "delete from channels where _id=@id";
del.Parameters.Add("@id", SqliteType.Integer);
del.Prepare();
foreach (var list in this.DataRoot.ChannelLists)
{
string connString = "Data Source=" + this.dbFile;
using var db = new SqliteConnection(connString);
db.Open();
using var trans = db.BeginTransaction();
using var upd = db.CreateCommand();
upd.CommandText = "update channels set display_number=@progNr, browsable=@browseable, locked=@locked, favorite=@fav, channel_index=@recIdx where _id=@id"; // searchable=@searchable,
upd.Parameters.Add("@id", SqliteType.Integer);
upd.Parameters.Add("@progNr", SqliteType.Text);
upd.Parameters.Add("@browseable", SqliteType.Integer);
//upd.Parameters.Add("@searchable", SqliteType.Integer);
upd.Parameters.Add("@locked", SqliteType.Integer);
upd.Parameters.Add("@fav", SqliteType.Integer);
upd.Parameters.Add("@recIdx", SqliteType.Integer);
//upd.Parameters.Add("@ipf2", SqliteType.Integer);
upd.Prepare();
using var del = db.CreateCommand();
del.CommandText = "delete from channels where _id=@id";
del.Parameters.Add("@id", SqliteType.Integer);
del.Prepare();
foreach (var list in this.DataRoot.ChannelLists)
foreach (var ch in list.Channels)
{
foreach (var ch in list.Channels)
if (ch is not DbChannel dbc)
continue;
if (ch.NewProgramNr < 0 || ch.IsDeleted)
{
if (ch is not DbChannel dbc)
continue;
if (ch.NewProgramNr < 0 || ch.IsDeleted)
{
del.Parameters["@id"].Value = ch.RecordIndex;
del.ExecuteNonQuery();
}
else
{
upd.Parameters["@id"].Value = ch.RecordIndex;
upd.Parameters["@progNr"].Value = ch.NewProgramNr;
upd.Parameters["@browseable"].Value = !ch.Skip;
//upd.Parameters["@searchable"].Value = !ch.Hidden;
upd.Parameters["@locked"].Value = ch.Lock;
upd.Parameters["@fav"].Value = (int)ch.Favorites;
upd.Parameters["@recIdx"].Value = newChannelIndexMap[(ushort)dbc.InternalProviderFlag2];
//upd.Parameters["@ipf2"].Value = (int)(ushort)dbc.InternalProviderFlag2; // fix broken short/ushort/int sign extension
upd.ExecuteNonQuery();
}
del.Parameters["@id"].Value = ch.RecordIndex;
del.ExecuteNonQuery();
}
else
{
upd.Parameters["@id"].Value = ch.RecordIndex;
upd.Parameters["@progNr"].Value = ch.NewProgramNr;
upd.Parameters["@browseable"].Value = !ch.Skip;
//upd.Parameters["@searchable"].Value = !ch.Hidden;
upd.Parameters["@locked"].Value = ch.Lock;
upd.Parameters["@fav"].Value = (int)ch.Favorites;
upd.Parameters["@recIdx"].Value = newChannelIndexMap[(ushort)dbc.InternalProviderFlag2];
//upd.Parameters["@ipf2"].Value = (int)(ushort)dbc.InternalProviderFlag2; // fix broken short/ushort/int sign extension
upd.ExecuteNonQuery();
}
}
}
trans.Commit();
}
finally
{
// force closing the file and releasing the locks
SqliteConnection.ClearAllPools();
GC.Collect();
GC.WaitForPendingFinalizers();
}
trans.Commit();
}
#endregion

View File

@@ -74,7 +74,7 @@ namespace ChanSort.Loader.Panasonic
this.CreateDummySatellites();
string channelConnString = "Data Source=" + this.workFile;
string channelConnString = $"Data Source={this.workFile};Pooling=False";
using var conn = new SqliteConnection(channelConnString);
conn.Open();
using var cmd = conn.CreateCommand();
@@ -112,15 +112,13 @@ namespace ChanSort.Loader.Panasonic
#region GetCypherMode()
private CypherMode GetCypherMode(string file)
{
using (var stream = File.OpenRead(file))
using (var rdr = new BinaryReader(stream))
{
uint value = (uint)rdr.ReadInt32();
if (value == 0x694C5153) return CypherMode.None; // "SQLi"
if (value == 0x42445350) return CypherMode.HeaderAndChecksum; // "PSDB"
if (value == 0xA07DCB50) return CypherMode.Encryption;
return CypherMode.Unknown;
}
using var stream = File.OpenRead(file);
using var rdr = new BinaryReader(stream);
uint value = (uint)rdr.ReadInt32();
if (value == 0x694C5153) return CypherMode.None; // "SQLi"
if (value == 0x42445350) return CypherMode.HeaderAndChecksum; // "PSDB"
if (value == 0xA07DCB50) return CypherMode.Encryption;
return CypherMode.Unknown;
}
#endregion
@@ -297,15 +295,11 @@ order by s.ntype,major_channel
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
this.FileName = tvOutputFile;
try
string channelConnString = $"Data Source={this.workFile};Pooling=False";
using (var conn = new SqliteConnection(channelConnString))
{
string channelConnString = "Data Source=" + this.workFile;
using var conn = new SqliteConnection(channelConnString);
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
@@ -322,13 +316,6 @@ order by s.ntype,major_channel
cmd.Transaction = null;
this.RepairCorruptedDatabaseImage(cmd);
}
finally
{
// force closing the file and releasing the locks
SqliteConnection.ClearAllPools();
GC.Collect();
GC.WaitForPendingFinalizers();
}
this.WriteCypheredFile();
}

View File

@@ -149,7 +149,7 @@ namespace ChanSort.Loader.Panasonic
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
var sec = ini.GetSection("channel_list.xml");
var reorder = sec?.GetBool("reorderRecordsByChannelNumber", true) ?? true;
@@ -194,8 +194,7 @@ namespace ChanSort.Loader.Panasonic
var xml = stringWriter.ToString();
xml = UnescapeXmlChars(xml); // create same broken XML as the original export with unescaped entities
xml = xml.Replace(" />", "/>"); // original file has no space before the element end
File.WriteAllText(tvOutputFile, xml, xmlSettings.Encoding);
this.FileName = tvOutputFile;
File.WriteAllText(this.FileName, xml, xmlSettings.Encoding);
}
#endregion

View File

@@ -597,7 +597,7 @@ namespace ChanSort.Loader.Philips
return;
this.dataFilePaths.Add(dbPath);
using var conn = new SqliteConnection($"Data Source={dbPath}");
using var conn = new SqliteConnection($"Data Source={dbPath};Pooling=False");
conn.Open();
using var cmd = conn.CreateCommand();
@@ -669,7 +669,7 @@ namespace ChanSort.Loader.Philips
}
}
using var conn = new SqliteConnection($"Data Source={tvDb}");
using var conn = new SqliteConnection($"Data Source={tvDb};Pooling=False");
conn.Open();
using var cmd = conn.CreateCommand();
cmd.CommandText = "select _id, display_number, display_name, original_network_id, transport_stream_id, service_id, service_type from channels";
@@ -729,7 +729,7 @@ namespace ChanSort.Loader.Philips
this.Features.FavoritesMode = FavoritesMode.OrderedPerSource;
this.Features.MaxFavoriteLists = 4;
using var conn = new SqliteConnection($"Data Source={listDb}");
using var conn = new SqliteConnection($"Data Source={listDb};Pooling=False");
conn.Open();
using var cmd = conn.CreateCommand();
@@ -787,7 +787,7 @@ namespace ChanSort.Loader.Philips
this.Features.MaxFavoriteLists = 8;
this.Features.AllowGapsInFavNumbers = false;
using var conn = new SqliteConnection($"Data Source={listDb}");
using var conn = new SqliteConnection($"Data Source={listDb};Pooling=False");
conn.Open();
// older versions of ChanSort wrote invalid "list_id" values starting at 0 instead of 1 and going past 8.
@@ -842,7 +842,7 @@ namespace ChanSort.Loader.Philips
// saving
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
var dir = Path.GetDirectoryName(this.FileName) ?? "";
var channellib = Path.Combine(dir, "channellib");
@@ -1095,7 +1095,7 @@ namespace ChanSort.Loader.Philips
if (!File.Exists(dbPath))
return;
using var conn = new SqliteConnection($"Data Source={dbPath}");
using var conn = new SqliteConnection($"Data Source={dbPath};Pooling=False");
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
@@ -1134,7 +1134,7 @@ namespace ChanSort.Loader.Philips
if (!File.Exists(tvDb))
return;
using var conn = new SqliteConnection($"Data Source={tvDb}");
using var conn = new SqliteConnection($"Data Source={tvDb};Pooling=False");
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
@@ -1175,7 +1175,7 @@ namespace ChanSort.Loader.Philips
if (!File.Exists(listDb) || this.channelsById.Count == 0)
return;
using var conn = new SqliteConnection($"Data Source={listDb}");
using var conn = new SqliteConnection($"Data Source={listDb};Pooling=False");
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
@@ -1238,7 +1238,7 @@ namespace ChanSort.Loader.Philips
if (!File.Exists(listDb))
return;
using var conn = new SqliteConnection($"Data Source={listDb}");
using var conn = new SqliteConnection($"Data Source={listDb};Pooling=False");
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();

View File

@@ -471,7 +471,7 @@ namespace ChanSort.Loader.Philips
public override IEnumerable<string> GetDataFilePaths() => this.dbFileByList.Values.Union(this.flashFileByList.Values).Select(tup => tup.Item1);
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
// update *.db files
foreach (var listAndFile in this.dbFileByList)

View File

@@ -268,10 +268,8 @@ namespace ChanSort.Loader.Philips
var xml = fileData.textContent;
if (fileData.formatVersion == FormatVersion.RepairXml)
xml = xml.Replace("&", "&amp;"); // Philips exports broken XML with unescaped & instead of &amp;
using (var reader = XmlReader.Create(new StringReader(xml), settings))
{
fileData.doc.Load(reader);
}
using var reader = XmlReader.Create(new StringReader(xml), settings);
fileData.doc.Load(reader);
}
catch
{
@@ -580,10 +578,8 @@ namespace ChanSort.Loader.Philips
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
// "Save As..." is not supported by this loader
foreach (var list in this.DataRoot.ChannelLists)
{
if (list.IsMixedSourceFavoritesList)

View File

@@ -267,19 +267,17 @@ namespace ChanSort.Loader.Samsung.Scm
series = validCandidates[0];
else
{
using (var dlg = Api.View.Default?.CreateActionBox(""))
{
if (dlg == null) // during unit testing
return false;
dlg.Message = "File type could not be detected automatically.\nPlease choose the model series of your TV:";
foreach(var cand in validCandidates)
dlg.AddAction("Series " + cand, cand);
dlg.AddAction("Cancel", 0);
dlg.ShowDialog();
if (dlg.SelectedAction == 0)
return false;
series = (char)dlg.SelectedAction;
}
using var dlg = Api.View.Default?.CreateActionBox("");
if (dlg == null) // during unit testing
return false;
dlg.Message = "File type could not be detected automatically.\nPlease choose the model series of your TV:";
foreach(var cand in validCandidates)
dlg.AddAction("Series " + cand, cand);
dlg.AddAction("Cancel", 0);
dlg.ShowDialog();
if (dlg.SelectedAction == 0)
return false;
series = (char)dlg.SelectedAction;
}
this.modelConstants.TryGetValue("Series:" + series, out this.c);
@@ -653,7 +651,7 @@ namespace ChanSort.Loader.Samsung.Scm
#endregion
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
var zip = Path.Combine(this.TempPath, this.baseFolder);
this.SaveChannels(zip, "map-AirA", this.avbtChannels, this.avbtFileContent);
@@ -670,7 +668,7 @@ namespace ChanSort.Loader.Samsung.Scm
this.SaveChannels(zip, "map-CanalDigitalSatD", this.canalDigitalChannels, this.canalDigitalFileContent);
this.SaveChannels(zip, "map-DigitalPlusD", this.digitalPlusChannels, this.digitalPlusFileContent);
this.SaveChannels(zip, "map-CyfraPlusD", this.cyfraPlusChannels, this.cyfraPlusFileContent);
this.ZipToOutputFile(tvOutputFile, true);
this.ZipToOutputFile(true);
}
#endregion
@@ -681,10 +679,8 @@ namespace ChanSort.Loader.Samsung.Scm
return;
string tempFilePath = Path.Combine(zip, fileName);
using (var stream = new FileStream(tempFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
this.WriteChannels(channels, fileContent, stream);
}
using var stream = new FileStream(tempFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
this.WriteChannels(channels, fileContent, stream);
}
#endregion

View File

@@ -45,7 +45,7 @@ namespace ChanSort.Loader.Samsung.Zip
{
try
{
using var conn = new SqliteConnection("Data Source=" + this.TempPath + "\\sat");
using var conn = new SqliteConnection($"Data Source={(this.TempPath + "\\sat")};Pooling=False");
conn.Open();
this.ReadSatDatabase(conn);
}
@@ -62,13 +62,13 @@ namespace ChanSort.Loader.Samsung.Zip
foreach (var filePath in files)
{
var filename = Path.GetFileName(filePath) ?? "";
if (filename.StartsWith("vconf_"))
if (filename.StartsWith("vconf_") || filename.EndsWith("-shm"))
continue;
FileType type;
try
{
using var conn = new SqliteConnection("Data Source=" + filePath);
using var conn = new SqliteConnection($"Data Source={filePath};Pooling=False");
conn.Open();
using (var cmd = conn.CreateCommand())
{
@@ -131,12 +131,10 @@ namespace ChanSort.Loader.Samsung.Zip
#region ReadSatDatabase()
private void ReadSatDatabase(SqliteConnection conn)
{
using (var cmd = conn.CreateCommand())
{
this.RepairCorruptedDatabaseImage(cmd);
this.ReadSatellites(cmd);
this.ReadTransponders(cmd);
}
using var cmd = conn.CreateCommand();
this.RepairCorruptedDatabaseImage(cmd);
this.ReadSatellites(cmd);
this.ReadTransponders(cmd);
}
#endregion
@@ -144,19 +142,17 @@ namespace ChanSort.Loader.Samsung.Zip
private void ReadSatellites(IDbCommand cmd)
{
cmd.CommandText = "select distinct satId, cast(satName as blob), satPos, satDir from SAT";
using (var r = cmd.ExecuteReader())
using var r = cmd.ExecuteReader();
while (r.Read())
{
while (r.Read())
{
Satellite sat = new Satellite(r.GetInt32(0));
int pos = Math.Abs(r.GetInt32(2));
// 171027 - ohuseyinoglu: For user-defined satellites, the direction may be -1
// (and not just 1 for "E", 0 for "W")
int dir = r.GetInt32(3);
sat.OrbitalPosition = $"{pos / 10}.{pos % 10}{(dir == 1 ? "E" : dir == 0 ? "W" : "")}";
sat.Name = ReadUtf16(r, 1);
this.DataRoot.AddSatellite(sat);
}
Satellite sat = new Satellite(r.GetInt32(0));
int pos = Math.Abs(r.GetInt32(2));
// 171027 - ohuseyinoglu: For user-defined satellites, the direction may be -1
// (and not just 1 for "E", 0 for "W")
int dir = r.GetInt32(3);
sat.OrbitalPosition = $"{pos / 10}.{pos % 10}{(dir == 1 ? "E" : dir == 0 ? "W" : "")}";
sat.Name = ReadUtf16(r, 1);
this.DataRoot.AddSatellite(sat);
}
}
#endregion
@@ -165,21 +161,19 @@ namespace ChanSort.Loader.Samsung.Zip
private void ReadTransponders(IDbCommand cmd)
{
cmd.CommandText = "select satId, tpFreq, tpPol, tpSr, tpId from SAT_TP";
using (var r = cmd.ExecuteReader())
using var r = cmd.ExecuteReader();
while (r.Read())
{
while (r.Read())
{
// 171027 - ohuseyinoglu: tpId is the primary key of this table, we should be able to use it as "id/dict. index"
// It will also be our lookup value for the CHNL table
int id = r.GetInt32(4);
Transponder tp = new Transponder(id);
tp.FrequencyInMhz = (decimal)r.GetInt32(1) / 1000;
tp.Number = id;
tp.Polarity = r.GetInt32(2) == 0 ? 'H' : 'V';
tp.Satellite = this.DataRoot.Satellites.TryGet(r.GetInt32(0));
tp.SymbolRate = r.GetInt32(3);
this.DataRoot.AddTransponder(tp.Satellite, tp);
}
// 171027 - ohuseyinoglu: tpId is the primary key of this table, we should be able to use it as "id/dict. index"
// It will also be our lookup value for the CHNL table
int id = r.GetInt32(4);
Transponder tp = new Transponder(id);
tp.FrequencyInMhz = (decimal)r.GetInt32(1) / 1000;
tp.Number = id;
tp.Polarity = r.GetInt32(2) == 0 ? 'H' : 'V';
tp.Satellite = this.DataRoot.Satellites.TryGet(r.GetInt32(0));
tp.SymbolRate = r.GetInt32(3);
this.DataRoot.AddTransponder(tp.Satellite, tp);
}
}
#endregion
@@ -189,13 +183,11 @@ namespace ChanSort.Loader.Samsung.Zip
private void ReadChannelDatabase(SqliteConnection conn, string dbPath, FileType fileType)
{
this.channelById.Clear();
using (var cmd = conn.CreateCommand())
{
var providers = fileType == FileType.ChannelDbDvb ? this.ReadProviders(cmd) : null;
var channelList = this.ReadChannels(cmd, dbPath, providers, fileType);
this.ReadFavorites(cmd);
this.dbPathByChannelList.Add(channelList, dbPath);
}
using var cmd = conn.CreateCommand();
var providers = fileType == FileType.ChannelDbDvb ? this.ReadProviders(cmd) : null;
var channelList = this.ReadChannels(cmd, dbPath, providers, fileType);
this.ReadFavorites(cmd);
this.dbPathByChannelList.Add(channelList, dbPath);
}
#endregion
@@ -293,15 +285,14 @@ namespace ChanSort.Loader.Samsung.Zip
return SignalSource.IP|SignalSource.Digital;
var signalSource = fileType == FileType.ChannelDbAnalog ? SignalSource.Analog : SignalSource.Digital;
cmd.CommandText = "select distinct chType from CHNL";
using (var r = cmd.ExecuteReader())
using var r = cmd.ExecuteReader();
if (r.Read())
{
if (r.Read())
{
var ss = ChTypeToSignalSource(r.GetInt32(0));
if (ss != 0)
signalSource = ss;
}
var ss = ChTypeToSignalSource(r.GetInt32(0));
if (ss != 0)
signalSource = ss;
}
return signalSource;
}
@@ -476,7 +467,7 @@ namespace ChanSort.Loader.Samsung.Zip
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
foreach (var channelList in this.DataRoot.ChannelLists)
{
@@ -484,40 +475,29 @@ namespace ChanSort.Loader.Samsung.Zip
SaveChannelList(channelList, dbPath);
}
// force closing the file and releasing the locks
GC.Collect();
GC.WaitForPendingFinalizers();
this.ZipToOutputFile(tvOutputFile);
this.ZipToOutputFile();
}
#endregion
#region SaveChannelList()
private void SaveChannelList(ChannelList channelList, string dbPath)
{
try
using var conn = new SqliteConnection($"Data Source={dbPath};Pooling=False");
conn.Open();
using (var trans = conn.BeginTransaction())
{
using var conn = new SqliteConnection("Data Source=" + dbPath);
conn.Open();
using (var trans = conn.BeginTransaction())
{
using var cmdUpdateSrv = PrepareUpdateCommand(conn);
using var cmdDeleteSrv = PrepareDeleteCommand(conn, (channelList.SignalSource & SignalSource.Digital) != 0);
using var cmdInsertFav = PrepareInsertFavCommand(conn);
using var cmdUpdateFav = PrepareUpdateFavCommand(conn);
using var cmdDeleteFav = PrepareDeleteFavCommand(conn);
Editor.SequentializeFavPos(channelList, 5);
this.WriteChannels(cmdUpdateSrv, cmdDeleteSrv, cmdInsertFav, cmdUpdateFav, cmdDeleteFav, channelList);
trans.Commit();
}
using var cmdUpdateSrv = PrepareUpdateCommand(conn);
using var cmdDeleteSrv = PrepareDeleteCommand(conn, (channelList.SignalSource & SignalSource.Digital) != 0);
using var cmdInsertFav = PrepareInsertFavCommand(conn);
using var cmdUpdateFav = PrepareUpdateFavCommand(conn);
using var cmdDeleteFav = PrepareDeleteFavCommand(conn);
Editor.SequentializeFavPos(channelList, 5);
this.WriteChannels(cmdUpdateSrv, cmdDeleteSrv, cmdInsertFav, cmdUpdateFav, cmdDeleteFav, channelList);
trans.Commit();
}
using var cmd = conn.CreateCommand();
this.RepairCorruptedDatabaseImage(cmd);
}
finally
{
SqliteConnection.ClearAllPools();
}
using var cmd = conn.CreateCommand();
this.RepairCorruptedDatabaseImage(cmd);
}
#endregion

View File

@@ -71,15 +71,9 @@ namespace ChanSort.Loader.SatcoDX
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
if (tvOutputFile != this.FileName)
{
File.Copy(this.FileName, tvOutputFile);
this.FileName = tvOutputFile;
}
using var file = new FileStream(tvOutputFile, FileMode.Create);
using var file = new FileStream(this.FileName, FileMode.Create);
byte[] buffer = null;
foreach (var channel in this.allChannels.GetChannelsByNewOrder())
{

View File

@@ -300,11 +300,9 @@ namespace ChanSort.Loader.Sharp
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
this.FileName = tvOutputFile;
using var file = new StreamWriter(new FileStream(tvOutputFile, FileMode.Create), this.encoding);
using var file = new StreamWriter(new FileStream(this.FileName, FileMode.Create), this.encoding);
// write original header
for (int i=0; i<3; i++)

View File

@@ -594,7 +594,7 @@ namespace ChanSort.Loader.Sony
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
// sdbT
if (this.channeListNodes.TryGetValue(SignalSource.DvbT, out var nodes))
@@ -659,7 +659,7 @@ namespace ChanSort.Loader.Sony
xml = xml.Substring(0, i0 + 1) + hexCrc + xml.Substring(i1);
var enc = new UTF8Encoding(false, false);
File.WriteAllText(tvOutputFile, xml, enc);
File.WriteAllText(this.FileName, xml, enc);
}
#endregion

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.IO;
using ChanSort.Api;
using Microsoft.Data.Sqlite;
@@ -54,7 +53,7 @@ namespace ChanSort.Loader.Toshiba
else
workingDir = Path.GetDirectoryName(this.FileName);
var sysDataConnString = "Data Source=" + this.workingDir + FILE_dvbSysData_db;
var sysDataConnString = $"Data Source={this.workingDir + FILE_dvbSysData_db};Pooling=false";
using (var conn = new SqliteConnection(sysDataConnString))
{
conn.Open();
@@ -64,7 +63,7 @@ namespace ChanSort.Loader.Toshiba
ReadTransponders(cmd);
}
var mainDataConnString = "Data Source=" + this.workingDir + FILE_dvbMainData_db;
var mainDataConnString = $"Data Source={this.workingDir + FILE_dvbMainData_db};Pooling=False";
using (var conn = new SqliteConnection(mainDataConnString))
{
conn.Open();
@@ -72,7 +71,7 @@ namespace ChanSort.Loader.Toshiba
ReadCryptInfo(cmd);
}
var channelConnString = "Data Source=" + this.workingDir + FILE_chmgt_db;
var channelConnString = $"Data Source={this.workingDir + FILE_chmgt_db};Pooling=False";
using (var conn = new SqliteConnection(channelConnString))
{
conn.Open();
@@ -259,13 +258,11 @@ namespace ChanSort.Loader.Toshiba
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
try
var channelConnString = $"Data Source={this.workingDir + FILE_chmgt_db};Pooling=False";
using (var conn = new SqliteConnection(channelConnString))
{
var channelConnString = "Data Source=" + this.workingDir + FILE_chmgt_db;
using var conn = new SqliteConnection(channelConnString);
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
@@ -280,16 +277,9 @@ namespace ChanSort.Loader.Toshiba
cmd.Transaction = null;
RepairCorruptedDatabaseImage(cmd);
}
finally
{
// force closing the file and releasing the locks
SqliteConnection.ClearAllPools();
GC.Collect();
GC.WaitForPendingFinalizers();
}
if (Path.GetExtension(this.FileName).ToLowerInvariant() == ".zip")
ZipToOutputFile(tvOutputFile);
ZipToOutputFile();
}
#endregion

View File

@@ -67,7 +67,7 @@ namespace ChanSort.Loader.Toshiba
#region Load()
public override void Load()
{
string sysDataConnString = "Data Source=" + this.FileName;
string sysDataConnString = $"Data Source={this.FileName};Pooling=False";
using var conn = new SqliteConnection(sysDataConnString);
conn.Open();
@@ -206,28 +206,23 @@ left outer join ChanDataTable ac on ac.handle=a.m_channel_no
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
if (tvOutputFile != this.FileName)
string channelConnString = $"Data Source={this.FileName};Pooling=False";
using (var conn = new SqliteConnection(channelConnString))
{
File.Copy(this.FileName, tvOutputFile, true);
this.FileName = tvOutputFile;
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
using var cmd2 = conn.CreateCommand();
this.WriteChannels(cmd, cmd2, this.channels);
trans.Commit();
cmd.Transaction = null;
this.RepairCorruptedDatabaseImage(cmd);
}
string channelConnString = "Data Source=" + this.FileName;
using var conn = new SqliteConnection(channelConnString);
conn.Open();
using var trans = conn.BeginTransaction();
using var cmd = conn.CreateCommand();
using var cmd2 = conn.CreateCommand();
this.WriteChannels(cmd, cmd2, this.channels);
trans.Commit();
cmd.Transaction = null;
this.RepairCorruptedDatabaseImage(cmd);
conn.Close();
// copy settingsDB.db to settingsDBBackup.db
var backupFile = GetBackupFilePath();
File.Copy(this.FileName, backupFile, true);

View File

@@ -42,15 +42,9 @@ namespace ChanSort.Loader.VDR
#endregion
#region Save()
public override void Save(string tvOutputFile)
public override void Save()
{
if (tvOutputFile != FileName)
{
File.Copy(FileName, tvOutputFile);
FileName = tvOutputFile;
}
using var file = new StreamWriter(tvOutputFile);
using var file = new StreamWriter(this.FileName);
foreach (var channel in allChannels.GetChannelsByNewOrder())
{
// when a reference list was applied, the list may contain proxy entries for deleted channels, which must be ignored

View File

@@ -661,6 +661,10 @@
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>$(ProjectDir)..\deployLibs.cmd $(TargetDir)
</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">

View File

@@ -677,22 +677,21 @@ namespace ChanSort.Ui
if (this.DataRoot == null || !this.DataRoot.NeedsSaving)
return true;
using (var dlg = new ActionBoxDialog(Resources.MainForm_PromptSaveAndContinue_Question))
using var dlg = new ActionBoxDialog(Resources.MainForm_PromptSaveAndContinue_Question);
dlg.AddAction(Resources.MainForm_PromptSaveAndContinue_Save, DialogResult.Yes, dlg.Save);
dlg.AddAction(Resources.MainForm_PromptSaveAndContinue_Discard, DialogResult.No, dlg.Discard);
dlg.AddAction(Resources.MainForm_Cancel, DialogResult.Cancel, dlg.Cancel);
switch (dlg.ShowDialog(this))
{
dlg.AddAction(Resources.MainForm_PromptSaveAndContinue_Save, DialogResult.Yes, dlg.Save);
dlg.AddAction(Resources.MainForm_PromptSaveAndContinue_Discard, DialogResult.No, dlg.Discard);
dlg.AddAction(Resources.MainForm_Cancel, DialogResult.Cancel, dlg.Cancel);
switch (dlg.ShowDialog(this))
{
case DialogResult.Yes:
this.SaveFiles();
break;
case DialogResult.No:
break;
case DialogResult.Cancel:
return false;
}
case DialogResult.Yes:
this.SaveFiles();
break;
case DialogResult.No:
break;
case DialogResult.Cancel:
return false;
}
return true;
}
@@ -849,22 +848,20 @@ namespace ChanSort.Ui
private void ShowSaveFileDialog()
{
var extension = Path.GetExtension(this.currentTvFile) ?? ".";
using (var dlg = new SaveFileDialog())
using var dlg = new SaveFileDialog();
dlg.InitialDirectory = Path.GetDirectoryName(this.currentTvFile);
dlg.FileName = Path.GetFileName(this.currentTvFile);
dlg.AddExtension = true;
dlg.DefaultExt = extension;
dlg.Filter = string.Format(Resources.MainForm_FileDialog_SaveFileFilter, extension);
dlg.FilterIndex = 0;
dlg.ValidateNames = true;
dlg.RestoreDirectory = true;
dlg.OverwritePrompt = true;
if (dlg.ShowDialog() == DialogResult.OK)
{
dlg.InitialDirectory = Path.GetDirectoryName(this.currentTvFile);
dlg.FileName = Path.GetFileName(this.currentTvFile);
dlg.AddExtension = true;
dlg.DefaultExt = extension;
dlg.Filter = string.Format(Resources.MainForm_FileDialog_SaveFileFilter, extension);
dlg.FilterIndex = 0;
dlg.ValidateNames = true;
dlg.RestoreDirectory = true;
dlg.OverwritePrompt = true;
if (dlg.ShowDialog() == DialogResult.OK)
{
this.SetFileName(dlg.FileName);
this.SaveFiles();
}
this.SetFileName(dlg.FileName);
this.SaveFiles();
}
}
@@ -1045,7 +1042,7 @@ namespace ChanSort.Ui
}
}
this.currentTvSerializer.Save(this.currentTvFile);
this.currentTvSerializer.Save();
this.DataRoot.ValidateAfterSave();
}
finally
@@ -1545,12 +1542,10 @@ namespace ChanSort.Ui
private void ShowCharsetForm()
{
using (var form = new CharsetForm(this.defaultEncoding))
{
form.Location = new Point(this.Location.X + 30, this.Location.Y + 70);
form.EncodingChanged += this.charsetForm_EncodingChanged;
form.ShowDialog(this);
}
using var form = new CharsetForm(this.defaultEncoding);
form.Location = new Point(this.Location.X + 30, this.Location.Y + 70);
form.EncodingChanged += this.charsetForm_EncodingChanged;
form.ShowDialog(this);
}
#endregion
@@ -2158,8 +2153,8 @@ namespace ChanSort.Ui
private void Print()
{
using (var dlg = new ReportOptionsDialog(this.CurrentChannelList, this.subListIndex))
dlg.ShowDialog(this);
using var dlg = new ReportOptionsDialog(this.CurrentChannelList, this.subListIndex);
dlg.ShowDialog(this);
}
#endregion

View File

@@ -35,13 +35,11 @@ namespace ChanSort.Ui.Printing
Config.Default.PrintColumnCount = (int)this.spinColumnCount.Value;
Config.Default.Save();
using (var font = new Font(this.fontEdit1.Text, (float)this.spinFontSize.Value))
using (var report = new ChannelListReport(this.channelList, this.subListIndex, this.rbSortByName.Checked, font, (int)this.spinColumnCount.Value))
using (ReportPrintTool printTool = new ReportPrintTool(report))
{
printTool.ShowPreviewDialog();
printTool.ShowPreview(UserLookAndFeel.Default);
}
using var font = new Font(this.fontEdit1.Text, (float)this.spinFontSize.Value);
using var report = new ChannelListReport(this.channelList, this.subListIndex, this.rbSortByName.Checked, font, (int)this.spinColumnCount.Value);
using ReportPrintTool printTool = new ReportPrintTool(report);
printTool.ShowPreviewDialog();
printTool.ShowPreview(UserLookAndFeel.Default);
}
}
}

View File

@@ -344,26 +344,24 @@ namespace ChanSort.Ui
bool overwrite = true;
if (target.ChannelList.GetChannelsByNewOrder().Any(ch => ch.GetPosition(target.PosIndex) != -1))
{
using (var dlg = new ActionBoxDialog(Resources.ReferenceListForm_btnApply_ConflictHandling))
using var dlg = new ActionBoxDialog(Resources.ReferenceListForm_btnApply_ConflictHandling);
dlg.AddAction(Resources.ReferenceListForm_btnApply_Click_Clear, DialogResult.OK, dlg.EmptyList);
dlg.AddAction(Resources.ReferenceListForm_btnApply_Click_Overwrite, DialogResult.Yes, dlg.Overwrite);
dlg.AddAction(Resources.ReferenceListForm_btnApply_Click_Keep, DialogResult.No, dlg.CopyList);
dlg.AddAction(closeButtonText[1], DialogResult.Cancel, dlg.Cancel);
switch (dlg.ShowDialog(this))
{
dlg.AddAction(Resources.ReferenceListForm_btnApply_Click_Clear, DialogResult.OK, dlg.EmptyList);
dlg.AddAction(Resources.ReferenceListForm_btnApply_Click_Overwrite, DialogResult.Yes, dlg.Overwrite);
dlg.AddAction(Resources.ReferenceListForm_btnApply_Click_Keep, DialogResult.No, dlg.CopyList);
dlg.AddAction(closeButtonText[1], DialogResult.Cancel, dlg.Cancel);
switch (dlg.ShowDialog(this))
{
case DialogResult.OK:
target.ChannelList.Channels.ForEach(ch => ch.SetPosition(target.PosIndex, -1));
break;
case DialogResult.Yes:
//overwrite = true;
break;
case DialogResult.No:
overwrite = false;
break;
case DialogResult.Cancel:
return;
}
case DialogResult.OK:
target.ChannelList.Channels.ForEach(ch => ch.SetPosition(target.PosIndex, -1));
break;
case DialogResult.Yes:
//overwrite = true;
break;
case DialogResult.No:
overwrite = false;
break;
case DialogResult.Cancel:
return;
}
}

View File

@@ -2,6 +2,7 @@
// CRCs are calculated MSB first (left-shift with initial mask 0x80000000), polynomial 0x04C11DB7, init-value 0xFFFFFFFF and exit-XOR 0x00000000
public struct LaSat
{
int32 dataBlockLength;

View File

@@ -10,14 +10,15 @@ struct StringChar
struct DvbData
{
uint8 unknown[2848];
struct
{
uint8 satData[88];
} satellites[85];
int8 unknown[63343];
struct{
int8 data[146];
} channels[3045]; // 615
struct
{
uint8 satData[88];
} satellites[85];
int8 unknown[63343];
struct
{
int8 data[146];
} channels[3045]; // 615
};
public struct cvt_database_dat
@@ -30,10 +31,10 @@ public struct cvt_database_dat
big_endian long length;
if (blockName[0].c == 'D')
{
{
DvbData dvbData;
int8 filler[length - sizeof(dvbData)];
}
int8 filler[length - sizeof(dvbData)];
}
else
uint8 data[length];

View File

@@ -13,6 +13,14 @@
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.3.0" newVersion="4.1.3.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -32,11 +32,13 @@ namespace Test.Loader.CmdbBin
zdf.Name = "ZDF";
zdf.IsNameModified = true;
ser.DataRoot.ApplyCurrentProgramNumbers();
var ed = new Editor();
ed.DataRoot = ser.DataRoot;
ed.ChannelList = list;
ed.SetSlotNumber(new[] { ard }, 1, false, true );
ser.Save(null);
ser.Save();
// load modified file again and verify changes
ser = new CmdbFileSerializer(path);

View File

@@ -80,7 +80,7 @@ namespace Test.Loader.Hisense.ChannelDb
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -77,7 +77,7 @@ namespace Test.Loader.Hisense.ServicelistDb
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -72,7 +72,7 @@ namespace Test.Loader.Hisense.ServicelistDb
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -51,11 +51,11 @@ namespace Test.Loader.LG.Binary
// save TLL file and compare to reference file
serializer.CleanUpChannelData();
serializer.Save(tempFile);
serializer.Save();
if (generateReferenceFile)
File.Copy(tempFile, TestUtils.GetSolutionBaseDir() + "\\Test.Loader.LG\\" + modelAndBaseName + ".TLL.out", true);
File.Copy(serializer.FileName, TestUtils.GetSolutionBaseDir() + "\\Test.Loader.LG\\" + modelAndBaseName + ".TLL.out", true);
else
AssertBinaryFileContent(tempFile, baseName + ".TLL.out");
AssertBinaryFileContent(serializer.FileName, baseName + ".TLL.out");
}
}
}

View File

@@ -69,7 +69,7 @@ namespace Test.Loader.LG.Binary
Assert.AreEqual(0, orf2.NewProgramNr);
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -15,7 +15,7 @@ namespace Test.Loader.LG.Binary
[TestClass]
public class TestBase
{
protected readonly string tempFile = Path.GetTempFileName();
protected string tempFile;
#region ExecuteTest()
protected void ExecuteTest(string modelAndBaseName)
@@ -29,8 +29,9 @@ namespace Test.Loader.LG.Binary
var baseName = Path.GetFileNameWithoutExtension(modelAndBaseName);
// load the TLL file
tempFile = baseName + ".TLL.in";
var plugin = new LgPlugin();
var serializer = (TllFileSerializer)plugin.CreateSerializer(baseName + ".TLL.in");
var serializer = (TllFileSerializer)plugin.CreateSerializer(tempFile);
serializer.IsTesting = true;
serializer.Load();
@@ -53,8 +54,8 @@ namespace Test.Loader.LG.Binary
}
}
// save TLL file and compate to reference file
serializer.Save(tempFile);
// save TLL file and compare to reference file
serializer.Save();
AssertBinaryFileContent(tempFile, baseName + ".TLL.out");
}
#endregion
@@ -97,6 +98,9 @@ namespace Test.Loader.LG.Binary
#region AssertBinaryFileContent()
protected void AssertBinaryFileContent(string actualFile, string expectedFile)
{
if (StringComparer.InvariantCultureIgnoreCase.Equals(actualFile, expectedFile))
throw new ArgumentException("input and verification file must not be the same");
var actual = File.ReadAllBytes(actualFile);
var expected = File.ReadAllBytes(expectedFile);
Assert.AreEqual(expected.Length, actual.Length);
@@ -144,13 +148,16 @@ namespace Test.Loader.LG.Binary
File.Move(testDataDir + "\\" + basename + ".TLL", destFileName);
}
// save .csv.in file (with ref list of original .TLL.in)
TllFileSerializer tll = new TllFileSerializer(destFileName);
var outPath = testDataDir + "\\" + basename + ".TLL.out";
File.Copy(destFileName, outPath, true);
TllFileSerializer tll = new TllFileSerializer(outPath);
tll.IsTesting = true;
tll.Load();
tll.DataRoot.ApplyCurrentProgramNumbers();
if (moveChannels)
{
// save .csv.in file (with ref list of original .TLL.in)
using (var writer = new StringWriter())
{
CsvRefListSerializer.Save(writer, tll.DataRoot);
@@ -178,7 +185,7 @@ namespace Test.Loader.LG.Binary
{
tll.CleanUpChannelData();
}
tll.Save(testDataDir + "\\" + basename + ".TLL.out");
tll.Save();
}
#endregion
}

View File

@@ -89,7 +89,7 @@ namespace Test.Loader.LG
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;
@@ -131,7 +131,7 @@ namespace Test.Loader.LG
srf2.NewProgramNr = 1971;
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;
@@ -147,7 +147,7 @@ namespace Test.Loader.LG
// restore original program numbers and save
srf1.NewProgramNr = 1971;
srf2.NewProgramNr = 1972;
ser.Save(tempFile);
ser.Save();
// undo expected changes to the file
var changed = File.ReadAllText(tempFile, Encoding.UTF8);

View File

@@ -80,7 +80,7 @@ namespace Test.Loader.Panasonic
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -87,7 +87,7 @@ namespace Test.Loader.Philips
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -178,7 +178,7 @@ namespace Test.Loader.Samsung.Scm
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;
@@ -228,7 +228,7 @@ namespace Test.Loader.Samsung.Scm
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -97,7 +97,7 @@ namespace Test.Loader.Samsung.Zip
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -90,7 +90,7 @@ namespace Test.Loader.SatcoDX
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -110,7 +110,7 @@ namespace Test.Loader.Sony
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;
@@ -156,7 +156,7 @@ namespace Test.Loader.Sony
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -96,7 +96,7 @@ namespace Test.Loader.Toshiba
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -85,7 +85,7 @@ namespace Test.Loader.Toshiba
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -67,7 +67,7 @@ namespace Test.Loader.VDR
// save and reload
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);
ser.Load();
data = ser.DataRoot;

View File

@@ -64,7 +64,7 @@ namespace Test.Loader
foreach (var l in root.ChannelLists)
l.ReadOnly = false;
ser.Save(tempFile);
ser.Save();
ser = plugin.CreateSerializer(tempFile);

View File

@@ -1,6 +1,13 @@
ChanSort Change Log
===================
2022-11-29
- fixed saving of modified cmdb_\*.bin channel lists
- removed "Save as" function (which was disabled for most channel list formats)
- added "Convert list" menu item which gives a hint on how to use reference lists instead
- added functions for easy swapping in 1-list-view (mark for swapping, swap with marked)
- LOTS of internal changes
2022-11-22
- fixed "Export to Excel" (copies the list as tab-separated text into clipboard)
- included latest translation to Polish (thanks to J.D.)