mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-05-07 12:27:49 +02:00
- fixed Nuget hell: (auto) binding redirects to prevent compiler warning flood and ensure unit tests to be runnable
- put file name in Sqlite connect string in quotes - improvements to Mediatek Philips 120+125/Sony serializer (physically reorder XML nodes, use flags stored in Java serialized blob) - selecting a RefList changed the current working directory, which prevented .ini files to be found by loaders
This commit is contained in:
@@ -605,7 +605,7 @@ namespace ChanSort.Loader.Philips
|
||||
return;
|
||||
this.dataFilePaths.Add(dbPath);
|
||||
|
||||
using var conn = new SqliteConnection($"Data Source={dbPath};Pooling=False");
|
||||
using var conn = new SqliteConnection($"Data Source=\"{dbPath}\";Pooling=False");
|
||||
conn.Open();
|
||||
using var cmd = conn.CreateCommand();
|
||||
|
||||
@@ -677,7 +677,7 @@ namespace ChanSort.Loader.Philips
|
||||
}
|
||||
}
|
||||
|
||||
using var conn = new SqliteConnection($"Data Source={tvDb};Pooling=False");
|
||||
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";
|
||||
@@ -737,7 +737,7 @@ namespace ChanSort.Loader.Philips
|
||||
this.Features.FavoritesMode = FavoritesMode.OrderedPerSource;
|
||||
this.Features.MaxFavoriteLists = 4;
|
||||
|
||||
using var conn = new SqliteConnection($"Data Source={listDb};Pooling=False");
|
||||
using var conn = new SqliteConnection($"Data Source=\"{listDb}\";Pooling=False");
|
||||
conn.Open();
|
||||
using var cmd = conn.CreateCommand();
|
||||
|
||||
@@ -795,7 +795,7 @@ namespace ChanSort.Loader.Philips
|
||||
this.Features.MaxFavoriteLists = 8;
|
||||
this.Features.AllowGapsInFavNumbers = false;
|
||||
|
||||
using var conn = new SqliteConnection($"Data Source={listDb};Pooling=False");
|
||||
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.
|
||||
@@ -1105,7 +1105,7 @@ namespace ChanSort.Loader.Philips
|
||||
if (!File.Exists(dbPath))
|
||||
return;
|
||||
|
||||
using var conn = new SqliteConnection($"Data Source={dbPath};Pooling=False");
|
||||
using var conn = new SqliteConnection($"Data Source=\"{dbPath}\";Pooling=False");
|
||||
conn.Open();
|
||||
using var trans = conn.BeginTransaction();
|
||||
using var cmd = conn.CreateCommand();
|
||||
@@ -1144,7 +1144,7 @@ namespace ChanSort.Loader.Philips
|
||||
if (!File.Exists(tvDb))
|
||||
return;
|
||||
|
||||
using var conn = new SqliteConnection($"Data Source={tvDb};Pooling=False");
|
||||
using var conn = new SqliteConnection($"Data Source=\"{tvDb}\";Pooling=False");
|
||||
conn.Open();
|
||||
using var trans = conn.BeginTransaction();
|
||||
using var cmd = conn.CreateCommand();
|
||||
@@ -1185,7 +1185,7 @@ namespace ChanSort.Loader.Philips
|
||||
if (!File.Exists(listDb) || this.channelsById.Count == 0)
|
||||
return;
|
||||
|
||||
using var conn = new SqliteConnection($"Data Source={listDb};Pooling=False");
|
||||
using var conn = new SqliteConnection($"Data Source=\"{listDb}\";Pooling=False");
|
||||
conn.Open();
|
||||
using var trans = conn.BeginTransaction();
|
||||
using var cmd = conn.CreateCommand();
|
||||
@@ -1248,7 +1248,7 @@ namespace ChanSort.Loader.Philips
|
||||
if (!File.Exists(listDb))
|
||||
return;
|
||||
|
||||
using var conn = new SqliteConnection($"Data Source={listDb};Pooling=False");
|
||||
using var conn = new SqliteConnection($"Data Source=\"{listDb}\";Pooling=False");
|
||||
conn.Open();
|
||||
using var trans = conn.BeginTransaction();
|
||||
using var cmd = conn.CreateCommand();
|
||||
|
||||
@@ -1,24 +1,18 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\Solution.props" />
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net48</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>..\Debug\</OutputPath>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
||||
<OutputPath>..\Debug\</OutputPath>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
||||
<OutputPath>bin\x86\Release\</OutputPath>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
@@ -44,12 +38,8 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.13" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="8.0.13" />
|
||||
<PackageReference Include="System.Buffers" Version="4.6.0" />
|
||||
<PackageReference Include="System.Memory" Version="4.6.0" />
|
||||
<PackageReference Include="System.Numerics.Vectors" Version="4.6.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.0" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite" Version="9.0.5" />
|
||||
<PackageReference Include="Microsoft.Data.Sqlite.Core" Version="9.0.5" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Remove="DllClient.cs" />
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
@@ -229,14 +230,14 @@ namespace ChanSort.Loader.Philips
|
||||
LoadAndValidateMtkChannelList(dir);
|
||||
|
||||
// version 120 and 125 ignore the modified main channel numbers and only take changes from the favorites.xml
|
||||
if ((chanLstBin?.VersionMajor ?? 0) >= 120)
|
||||
{
|
||||
foreach (var list in this.DataRoot.ChannelLists)
|
||||
{
|
||||
if (!list.IsMixedSourceFavoritesList)
|
||||
list.ReadOnly = true;
|
||||
}
|
||||
}
|
||||
//if ((chanLstBin?.VersionMajor ?? 0) >= 120)
|
||||
//{
|
||||
// foreach (var list in this.DataRoot.ChannelLists)
|
||||
// {
|
||||
// if (!list.IsMixedSourceFavoritesList)
|
||||
// list.ReadOnly = true;
|
||||
// }
|
||||
//}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -352,6 +353,8 @@ namespace ChanSort.Loader.Philips
|
||||
medium = fname;
|
||||
bool hasEncrypt = false;
|
||||
|
||||
var ver = this.chanLstBin?.VersionMajor ?? 0;
|
||||
|
||||
foreach (var list in this.DataRoot.ChannelLists)
|
||||
{
|
||||
list.VisibleColumnFieldNames.Remove("ServiceType");
|
||||
@@ -417,7 +420,6 @@ namespace ChanSort.Loader.Philips
|
||||
if (!hasEncrypt)
|
||||
chList?.VisibleColumnFieldNames.Remove("Encrypted");
|
||||
|
||||
var ver = this.chanLstBin?.VersionMajor ?? 0;
|
||||
if (ver > 0)
|
||||
this.iniMapSection = ini.GetSection("Map" + ver);
|
||||
|
||||
@@ -765,12 +767,16 @@ namespace ChanSort.Loader.Philips
|
||||
|
||||
public override void Save()
|
||||
{
|
||||
bool readOnly = false;
|
||||
foreach (var list in this.DataRoot.ChannelLists)
|
||||
{
|
||||
if (list.IsMixedSourceFavoritesList)
|
||||
this.UpdateFavList();
|
||||
else
|
||||
{
|
||||
this.UpdateChannelList(list);
|
||||
readOnly |= list.ReadOnly;
|
||||
}
|
||||
}
|
||||
|
||||
// It is unclear whether XML nodes must be sorted by the new program number or kept in the original order. This may be different for the various format versions.
|
||||
@@ -791,7 +797,14 @@ namespace ChanSort.Loader.Philips
|
||||
}
|
||||
|
||||
this.chanLstBin?.Save(this.FileName);
|
||||
this.mtkSerializer?.Save();
|
||||
|
||||
// save the MtkChannelList.xml for format 120 and 125
|
||||
if (mtkSerializer != null && !readOnly)
|
||||
{
|
||||
foreach (var list in mtkSerializer.DataRoot.ChannelLists) // apply Philips' LCN-ReadOnly to MediaTek's ReadOnly
|
||||
list.ReadOnly = false;
|
||||
this.mtkSerializer.Save();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -799,6 +812,31 @@ namespace ChanSort.Loader.Philips
|
||||
#region UpdateChannelList()
|
||||
private void UpdateChannelList(ChannelList list)
|
||||
{
|
||||
if (list.ReadOnly)
|
||||
return;
|
||||
|
||||
#if false
|
||||
// ensure consecutive numbers for channels (seems to be a requirement for successful import of MtkChannelList.xml)
|
||||
if (this.chanLstBin?.VersionMajor is >= 120 and <= 125)
|
||||
{
|
||||
var ordered = list.Channels
|
||||
.Where(c => !c.IsProxy)
|
||||
.OrderBy(c => (c.SignalSource & SignalSource.Tv) != 0 ? 0 : 1)
|
||||
.ThenBy(c => c.NewProgramNr > 0 ? 0 : 1)
|
||||
.ThenBy(c => c.NewProgramNr)
|
||||
.ThenBy(c => c.OldProgramNr)
|
||||
.ToList();
|
||||
int i = 0;
|
||||
foreach (var ch in ordered)
|
||||
{
|
||||
if (ch.IsProxy)
|
||||
list.Channels.Remove(ch);
|
||||
else
|
||||
ch.NewProgramNr = ++i;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
var padChannelNameBytes = this.iniMapSection?.GetBool("padChannelName", true) ?? true;
|
||||
var setFavoriteNumber = this.iniMapSection?.GetBool("setFavoriteNumber", false) ?? false;
|
||||
var userReorderChannel = this.iniMapSection?.GetString("userReorderChannel") ?? "";
|
||||
@@ -826,7 +864,7 @@ namespace ChanSort.Loader.Philips
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region UpdateRepairXml()
|
||||
|
||||
@@ -898,7 +936,7 @@ namespace ChanSort.Loader.Philips
|
||||
private void UpdateMtkChannel(Channel channel)
|
||||
{
|
||||
var mtk = channel.MtkChannel;
|
||||
//mtk.Name = channel.Name;
|
||||
mtk.Name = channel.Name;
|
||||
mtk.NewProgramNr = channel.NewProgramNr;
|
||||
mtk.Lock = channel.Lock;
|
||||
mtk.Skip = channel.Skip;
|
||||
@@ -1050,7 +1088,10 @@ namespace ChanSort.Loader.Philips
|
||||
#region GetFileInformation()
|
||||
public override string GetFileInformation()
|
||||
{
|
||||
return base.GetFileInformation() + this.logMessages.Replace("\n", "\r\n");
|
||||
return base.GetFileInformation()
|
||||
+ this.logMessages.Replace("\n", "\r\n")
|
||||
+ "\r\n\r\n"
|
||||
+ this.mtkSerializer?.GetFileInformation();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user