diff --git a/ChanSort.Api/Controller/CsvFileSerializer.cs b/ChanSort.Api/Controller/CsvFileSerializer.cs index f923c88..e8b0a8b 100644 --- a/ChanSort.Api/Controller/CsvFileSerializer.cs +++ b/ChanSort.Api/Controller/CsvFileSerializer.cs @@ -82,6 +82,7 @@ namespace ChanSort.Api if (!this.addChannels) { channel.NewProgramNr = programNr; + channel.Name = name; if (parts.Count >= 7) ApplyFlags(channel, parts[6]); } diff --git a/ChanSort.Loader.Samsung/ChanSort.Loader.Samsung.ini b/ChanSort.Loader.Samsung/ChanSort.Loader.Samsung.ini index fd8679d..25e253f 100644 --- a/ChanSort.Loader.Samsung/ChanSort.Loader.Samsung.ini +++ b/ChanSort.Loader.Samsung/ChanSort.Loader.Samsung.ini @@ -126,7 +126,9 @@ offProgramNr = 0 offVideoPid = 2 offPcrPid = 4 - offFavOld = 6 + ; "Deleted"-flag is implemented in reverse by IsActive + offIsActive = 6 + maskIsActive = 0x02 offQam = 7 offInUse = 8 maskInUse = 0x80 @@ -175,7 +177,7 @@ offLogicalProgramNr = 44 offTransportStreamId = 48 offName = 64 - lenName = 200 + lenName = 100 offShortName = 264 lenShortName = 18 offVideoFormat = 282 @@ -210,7 +212,7 @@ offLogicalProgramNr = 44 offTransportStreamId = 48 offName = 64 - lenName = 200 + lenName = 100 offShortName = 264 lenShortName = 18 offVideoFormat = 282 diff --git a/ChanSort.Loader.Samsung/SatChannel.cs b/ChanSort.Loader.Samsung/SatChannel.cs index f816634..3ab2fad 100644 --- a/ChanSort.Loader.Samsung/SatChannel.cs +++ b/ChanSort.Loader.Samsung/SatChannel.cs @@ -19,7 +19,9 @@ namespace ChanSort.Loader.Samsung Transponder transponder = dataRoot.Transponder.TryGet(transponderIndex); if (transponder == null) { - dataRoot.Warnings.AppendLine("Invalid transponder index: " + transponderIndex); + var list = dataRoot.GetChannelList(this.SignalSource|SignalSource.Tv); + dataRoot.Warnings.AppendFormat("{0} channel record #{1} (Pr# {2} \"{3}\") contains invalid transponder index {4}\r\n", + list.ShortCaption, slot, this.OldProgramNr, this.Name, transponderIndex); return; } diff --git a/ChanSort.Loader.Samsung/ScmChannelBase.cs b/ChanSort.Loader.Samsung/ScmChannelBase.cs index 2145381..dc933ee 100644 --- a/ChanSort.Loader.Samsung/ScmChannelBase.cs +++ b/ChanSort.Loader.Samsung/ScmChannelBase.cs @@ -13,6 +13,7 @@ namespace ChanSort.Loader.Samsung private const string _NameLength = "offNameLength"; private const string _ShortName = "offShortName"; private const string _Favorites = "offFavorites"; + private const string _IsActive = "IsActive"; private const string _Deleted = "Deleted"; private const string _Encrypted = "Encrypted"; private const string _Lock = "Lock"; @@ -57,7 +58,7 @@ namespace ChanSort.Loader.Samsung this.Favorites = this.ParseRawFavorites(); this.Lock = data.GetFlag(_Lock); this.Encrypted = data.GetFlag(_Encrypted); - this.IsDeleted = data.GetFlag(_Deleted); + this.IsDeleted = data.GetFlag(_Deleted, false) || !data.GetFlag(_IsActive, true); if (this.IsDeleted) this.OldProgramNr = -1; } @@ -123,11 +124,19 @@ namespace ChanSort.Loader.Samsung this.UpdateRawFavorites(); mapping.SetFlag(_Lock, this.Lock); mapping.SetFlag(_Deleted, this.NewProgramNr < 0); - + mapping.SetFlag(_IsActive, this.NewProgramNr >= 0); this.UpdateChecksum(); } #endregion + #region EraseRawData() + internal virtual void EraseRawData() + { + int len = this.mapping.Settings.GetInt("offChecksum") + 1; + Tools.MemSet(this.rawData, this.baseOffset, 0, len); + } + #endregion + #region UpdateRawFavorites() private void UpdateRawFavorites() { @@ -146,9 +155,9 @@ namespace ChanSort.Loader.Samsung { int favValue; if (this.sortedFavorites) - favValue = (fav & mask) != 0 ? this.FavIndex[favIndex] : -1; + favValue = (fav & mask) != 0 ? this.FavIndex[favIndex] : -1; // E,F series else - favValue = (fav & mask) != 0 ? 1 : 0; + favValue = (fav & mask) != 0 ? 1 : 0; // D series Array.Copy(BitConverter.GetBytes(favValue), 0, this.rawData, baseOffset + off, 4); mask <<= 1; ++favIndex; diff --git a/ChanSort.Loader.Samsung/ScmSerializer.cs b/ChanSort.Loader.Samsung/ScmSerializer.cs index 700250c..0633533 100644 --- a/ChanSort.Loader.Samsung/ScmSerializer.cs +++ b/ChanSort.Loader.Samsung/ScmSerializer.cs @@ -2,7 +2,7 @@ using System.IO; using System.Reflection; using System.Linq; -using System.Windows.Forms; +using System.Text; using ChanSort.Api; using ICSharpCode.SharpZipLib.Zip; @@ -48,6 +48,7 @@ namespace ChanSort.Loader.Samsung { this.ReadConfigurationFromIniFile(); this.Features.ChannelNameEdit = true; + this.Features.CleanUpChannelData = true; } #endregion @@ -546,21 +547,21 @@ namespace ChanSort.Loader.Samsung using (ZipFile zip = new ZipFile(tvOutputFile)) { zip.BeginUpdate(); - this.SaveChannels(zip, "map-AirA", this.avbtChannels, ref this.avbtFileContent); - this.SaveChannels(zip, "map-CableA", this.avbcChannels, ref this.avbcFileContent); - this.SaveChannels(zip, "map-AirD", this.dvbtChannels, ref this.dvbtFileContent); - this.SaveChannels(zip, "map-CableD", this.dvbcChannels, ref this.dvbcFileContent); - this.SaveChannels(zip, "map-SateD", this.dvbsChannels, ref this.dvbsFileContent); - this.SaveChannels(zip, "map-AstraHDPlusD", this.hdplusChannels, ref this.hdplusFileContent); - this.SaveChannels(zip, "map-CablePrime_D", this.primeChannels, ref this.primeFileContent); - this.SaveChannels(zip, "map-FreesatD", this.freesatChannels, ref this.freesatFileContent); + this.SaveChannels(zip, "map-AirA", this.avbtChannels, this.avbtFileContent); + this.SaveChannels(zip, "map-CableA", this.avbcChannels, this.avbcFileContent); + this.SaveChannels(zip, "map-AirD", this.dvbtChannels, this.dvbtFileContent); + this.SaveChannels(zip, "map-CableD", this.dvbcChannels, this.dvbcFileContent); + this.SaveChannels(zip, "map-SateD", this.dvbsChannels, this.dvbsFileContent); + this.SaveChannels(zip, "map-AstraHDPlusD", this.hdplusChannels, this.hdplusFileContent); + this.SaveChannels(zip, "map-CablePrime_D", this.primeChannels, this.primeFileContent); + this.SaveChannels(zip, "map-FreesatD", this.freesatChannels, this.freesatFileContent); zip.CommitUpdate(); } } #endregion #region SaveChannels() - private void SaveChannels(ZipFile zip, string fileName, ChannelList channels, ref byte[] fileContent) + private void SaveChannels(ZipFile zip, string fileName, ChannelList channels, byte[] fileContent) { if (fileContent == null) return; @@ -570,11 +571,6 @@ namespace ChanSort.Loader.Samsung using (var stream = new FileStream(tempFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite)) { this.WriteChannels(channels, fileContent, stream); - stream.Flush(); - stream.Seek(0, SeekOrigin.Begin); - int size = (int)new FileInfo(tempFilePath).Length; - fileContent = new byte[size]; - stream.Read(fileContent, 0, size); } zip.Add(tempFilePath, fileName); @@ -594,6 +590,46 @@ namespace ChanSort.Loader.Samsung } #endregion + // -------- cleanup -------- + + #region CleanUpChannelData() + public override string CleanUpChannelData() + { + StringBuilder log = new StringBuilder(); + RemoveChannelsWithServiceType0(log); + RemoveDuplicateAnalogList(log); + return log.ToString(); + } + + private void RemoveChannelsWithServiceType0(StringBuilder log) + { + foreach (var list in this.DataRoot.ChannelLists) + { + if ((list.SignalSource & SignalSource.Digital) == 0) + continue; + var listOfChannels = new List(list.Channels); + foreach (ScmChannelBase channel in listOfChannels) + { + if (channel.ServiceType == 0) + { + channel.EraseRawData(); + list.Channels.Remove(channel); + log.AppendFormat("{0} channel at index {1} (Pr# {2} \"{3}\") was erased due to invalid service type 0\r\n", + list.ShortCaption, channel.RecordIndex, channel.OldProgramNr, channel.Name); + } + } + } + } + + private void RemoveDuplicateAnalogList(StringBuilder log) + { + if (this.avbtChannels.Count == 0 || this.avbcChannels.Count == 0) + return; + // TODO + } + + #endregion + // ------- testing ----------- internal string Series { get { return c.series; } } diff --git a/ChanSort/MainForm.cs b/ChanSort/MainForm.cs index 069fc61..84bccd4 100644 --- a/ChanSort/MainForm.cs +++ b/ChanSort/MainForm.cs @@ -25,7 +25,7 @@ namespace ChanSort.Ui { public partial class MainForm : XtraForm { - public const string AppVersion = "v2013-11-09"; + public const string AppVersion = "v2013-11-16"; private const int MaxMruEntries = 5; @@ -1884,6 +1884,9 @@ namespace ChanSort.Ui #region gridLeft_DragOver private void gridLeft_DragOver(object sender, DragEventArgs e) { + if (this.dragDropInfo == null) // drag operation from outside ChanSort + return; + // this event is called on the current target of the drag operation var point = this.gridLeft.PointToClient(MousePosition); var hit = this.gviewLeft.CalcHitInfo(point); diff --git a/ChanSort/Properties/Resources.Designer.cs b/ChanSort/Properties/Resources.Designer.cs index 4370e2a..675cfb6 100644 --- a/ChanSort/Properties/Resources.Designer.cs +++ b/ChanSort/Properties/Resources.Designer.cs @@ -199,12 +199,7 @@ namespace ChanSort.Ui.Properties { } /// - /// Looks up a localized string similar to The verification of the file content showed some anomalies. Possible causes are: - ///- The TV itself created a mess in the channel lists (which happens frequently). - ///- The file format is partially unknown (e.g. unknown TV model or firmware). - ///- The file has been edited with a broken program version. - ///- ChanSort's validation rules are based on wrong assumptions. - ///You can continue editing, but it is possibile that your TV will reject the changes.. + /// Looks up a localized string similar to The file content shows some anomalies and is possibly corrupt.. /// internal static string MainForm_LoadFiles_ValidationWarningMsg { get { diff --git a/ChanSort/Properties/Resources.de.resx b/ChanSort/Properties/Resources.de.resx index 9e2f4bb..2f5ef05 100644 --- a/ChanSort/Properties/Resources.de.resx +++ b/ChanSort/Properties/Resources.de.resx @@ -161,12 +161,7 @@ Datenüberprüfung - Die Überprüfung des Dateiinhalts fand einige Auffälligkeiten. Mögliche Ursachen sind: -- Der Fernseher hat seine Senderlisten versaut (was häufig vorkommt). -- Das Dateiformat ist teilweise unbekannt (unbekanntes Modell oder Firmware). -- Die Datei wurde mit einer defekten Programmversion bearbeitet. -- Eine von ChanSort's Prüfungen geht von einer falschen Annahme aus. -Sie können mit der Bearbeitung fortfahren, es ist aber möglich, dass Ihr Fernsehgerät die Änderungen nicht annimmt. + Die Überprüfung des Dateiinhalts fand einige Auffälligkeiten, die Senderliste ist womöglich defekt. Die händische Sortierung wird überschrieben. diff --git a/ChanSort/Properties/Resources.resx b/ChanSort/Properties/Resources.resx index faab5b9..78a41cc 100644 --- a/ChanSort/Properties/Resources.resx +++ b/ChanSort/Properties/Resources.resx @@ -158,12 +158,7 @@ Error loading file - The verification of the file content showed some anomalies. Possible causes are: -- The TV itself created a mess in the channel lists (which happens frequently). -- The file format is partially unknown (e.g. unknown TV model or firmware). -- The file has been edited with a broken program version. -- ChanSort's validation rules are based on wrong assumptions. -You can continue editing, but it is possibile that your TV will reject the changes. + The file content shows some anomalies and is possibly corrupt. Data validation diff --git a/Information/FileStructures_for_HHD_Hex_Editor_Neo/scm-map-Satellite.h b/Information/FileStructures_for_HHD_Hex_Editor_Neo/scm-map-Satellite.h index 194e9c9..608c8ef 100644 --- a/Information/FileStructures_for_HHD_Hex_Editor_Neo/scm-map-Satellite.h +++ b/Information/FileStructures_for_HHD_Hex_Editor_Neo/scm-map-Satellite.h @@ -114,7 +114,7 @@ struct SCM_mapSate_EF_entry public struct SCM_mapSate_EF { - SCM_mapSate_E_entry Entries[*]; + SCM_mapSate_EF_entry Entries[*]; }; diff --git a/readme.txt b/readme.txt index 545c07a..a3f920d 100644 --- a/readme.txt +++ b/readme.txt @@ -1,14 +1,20 @@ -Version v2013-11-09 ======================================================= +Version v2013-11-16 ======================================================= Changes: -- File / "File information" now shows information for all TV models -- Disabled "TV-Set" menu items which are not applicable -- Fixed DVB-S transponder/frequency information for LG LN and LA61xx series -- Fixed deleting channels in Samsung B-series Digital Air/Cable lists -- Fixed encryption information in Samsung B-series Digital Air/Cable lists -- Fixed loading of reference lists with non-unique channel identifiers -- Fixed error when saving LG files for models LD-LK after applying a - reference list which contains channels not present in the TLL file +- Loading a .csv reference list now also changes the channel names. This + way analog channel names can be restored after a new channel scan +- FIX: changes to Samsung channel lists after the first "save file" + operation were lost. Only the first save operation worked as expected. +- FIX: dragging something (e.g. a file) from outside ChanSort over one of + its tables causes an error +- FIX: channels in Samsung B-series DVB-C/T channel lists were incorrectly + identified and marked as deleted/active, resulting in duplicate program + numbers on the TV. +- FIX: channel names in Samsung lists sometimes showed "..." after the end +- Experimental support for modifying LG channel lists with predefined + channel numbers (LCN) +- Backed-out some changes from 2013-11-09 which may have caused incorrect + handling of deleted channels in Samsung channel lists The complete change log can be found at the end of this document @@ -117,6 +123,22 @@ OTHER DEALINGS IN THE SOFTWARE. Change log ================================================================ +2013-11-16 +- FIX: changes to Samsung channel lists after the first "save file" + operation were lost. Only the first save operation worked as expected. +- FIX: channels in Samsung B-series DVB-C/T channel lists were incorrectly + identified and marked as deleted/active, resulting in duplicate program + numbers on the TV. +- FIX: channel names in Samsung lists sometimes showed "..." after the end +- FIX: dragging something (e.g. a file) from outside ChanSort over one of + its tables causes an error + +2013-11-12 (beta) +- Experimental support for modifying LG channel lists with predefined + channel numbers (LCN) +- Backed-out some changes from 2013-11-09 which may have caused incorrect + handling of deleted channels in Samsung channel lists + 2013-11-09 - File / "File information" now shows information for all TV models - Disabled "TV-Set" menu items which are not applicable