mirror of
https://github.com/PredatH0r/ChanSort.git
synced 2026-02-01 03:59:03 +01: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
|
||||
|
||||
}
|
||||
}
|
||||
@@ -98,6 +98,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Loader.Loewe", "Ch
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test.Loader.CmdbBin", "Test.Loader.CmdbBin\Test.Loader.CmdbBin.csproj", "{3B7C25DF-645B-4ACF-8528-27EF40FAF91F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChanSort.Loader.Unsupported", "ChanSort.Loader.Unsupported\ChanSort.Loader.Unsupported.csproj", "{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
All_Debug|Any CPU = All_Debug|Any CPU
|
||||
@@ -1195,6 +1197,36 @@ Global
|
||||
{3B7C25DF-645B-4ACF-8528-27EF40FAF91F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{3B7C25DF-645B-4ACF-8528-27EF40FAF91F}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{3B7C25DF-645B-4ACF-8528-27EF40FAF91F}.Release|x86.Build.0 = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.All_Release|x86.Build.0 = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.NoDevExpress_Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.NoDevExpress_Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.NoDevExpress_Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.NoDevExpress_Debug|Mixed Platforms.Build.0 = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.NoDevExpress_Debug|x86.ActiveCfg = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.NoDevExpress_Debug|x86.Build.0 = Debug|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{D7C32DAE-5D77-46A0-BC16-C95D9C7EFDD5}.Release|x86.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -594,6 +594,10 @@
|
||||
<Project>{f6f02792-07f1-48d5-9af3-f945ca5e3931}</Project>
|
||||
<Name>ChanSort.Loader.Toshiba</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ChanSort.Loader.Unsupported\ChanSort.Loader.Unsupported.csproj">
|
||||
<Project>{d7c32dae-5d77-46a0-bc16-c95d9c7efdd5}</Project>
|
||||
<Name>ChanSort.Loader.Unsupported</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\ChanSort.Loader.VDR\ChanSort.Loader.VDR.csproj">
|
||||
<Project>{74a18c6f-09ff-413e-90d9-827066fa5b36}</Project>
|
||||
<Name>ChanSort.Loader.VDR</Name>
|
||||
|
||||
@@ -648,6 +648,7 @@ namespace ChanSort.Ui
|
||||
this.currentPlugin = plugin;
|
||||
this.currentTvSerializer = serializer;
|
||||
this.DataRoot = serializer.DataRoot;
|
||||
this.ApplyReadOnlyOverride();
|
||||
this.AddFileToMruList(serializer.FileName);
|
||||
this.UpdateMruMenu();
|
||||
|
||||
@@ -2210,7 +2211,16 @@ namespace ChanSort.Ui
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region ApplyReadOnlyOverride()
|
||||
private void ApplyReadOnlyOverride()
|
||||
{
|
||||
if (this.miAllowEditPredefinedLists.Down)
|
||||
{
|
||||
foreach (var list in this.DataRoot.ChannelLists)
|
||||
list.ReadOnly = false;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
// UI events
|
||||
|
||||
@@ -3078,6 +3088,7 @@ namespace ChanSort.Ui
|
||||
{
|
||||
TryExecute(() =>
|
||||
{
|
||||
this.ApplyReadOnlyOverride();
|
||||
this.UpdateGridReadOnly();
|
||||
this.UpdateMenu();
|
||||
});
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
ChanSort Change Log
|
||||
===================
|
||||
|
||||
TBA
|
||||
- fixed: menu "settings / allow editing predefined lists (DANGEROUS)" unlocked the edit functions
|
||||
in the user interface, but changes to those lists were not saved to disk.
|
||||
|
||||
2022-12-04
|
||||
- fixed: various .xml file formats could not be loaded anymore
|
||||
- channels can also be swapped now be directly selecting two rows and clicking on "swap"
|
||||
|
||||
Reference in New Issue
Block a user