mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-05-06 08:35:48 +02:00
- replaced System.Data.SQLite with Microsoft.Data.Sqlite because MS removed the required VC2010 Redist x86 from their website
- updated bunch of other Nuget packages
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SQLite;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using ChanSort.Api;
|
||||
|
||||
namespace ChanSort.Loader.Philips
|
||||
@@ -600,7 +599,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}");
|
||||
conn.Open();
|
||||
using var cmd = conn.CreateCommand();
|
||||
|
||||
@@ -672,7 +671,7 @@ namespace ChanSort.Loader.Philips
|
||||
}
|
||||
}
|
||||
|
||||
using var conn = new SQLiteConnection($"Data Source={tvDb}");
|
||||
using var conn = new SqliteConnection($"Data Source={tvDb}");
|
||||
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";
|
||||
@@ -693,7 +692,7 @@ namespace ChanSort.Loader.Philips
|
||||
}
|
||||
|
||||
if (ch.OldProgramNr != nr)
|
||||
this.logMessages.AppendLine($"channel with id {id}: prNum {ch.OldProgramNr} in bin file and {r.GetInt32(1)} in tv.db");
|
||||
this.logMessages.AppendLine($"channel with id {id}: prNum {ch.OldProgramNr} in bin file and {r.GetString(1)} in tv.db");
|
||||
if (ch.Name != r.GetString(2))
|
||||
this.logMessages.AppendLine($"channel with id {id}: Name {ch.Name} in bin file and {r.GetString(2)} in tv.db");
|
||||
if (ch.OriginalNetworkId != r.GetInt32(3))
|
||||
@@ -732,7 +731,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}");
|
||||
conn.Open();
|
||||
using var cmd = conn.CreateCommand();
|
||||
|
||||
@@ -790,7 +789,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}");
|
||||
conn.Open();
|
||||
|
||||
// older versions of ChanSort wrote invalid "list_id" values starting at 0 instead of 1 and going past 8.
|
||||
@@ -1098,7 +1097,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}");
|
||||
conn.Open();
|
||||
using var trans = conn.BeginTransaction();
|
||||
using var cmd = conn.CreateCommand();
|
||||
@@ -1112,8 +1111,8 @@ namespace ChanSort.Loader.Philips
|
||||
continue;
|
||||
|
||||
cmd.CommandText = $"update {table} set PresetNumber = @prNum where Dbindex = @dbindex";
|
||||
cmd.Parameters.Add("@prNum", DbType.String);
|
||||
cmd.Parameters.Add("@dbindex", DbType.Int32);
|
||||
cmd.Parameters.Add("@prNum", SqliteType.Text);
|
||||
cmd.Parameters.Add("@dbindex", SqliteType.Integer);
|
||||
foreach(var channel in list.Channels)
|
||||
{
|
||||
if (!(channel is Channel ch) || ch.Map30ChannelMapsDbindex < 0)
|
||||
@@ -1137,17 +1136,17 @@ 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}");
|
||||
conn.Open();
|
||||
using var trans = conn.BeginTransaction();
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = "update channels set display_number=@prNum, display_name=@name, browsable=@browsable, locked=@locked where _id=@id";
|
||||
cmd.Parameters.Clear();
|
||||
cmd.Parameters.Add(new SQLiteParameter("@id", DbType.Int32));
|
||||
cmd.Parameters.Add(new SQLiteParameter("@prNum", DbType.String));
|
||||
cmd.Parameters.Add(new SQLiteParameter("@name", DbType.String));
|
||||
cmd.Parameters.Add(new SQLiteParameter("@browsable", DbType.Int32));
|
||||
cmd.Parameters.Add(new SQLiteParameter("@locked", DbType.Int32));
|
||||
cmd.Parameters.Add("@id", SqliteType.Integer);
|
||||
cmd.Parameters.Add("@prNum", SqliteType.Text);
|
||||
cmd.Parameters.Add("@name", SqliteType.Text);
|
||||
cmd.Parameters.Add("@browsable", SqliteType.Integer);
|
||||
cmd.Parameters.Add("@locked", SqliteType.Integer);
|
||||
cmd.Prepare();
|
||||
foreach (var list in this.DataRoot.ChannelLists)
|
||||
{
|
||||
@@ -1178,7 +1177,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}");
|
||||
conn.Open();
|
||||
using var cmd = conn.CreateCommand();
|
||||
using var trans = conn.BeginTransaction();
|
||||
@@ -1198,8 +1197,8 @@ namespace ChanSort.Loader.Philips
|
||||
|
||||
var list = listIdx < 4 ? this.antChannels : listIdx < 8 ? this.cabChannels : this.satChannels;
|
||||
cmd.CommandText = "update List set list_name=@name" + incFavList + " where list_id=@listId";
|
||||
cmd.Parameters.Add("@listId", DbType.Int32);
|
||||
cmd.Parameters.Add("@name", DbType.String);
|
||||
cmd.Parameters.Add("@listId", SqliteType.Integer);
|
||||
cmd.Parameters.Add("@name", SqliteType.Text);
|
||||
cmd.Parameters["@listId"].Value = listIdx + 1;
|
||||
cmd.Parameters["@name"].Value = list.GetFavListCaption(listIdx % 4, false);
|
||||
cmd.ExecuteNonQuery();
|
||||
@@ -1210,9 +1209,9 @@ namespace ChanSort.Loader.Philips
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.CommandText = $"insert into {table} (_id, channel_id, rank) values (@id, @channelId, @rank)";
|
||||
cmd.Parameters.Add("@id", DbType.Int32);
|
||||
cmd.Parameters.Add("@channelId", DbType.Int32);
|
||||
cmd.Parameters.Add("@rank", DbType.Int32);
|
||||
cmd.Parameters.Add("@id", SqliteType.Integer);
|
||||
cmd.Parameters.Add("@channelId", SqliteType.Integer);
|
||||
cmd.Parameters.Add("@rank", SqliteType.Integer);
|
||||
|
||||
int order = 0;
|
||||
foreach (var channel in list.Channels)
|
||||
@@ -1242,7 +1241,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}");
|
||||
conn.Open();
|
||||
using var trans = conn.BeginTransaction();
|
||||
using var cmd = conn.CreateCommand();
|
||||
@@ -1266,17 +1265,17 @@ namespace ChanSort.Loader.Philips
|
||||
"insert into List (list_id, list_name, list_version) values (@id,@name,1)" :
|
||||
"update List set list_name=@name" + incFavList + " where list_id=@id";
|
||||
|
||||
cmd.Parameters.Add(new SQLiteParameter("@id", DbType.Int16));
|
||||
cmd.Parameters.Add(new SQLiteParameter("@name", DbType.String));
|
||||
cmd.Parameters.Add("@id", SqliteType.Integer);
|
||||
cmd.Parameters.Add("@name", SqliteType.Text);
|
||||
cmd.Parameters["@id"].Value = favListId;
|
||||
cmd.Parameters["@name"].Value = this.favChannels.GetFavListCaption(favListIndex) ?? "Fav " + (favListIndex + 1);
|
||||
cmd.ExecuteNonQuery();
|
||||
|
||||
cmd.CommandText = "insert into FavoriteChannels(fav_list_id, channel_id, rank) values (@listId,@channelId,@rank)";
|
||||
cmd.Parameters.Clear();
|
||||
cmd.Parameters.Add(new SQLiteParameter("@listId", DbType.Int32));
|
||||
cmd.Parameters.Add(new SQLiteParameter("@channelId", DbType.Int32));
|
||||
cmd.Parameters.Add(new SQLiteParameter("@rank", DbType.Double));
|
||||
cmd.Parameters.Add("@listId", SqliteType.Integer);
|
||||
cmd.Parameters.Add("@channelId", SqliteType.Integer);
|
||||
cmd.Parameters.Add("@rank", SqliteType.Real);
|
||||
cmd.Prepare();
|
||||
foreach (var chan in favChannels.Channels)
|
||||
{
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace ChanSort.Loader.Philips
|
||||
var filePath = baseDir + entry.Key;
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
errors += $"\nchanLst.bin: file not found in directory structure: {entry.Key}";
|
||||
this.log?.Invoke($"\nchanLst.bin: file not found in directory structure: {entry.Key}");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -54,10 +56,35 @@
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Data.Sqlite, Version=5.0.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Data.Sqlite.Core.5.0.5\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.batteries_v2, Version=2.0.4.976, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.bundle_e_sqlite3.2.0.4\lib\net461\SQLitePCLRaw.batteries_v2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.core, Version=2.0.4.976, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.core.2.0.4\lib\netstandard2.0\SQLitePCLRaw.core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.nativelibrary, Version=2.0.4.976, Culture=neutral, PublicKeyToken=502ed628492ab262, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.bundle_e_sqlite3.2.0.4\lib\net461\SQLitePCLRaw.nativelibrary.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SQLitePCLRaw.provider.dynamic_cdecl, Version=2.0.4.976, Culture=neutral, PublicKeyToken=b68184102cba0b3b, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.provider.dynamic_cdecl.2.0.4\lib\netstandard2.0\SQLitePCLRaw.provider.dynamic_cdecl.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Data.SQLite">
|
||||
<HintPath>..\DLL\System.Data.SQLite.dll</HintPath>
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Numerics" />
|
||||
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.5.0.0\lib\net45\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
@@ -86,9 +113,11 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="ChanSort.Loader.Philips.ini">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Resources.cs.resx" />
|
||||
@@ -104,4 +133,11 @@
|
||||
<EmbeddedResource Include="Resources.tr.resx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.4\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets" Condition="Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.4\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.4\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SQLitePCLRaw.lib.e_sqlite3.2.0.4\build\net461\SQLitePCLRaw.lib.e_sqlite3.targets'))" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -201,7 +201,14 @@ namespace ChanSort.Loader.Philips
|
||||
fileData.content = File.ReadAllBytes(fileName);
|
||||
fileData.textContent = Encoding.UTF8.GetString(fileData.content);
|
||||
fileData.newline = fileData.textContent.Contains("\r\n") ? "\r\n" : "\n";
|
||||
fileData.indent = fileData.textContent.Contains(" <") ? " " : "";
|
||||
|
||||
// indentation can be 0, 2 or 4 spaces
|
||||
var idx1 = fileData.textContent.IndexOf("<Channel>");
|
||||
var idx0 = fileData.textContent.LastIndexOf("\n", idx1+1);
|
||||
if (idx0 >= 0 && idx1 >= 0)
|
||||
fileData.indent = fileData.textContent.Substring(idx0 + 1, idx1 - idx0 - 1);
|
||||
else
|
||||
fileData.indent = fileData.textContent.Contains(" <") ? " " : "";
|
||||
|
||||
var settings = new XmlReaderSettings
|
||||
{
|
||||
|
||||
11
source/ChanSort.Loader.Philips/app.config
Normal file
11
source/ChanSort.Loader.Philips/app.config
Normal file
@@ -0,0 +1,11 @@
|
||||
<?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-5.0.0.0" newVersion="5.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
13
source/ChanSort.Loader.Philips/packages.config
Normal file
13
source/ChanSort.Loader.Philips/packages.config
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Data.Sqlite" version="5.0.5" targetFramework="net48" />
|
||||
<package id="Microsoft.Data.Sqlite.Core" version="5.0.5" targetFramework="net48" />
|
||||
<package id="SQLitePCLRaw.bundle_e_sqlite3" version="2.0.4" targetFramework="net48" />
|
||||
<package id="SQLitePCLRaw.core" version="2.0.4" targetFramework="net48" />
|
||||
<package id="SQLitePCLRaw.lib.e_sqlite3" version="2.0.4" targetFramework="net48" />
|
||||
<package id="SQLitePCLRaw.provider.dynamic_cdecl" version="2.0.4" targetFramework="net48" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net48" />
|
||||
<package id="System.Memory" version="4.5.4" targetFramework="net48" />
|
||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="5.0.0" targetFramework="net48" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user