- restrict channel name editor string length to supported max of current channel list

- added support for Samsung map-CablePrime_D channel list
- fixed loading of Samsung files which only contain a map-AstraHDPlusD channel list
This commit is contained in:
hbeham
2013-05-30 09:28:01 +02:00
parent d8902a8b5a
commit cb17398270
21 changed files with 103 additions and 39 deletions

View File

@@ -29,6 +29,7 @@ namespace ChanSort.Api
public int DuplicateUidCount { get { return duplicateUidCount; } }
public int DuplicateProgNrCount { get { return duplicateProgNrCount; } }
public bool ReadOnly { get; set; }
public int MaxChannelNameLength { get; set; }
#region Caption
public string Caption

View File

@@ -32,6 +32,9 @@ namespace ChanSort.Api
TivuSat = 3 << 12,
CanalDigital = 4 << 12,
StandardCable = 0 << 12,
CablePrime = 1 << 12,
AnalogC=Analog + Cable,
AnalogT=Analog + Antenna,
AnalogCT=Analog + Cable + Antenna,
@@ -39,7 +42,8 @@ namespace ChanSort.Api
DvbT= Digital + Antenna,
DvbCT= Digital + Cable + Antenna,
DvbS= Digital + Sat,
HdPlusD = Digital + Sat + AstraHdPlus
HdPlusD = Digital + Sat + AstraHdPlus,
CablePrimeD = Digital + Cable + CablePrime
}
#endregion

View File

@@ -179,7 +179,7 @@ namespace ChanSort.Api
#endregion
#region SetString()
public void SetString(string key, string text, int maxLen)
public int SetString(string key, string text, int maxLen)
{
var bytes = this.DefaultEncoding.GetBytes(text);
int len = Math.Min(bytes.Length, maxLen);
@@ -189,6 +189,7 @@ namespace ChanSort.Api
for (int i = len; i < maxLen; i++)
this.data[baseOffset + offset + i] = 0;
}
return len;
}
#endregion
}

View File

@@ -48,7 +48,6 @@ namespace ChanSort.Loader.LG
private int dvbsChannelCount;
private DvbsDataLayout satConfig;
private bool isDvbsSymbolRateDiv2;
private Dictionary<int, int> nextChannelIndex;
private int firmwareBlockSize;
@@ -152,6 +151,9 @@ namespace ChanSort.Loader.LG
#if STORE_DVBS_CHANNELS_IN_DATABASE
this.StoreToDatabase();
#endif
foreach (var list in this.DataRoot.ChannelLists)
list.MaxChannelNameLength = 40;
}
#endregion
@@ -305,18 +307,19 @@ namespace ChanSort.Loader.LG
long blockId = BitConverter.ToInt64(fileContent, off + 8);
if (blockId == DVBS_S2)
return true;
#if LM640T_EXPERIMENT
// LW4500, LW5400, LMxxxT and maybe other models with bogus DVB-S block
if (blockId == -1)
{
this.satConfig = satConfigs.TryGet(blockSize);
if (this.satConfig != null)
{
this.EraseDvbsBlock(off);
return true;
this.dvbsBlockSize = blockSize;
this.dvbsBlockOffset = off;
off += 4 + blockSize;
}
}
#endif
return false;
}
#endregion
@@ -583,7 +586,7 @@ namespace ChanSort.Loader.LG
#region CleanUpChannelData()
public override string CleanUpChannelData()
{
if (this.satConfig == null)
if (this.satConfig == null || this.dvbsSubblockCrcOffset == null)
return "";
this.DataRoot.NeedsSaving = true;
@@ -763,7 +766,7 @@ namespace ChanSort.Loader.LG
if (this.reorderPhysically || removeDeletedActChannels)
this.ReorderActChannelsPhysically();
if (satConfig != null)
if (this.dvbsSubblockCrcOffset != null)
this.UpdateDvbsChecksums();
using (var file = new BinaryWriter(new FileStream(tvOutputFile, FileMode.Create, FileAccess.Write)))
@@ -1007,9 +1010,10 @@ namespace ChanSort.Loader.LG
internal bool IsTesting { get; set; }
internal int ACTChannelLength { get { return this.actChannelSize; } }
internal bool HasDvbs { get { return dvbsBlockOffset != 0; } }
internal bool HasDvbs { get { return satConfig != null; } }
internal int SatChannelLength { get { return satConfig != null ? satConfig.dvbsChannelLength : 0; } }
internal decimal DvbsSymbolRateCorrectionFactor { get { return this.dvbsSymbolRateFactor; } }
internal int FirmwareBlockSize { get { return this.firmwareBlockSize; } }
internal bool HasPresetDvbsChannelNumbers { get { return this.presetChannels > 0; } }
}
}

View File

@@ -24,7 +24,6 @@ namespace ChanSort.Loader.Samsung
}
#endregion
}
}

View File

@@ -63,7 +63,7 @@
offProgramNr = 4
offNameLength =
offName = 12
lenName = 12
lenName = 10
offFavorites = 26
offChecksum = 27
@@ -81,7 +81,7 @@
offSlotNr = 16
offNameLength = 18
offName = 20
lenName = 12
lenName = 10
offFrequency = 32
offFavorites = 38
offChecksum = 39
@@ -100,7 +100,7 @@
offSlotNr = 16
offNameLength = 18
offName = 20
lenName = 12
lenName = 10
offFrequency = 32
offFavorites = 36,40,44,48,52
offChecksum = 63

View File

@@ -108,8 +108,8 @@ namespace ChanSort.Loader.Samsung
mapping.SetWord(_ProgramNr, this.NewProgramNr);
if (this.IsNameModified)
{
mapping.SetString(_Name, this.Name, mapping.Settings.GetInt("lenName"));
mapping.SetByte(_NameLength, this.Name.Length * 2);
int bytes = mapping.SetString(_Name, this.Name, mapping.Settings.GetInt("lenName"));
mapping.SetByte(_NameLength, bytes);
this.IsNameModified = false;
}
this.UpdateRawFavorites();

View File

@@ -19,12 +19,13 @@ namespace ChanSort.Loader.Samsung
private readonly MappingPool<DataMapping> ptccableMappings = new MappingPool<DataMapping>("PTC");
private readonly MappingPool<DataMapping> transponderMappings = new MappingPool<DataMapping>("TransponderDataBase");
private readonly ChannelList avbtChannels = new ChannelList(SignalSource.AnalogT|SignalSource.TvAndRadio, "analog Air");
private readonly ChannelList avbcChannels = new ChannelList(SignalSource.AnalogC|SignalSource.TvAndRadio, "analog Cable");
private readonly ChannelList dvbtChannels = new ChannelList(SignalSource.DvbT | SignalSource.Tv, "digital Air");
private readonly ChannelList dvbcChannels = new ChannelList(SignalSource.DvbC | SignalSource.TvAndRadio, "digital Cable");
private readonly ChannelList avbtChannels = new ChannelList(SignalSource.AnalogT|SignalSource.TvAndRadio, "Analog Air");
private readonly ChannelList avbcChannels = new ChannelList(SignalSource.AnalogC|SignalSource.TvAndRadio, "Analog Cable");
private readonly ChannelList dvbtChannels = new ChannelList(SignalSource.DvbT | SignalSource.Tv, "Digital Air");
private readonly ChannelList dvbcChannels = new ChannelList(SignalSource.DvbC | SignalSource.TvAndRadio, "Digital Cable");
private readonly ChannelList dvbsChannels = new ChannelList(SignalSource.DvbS | SignalSource.TvAndRadio, "Satellite");
private readonly ChannelList hdplusChannels = new ChannelList(SignalSource.HdPlusD | SignalSource.TvAndRadio, "Astra HD+");
private readonly ChannelList primeChannels = new ChannelList(SignalSource.CablePrimeD | SignalSource.TvAndRadio, "Cable Prime");
private readonly Dictionary<int, decimal> avbtFrequency = new Dictionary<int, decimal>();
private readonly Dictionary<int, decimal> avbcFrequency = new Dictionary<int, decimal>();
@@ -37,6 +38,7 @@ namespace ChanSort.Loader.Samsung
private byte[] dvbcFileContent;
private byte[] dvbsFileContent;
private byte[] hdplusFileContent;
private byte[] primeFileContent;
private ModelConstants c;
#region ctor()
@@ -98,6 +100,7 @@ namespace ChanSort.Loader.Samsung
ReadDvbctChannels(zip, "map-AirD", this.dvbtChannels, out this.dvbtFileContent, this.dvbtFrequency);
ReadDvbTransponderFrequenciesFromPtc(zip, "PTCCABLE", this.dvbcFrequency);
ReadDvbctChannels(zip, "map-CableD", this.dvbcChannels, out this.dvbcFileContent, this.dvbcFrequency);
ReadDvbctChannels(zip, "map-CablePrime_D", this.primeChannels, out this.primeFileContent, this.dvbcFrequency);
ReadSatellites(zip);
ReadTransponder(zip, "TransponderDataBase.dat");
ReadTransponder(zip, "UserTransponderDataBase.dat");
@@ -162,7 +165,8 @@ namespace ChanSort.Loader.Samsung
DetectModelFromAirAOrCableA(zip),
DetectModelFromAirDOrCableD(zip),
DetectModelFromSateD(zip),
DetectModelFromTranspoderDatabase(zip)
DetectModelFromTranspoderDatabase(zip),
DetectModelFromAstraHdPlusD(zip)
};
// note: E and F series use an identical format, so we only care about E here
@@ -210,7 +214,7 @@ namespace ChanSort.Loader.Samsung
#region DetectModelFromAirDOrCableD()
private string DetectModelFromAirDOrCableD(ZipFile zip)
{
var entry = zip.GetEntry("map-AirD") ?? zip.GetEntry("map-CableD");
var entry = zip.GetEntry("map-AirD") ?? zip.GetEntry("map-CableD") ?? zip.GetEntry("map-CablePrime_D");
if (entry == null)
return null;
@@ -260,6 +264,21 @@ namespace ChanSort.Loader.Samsung
}
#endregion
#region DetectModelFromAstraHdPlusD()
private string DetectModelFromAstraHdPlusD(ZipFile zip)
{
var entry = zip.GetEntry("map-AstraHDPlusD");
if (entry == null)
return null;
var size = entry.Size;
string candidates = null;
if (size % 212 == 0)
candidates += "DE";
return candidates;
}
#endregion
#region ReadAnalogFineTuning()
private void ReadAnalogFineTuning(ZipFile zip)
@@ -301,6 +320,7 @@ namespace ChanSort.Loader.Samsung
this.DataRoot.AddChannelList(list);
var rawChannel = analogMappings.GetMapping(entrySize);
list.MaxChannelNameLength = rawChannel.Settings.GetInt("lenName")/2;
rawChannel.SetDataPtr(data, 0);
int count = data.Length / entrySize;
@@ -360,6 +380,7 @@ namespace ChanSort.Loader.Samsung
bool isCable = (list.SignalSource & SignalSource.Cable) != 0;
this.DataRoot.AddChannelList(list);
DataMapping rawChannel = dvbctMappings.GetMapping(entrySize);
list.MaxChannelNameLength = rawChannel.Settings.GetInt("lenName") / 2;
rawChannel.SetDataPtr(data, 0);
int count = data.Length / entrySize;
for (int slotIndex = 0; slotIndex < count; slotIndex++)
@@ -447,6 +468,7 @@ namespace ChanSort.Loader.Samsung
int entrySize = c.dvbsChannelLength;
int count = this.dvbsFileContent.Length/entrySize;
DataMapping mapping = dvbsMappings.GetMapping(entrySize);
this.dvbsChannels.MaxChannelNameLength = mapping.Settings.GetInt("lenName") / 2;
mapping.SetDataPtr(dvbsFileContent, 0);
for (int slotIndex = 0; slotIndex < count; slotIndex++)
{

View File

@@ -257,6 +257,7 @@
this.gviewLeft.PopupMenuShowing += new DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventHandler(this.gviewLeft_PopupMenuShowing);
this.gviewLeft.SelectionChanged += new DevExpress.Data.SelectionChangedEventHandler(this.gviewLeft_SelectionChanged);
this.gviewLeft.ShowingEditor += new System.ComponentModel.CancelEventHandler(this.gview_ShowingEditor);
this.gviewLeft.ShownEditor += new System.EventHandler(this.gview_ShownEditor);
this.gviewLeft.FocusedRowChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(this.gviewLeft_FocusedRowChanged);
this.gviewLeft.CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(this.gviewLeft_CellValueChanged);
this.gviewLeft.CustomColumnDisplayText += new DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventHandler(this.gviewLeft_CustomColumnDisplayText);
@@ -508,6 +509,7 @@
this.gviewRight.RowCellStyle += new DevExpress.XtraGrid.Views.Grid.RowCellStyleEventHandler(this.gviewRight_RowCellStyle);
this.gviewRight.PopupMenuShowing += new DevExpress.XtraGrid.Views.Grid.PopupMenuShowingEventHandler(this.gviewRight_PopupMenuShowing);
this.gviewRight.ShowingEditor += new System.ComponentModel.CancelEventHandler(this.gview_ShowingEditor);
this.gviewRight.ShownEditor += new System.EventHandler(this.gview_ShownEditor);
this.gviewRight.FocusedRowChanged += new DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventHandler(this.gviewRight_FocusedRowChanged);
this.gviewRight.CellValueChanged += new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(this.gviewRight_CellValueChanged);
this.gviewRight.CustomColumnDisplayText += new DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventHandler(this.gviewRight_CustomColumnDisplayText);

View File

@@ -24,7 +24,7 @@ namespace ChanSort.Ui
{
public partial class MainForm : XtraForm
{
public const string AppVersion = "v2013-05-16";
public const string AppVersion = "v2013-05-29";
private const int MaxMruEntries = 5;
@@ -263,12 +263,15 @@ namespace ChanSort.Ui
firstNonEmpty = tab;
}
if (firstNonEmpty == null)
firstNonEmpty = tabChannelList.TabPages[0];
if (firstNonEmpty == this.tabChannelList.SelectedTabPage)
this.ShowChannelList((ChannelList)firstNonEmpty.Tag);
else
this.tabChannelList.SelectedTabPage = firstNonEmpty;
if (tabChannelList.TabPages.Count > 0)
{
if (firstNonEmpty == null)
firstNonEmpty = tabChannelList.TabPages[0];
if (firstNonEmpty == this.tabChannelList.SelectedTabPage)
this.ShowChannelList((ChannelList)firstNonEmpty.Tag);
else
this.tabChannelList.SelectedTabPage = firstNonEmpty;
}
}
#endregion
@@ -2116,5 +2119,13 @@ namespace ChanSort.Ui
}
#endregion
private void gview_ShownEditor(object sender, EventArgs e)
{
GridView view = (GridView) sender;
TextEdit edit = view.ActiveEditor as TextEdit;
if (edit == null) return;
edit.Properties.MaxLength = view.FocusedColumn.FieldName == "Name" ? this.currentChannelList.MaxChannelNameLength : 0;
}
}
}

View File

@@ -1404,7 +1404,7 @@
<value>DevExpress.XtraEditors.XtraForm, DevExpress.Utils.v12.2, Version=12.2.8.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a</value>
</data>
<data name="SharedImageCollection.Timestamp" type="System.DateTime, mscorlib">
<value>05/11/2013 13:20:06</value>
<value>05/26/2013 22:01:32</value>
</data>
<data name="SharedImageCollection.ImageSize" type="System.Drawing.Size, System.Drawing">
<value>16, 16</value>

View File

@@ -17,6 +17,7 @@ namespace Test.Loader.LG
public void TestLM611S_T188_Sat68TR()
{
// "wagnale"
//this.GenerateTestFiles("LM/xxLM611S-ZA00001");
this.ExecuteTest("LM/xxLM611S-ZA00001");
}

View File

@@ -6,7 +6,7 @@ namespace Test.Loader.LG
public class TestLN : TestBase
{
[TestMethod]
public void TestLX9500_T224T_Sat76TR()
public void TestLN5406_T224T_Sat76TR()
{
// "ThomasOhmes"
//this.GenerateTestFiles("LN/xxLN5406-ZA99999");

View File

@@ -41,12 +41,16 @@ namespace Test.Loader
var analogList = serializer.DataRoot.GetChannelList(ChanSort.Api.SignalSource.AnalogCT | ChanSort.Api.SignalSource.Tv);
var digitalList = serializer.DataRoot.GetChannelList(ChanSort.Api.SignalSource.DvbCT | ChanSort.Api.SignalSource.Tv);
var satChannelList = serializer.DataRoot.GetChannelList(ChanSort.Api.SignalSource.DvbS | ChanSort.Api.SignalSource.Tv);
string key = model +
string key = fileName +
model +
"\t" + serializer.ACTChannelLength+
"\t" + (analogList != null && analogList.Count > 0) +
"\t" + (digitalList != null && digitalList.Count > 0) +
"\t" + serializer.SatChannelLength +
"\t" + (satChannelList != null && satChannelList.Count > 0);
"\t" + (satChannelList != null && satChannelList.Count > 0) +
"\t" + serializer.HasPresetDvbsChannelNumbers +
"\t" + serializer.TvCountryCode;
string relPath = Path.GetFileName(Path.GetDirectoryName(file))+"\\"+fileName;
models[key] = model +
"\t" + serializer.ACTChannelLength +
@@ -54,6 +58,8 @@ namespace Test.Loader
"\t" + (analogList == null ? 0 : analogList.Count) +
"\t" + (digitalList == null ? 0 : digitalList.Count) +
"\t" + (satChannelList == null ? 0 : satChannelList.Count) +
"\t" + serializer.HasPresetDvbsChannelNumbers +
"\t" + serializer.TvCountryCode +
"\t" + serializer.DvbsSymbolRateCorrectionFactor +
"\t" + relPath;

View File

@@ -8,6 +8,7 @@ copy debug\ChanSort.*.dll "%target%"
copy debug\ChanSort.*.ini "%target%"
copy debug\Lookup.csv "%target%"
copy DLL\* "%target%"
del "%target%\*nunit*.dll"
mkdir "%target%\de" 2>nul
xcopy /siy debug\de "%target%\de"
copy readme.txt "%target%"

View File

@@ -1,9 +1,13 @@
Version v2013-05-16 ======================================================
Version v2013-05-29 ======================================================
Changes:
- FIX: on LG's LA and LN models the DVB-S symbol rate got corrupted
- disabled editing of LG channel lists whith preset program numbers
- last file is no longer loaded automatically when starting ChanSort
- Added support for Samsung "CablePrime" channel lists
- FIX: error when loading a Samsung files which only contains an
AstraHDPlus channel list.
- Channel name editor now limits the input to the maximum number of
characters allowed by the file format (e.g. 5 chars for Samsung analog
channel names)
The complete change log can be found at the end of this document
@@ -33,7 +37,7 @@ Samsung
-------
Series: B*, C, D, E, F
Lists: Air analog, Air digital, Cable analog, Cable digital,
Sat digital, Astra HD+
Cable prime, Sat digital, Astra HD+,
* NOTE: the "Air Analog"-List of the B-Series doesn't support all
editing features due to a lack of test files. If you have such a file,
@@ -101,6 +105,14 @@ OTHER DEALINGS IN THE SOFTWARE.
Change log ================================================================
2013-05-29
- Added support for Samsung "CablePrime" channel lists
- FIX: error when loading a Samsung files which only contains an
AstraHDPlus channel list.
- Channel name editor now limits the input to the maximum number of
characters allowed by the file format (e.g. 5 chars for Samsung analog
channel names)
2013-05-16
- FIX: on LG's LA and LN models the DVB-S symbol rate got corrupted
- disabled editing of LG channel lists whith preset program numbers