mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-05-07 14:37:49 +02:00
- updated nuget packages
- fixed issues where SQLite database files didn't get unlocked after saving - fixed quirks with missing e_sqlite3.dll when running unit tests with Resharper
This commit is contained in:
@@ -68,20 +68,17 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.Data.Sqlite, Version=5.0.8.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Data.Sqlite.Core.5.0.8\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
|
||||
<Reference Include="Microsoft.Data.Sqlite, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Data.Sqlite.Core.7.0.0\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 Include="SQLitePCLRaw.batteries_v2, Version=2.1.2.1721, Culture=neutral, PublicKeyToken=8226ea5df37bcae9, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.bundle_e_sqlite3.2.1.2\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 Include="SQLitePCLRaw.core, Version=2.1.2.1721, Culture=neutral, PublicKeyToken=1488e028ca7ab535, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.core.2.1.2\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 Include="SQLitePCLRaw.provider.dynamic_cdecl, Version=2.1.2.1721, Culture=neutral, PublicKeyToken=b68184102cba0b3b, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLitePCLRaw.provider.dynamic_cdecl.2.1.2\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">
|
||||
@@ -90,15 +87,15 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<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 Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.5\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 Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
@@ -131,13 +128,6 @@
|
||||
</ItemGroup>
|
||||
<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>
|
||||
<!-- 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">
|
||||
|
||||
@@ -37,70 +37,60 @@ namespace ChanSort.Loader.Samsung.Zip
|
||||
|
||||
|
||||
#region Load()
|
||||
|
||||
public override void Load()
|
||||
{
|
||||
try
|
||||
this.UnzipFileToTempFolder();
|
||||
if (File.Exists(this.TempPath + "\\sat"))
|
||||
{
|
||||
this.UnzipFileToTempFolder();
|
||||
if (File.Exists(this.TempPath + "\\sat"))
|
||||
try
|
||||
{
|
||||
// try
|
||||
{
|
||||
using (var conn = new SqliteConnection("Data Source=" + this.TempPath + "\\sat"))
|
||||
{
|
||||
conn.Open();
|
||||
this.ReadSatDatabase(conn);
|
||||
}
|
||||
}
|
||||
// catch
|
||||
//{
|
||||
//}
|
||||
using var conn = new SqliteConnection("Data Source=" + this.TempPath + "\\sat");
|
||||
conn.Open();
|
||||
this.ReadSatDatabase(conn);
|
||||
}
|
||||
|
||||
var files = Directory.GetFiles(this.TempPath, "*.");
|
||||
if (files.Length == 0)
|
||||
throw LoaderException.TryNext("The Samsung .zip channel list archive does not contain any supported files.");
|
||||
|
||||
foreach (var filePath in files)
|
||||
catch
|
||||
{
|
||||
var filename = Path.GetFileName(filePath) ?? "";
|
||||
if (filename.StartsWith("vconf_"))
|
||||
continue;
|
||||
try
|
||||
{
|
||||
using (var conn = new SqliteConnection("Data Source=" + filePath))
|
||||
{
|
||||
FileType type;
|
||||
conn.Open();
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
this.RepairCorruptedDatabaseImage(cmd);
|
||||
type = this.DetectFileType(cmd);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case FileType.SatDb:
|
||||
break;
|
||||
case FileType.ChannelDbAnalog:
|
||||
case FileType.ChannelDbDvb:
|
||||
case FileType.ChannelDbIp:
|
||||
ReadChannelDatabase(conn, filePath, type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
// not all files in the folder are SQLite databases
|
||||
}
|
||||
}
|
||||
finally
|
||||
|
||||
var files = Directory.GetFiles(this.TempPath, "*.");
|
||||
if (files.Length == 0)
|
||||
throw LoaderException.TryNext("The Samsung .zip channel list archive does not contain any supported files.");
|
||||
|
||||
foreach (var filePath in files)
|
||||
{
|
||||
// force closing the file and releasing the locks
|
||||
//SqliteConnection.ClearAllPools();
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
var filename = Path.GetFileName(filePath) ?? "";
|
||||
if (filename.StartsWith("vconf_"))
|
||||
continue;
|
||||
|
||||
FileType type;
|
||||
try
|
||||
{
|
||||
using var conn = new SqliteConnection("Data Source=" + filePath);
|
||||
conn.Open();
|
||||
using (var cmd = conn.CreateCommand())
|
||||
{
|
||||
this.RepairCorruptedDatabaseImage(cmd);
|
||||
type = this.DetectFileType(cmd);
|
||||
}
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case FileType.SatDb:
|
||||
break;
|
||||
case FileType.ChannelDbAnalog:
|
||||
case FileType.ChannelDbDvb:
|
||||
case FileType.ChannelDbIp:
|
||||
ReadChannelDatabase(conn, filePath, type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// ignore non-SQLite files in the folder
|
||||
}
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
@@ -495,7 +485,6 @@ namespace ChanSort.Loader.Samsung.Zip
|
||||
}
|
||||
|
||||
// force closing the file and releasing the locks
|
||||
//SqliteConnection.ClearAllPools();
|
||||
GC.Collect();
|
||||
GC.WaitForPendingFinalizers();
|
||||
|
||||
@@ -506,22 +495,29 @@ namespace ChanSort.Loader.Samsung.Zip
|
||||
#region SaveChannelList()
|
||||
private void SaveChannelList(ChannelList channelList, string dbPath)
|
||||
{
|
||||
using var conn = new SqliteConnection("Data Source=" + dbPath);
|
||||
conn.Open();
|
||||
using (var trans = conn.BeginTransaction())
|
||||
try
|
||||
{
|
||||
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 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 cmd = conn.CreateCommand();
|
||||
this.RepairCorruptedDatabaseImage(cmd);
|
||||
using var cmd = conn.CreateCommand();
|
||||
this.RepairCorruptedDatabaseImage(cmd);
|
||||
}
|
||||
finally
|
||||
{
|
||||
SqliteConnection.ClearAllPools();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -2,6 +2,14 @@
|
||||
<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.1.2" newVersion="4.0.1.2" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.Data.Sqlite" version="5.0.8" targetFramework="net48" />
|
||||
<package id="Microsoft.Data.Sqlite.Core" version="5.0.8" 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="Microsoft.Data.Sqlite" version="7.0.0" targetFramework="net48" />
|
||||
<package id="Microsoft.Data.Sqlite.Core" version="7.0.0" targetFramework="net48" />
|
||||
<package id="SQLitePCLRaw.bundle_e_sqlite3" version="2.1.2" targetFramework="net48" />
|
||||
<package id="SQLitePCLRaw.core" version="2.1.2" targetFramework="net48" />
|
||||
<package id="SQLitePCLRaw.lib.e_sqlite3" version="2.1.2" targetFramework="net48" />
|
||||
<package id="SQLitePCLRaw.provider.dynamic_cdecl" version="2.1.2" 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.Memory" version="4.5.5" 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" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user