mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-05-07 00:06:51 +02:00
- unlocking read-only/predefined lists in the UI removes the ChannelList.ReadOnly flag and allows saving
- added dummy-loader to handle known unsupported formats
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>ChanSort.Loader.Unsupported</RootNamespace>
|
||||
<AssemblyName>ChanSort.Loader.Unsupported</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UnsupportedPlugin.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ChanSort.Api\ChanSort.Api.csproj">
|
||||
<Project>{dccffa08-472b-4d17-bb90-8f513fc01392}</Project>
|
||||
<Name>ChanSort.Api</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("ChanSort.Loader.Unsupported")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("ChanSort.Loader.Unsupported")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2022")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("d7c32dae-5d77-46a0-bc16-c95d9c7efdd5")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
72
source/ChanSort.Loader.Unsupported/UnsupportedPlugin.cs
Normal file
72
source/ChanSort.Loader.Unsupported/UnsupportedPlugin.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using ChanSort.Api;
|
||||
|
||||
namespace ChanSort.Loader.Unsupported
|
||||
{
|
||||
// This Loader handles known unsupported file formats and informs users about the fact and that there is probably no need to ask for adding support
|
||||
|
||||
public class UnsupportedPlugin : ISerializerPlugin
|
||||
{
|
||||
public string DllName { get; set; }
|
||||
public string PluginName => "Unsupported";
|
||||
public string FileFilter => "*";
|
||||
|
||||
private string dir;
|
||||
private string name;
|
||||
private string ext;
|
||||
|
||||
public SerializerBase CreateSerializer(string inputFile)
|
||||
{
|
||||
dir = Path.GetDirectoryName(inputFile);
|
||||
name = Path.GetFileName(inputFile).ToLowerInvariant();
|
||||
ext = Path.GetExtension(name);
|
||||
|
||||
CheckForMediaTekAndroidBin();
|
||||
CheckForVestelEncryptedDb();
|
||||
|
||||
throw LoaderException.TryNext("File is not on the list of explicitly unsupported formats");
|
||||
}
|
||||
|
||||
#region CheckForMediaTekAndroidBin()
|
||||
/// <summary>
|
||||
/// Many different TV brands seem to use the same underlying hardware/firmware platform for their Android models.
|
||||
/// It is unclear how much the brands can customize the exported TV list, but many seem to use the default.
|
||||
/// In that configuration there is a .bin file, a .bin.crc, a .xml file and often a _sub.bin file on the USB stick.
|
||||
/// The .bin is a compressed archive with undocumented compression algorithm and file format.
|
||||
/// The .bin.crc does not use any of the standard CRC32 configurations.
|
||||
/// The .xml is contains only rudimentary and crippled data, that makes it useless.
|
||||
///
|
||||
/// Known manufacturers using such lists: Grundig, Nokia, Panasonic, Philips, Sharp, Xiaomi
|
||||
/// </summary>
|
||||
private void CheckForMediaTekAndroidBin()
|
||||
{
|
||||
if (ext == ".bin" || ext == ".xml" || ext == ".crc")
|
||||
{
|
||||
var fname = Path.GetFileNameWithoutExtension(name);
|
||||
if (fname.EndsWith("_sub"))
|
||||
fname = fname.Substring(0, fname.Length - 4);
|
||||
var checkExt = new[] { ".bin", ".bin.crc", ".xml" };
|
||||
var hasAll = checkExt.All(ce => File.Exists(Path.Combine(dir, fname + ce)));
|
||||
if (hasAll)
|
||||
throw LoaderException.Fail(
|
||||
@"Encrypted MediaTek Android channel lists (used by many TV brands) can't be read/modified with ChanSort.");
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region CheckForVestelEncryptedDb
|
||||
/// <summary>
|
||||
/// At some point Vestel firmware started to export encrypted settingsDB_enc.db instead of settingsDB.db.
|
||||
/// This seems to have affected many brands using the Vestel platform without their knowledge, including
|
||||
/// Panasonic, Nabo, Toshiba
|
||||
/// </summary>
|
||||
private void CheckForVestelEncryptedDb()
|
||||
{
|
||||
if (name.EndsWith("_enc") && ext == ".db")
|
||||
throw LoaderException.Fail(@"Encrypted Vestel channel lists (used by many TV brands) can't be read/modified with ChanSort.");
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user