- 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"
- swapping mark (strike through) is now automatically removed after swapping
- swapping is now recognized as a change and will prompt to save the list on exit
This commit is contained in:
Horst Beham
2022-12-04 18:18:52 +01:00
parent 6a6eb71059
commit cc80c6ae70
4 changed files with 41 additions and 6 deletions

View File

@@ -166,7 +166,7 @@ namespace ChanSort.Loader.LG.Binary
this.fileContent = File.ReadAllBytes(this.FileName);
if (this.fileContent[0] == '<')
throw LoaderException.Fail("Invalid binary TLL file format. Maybe a GlobalClone/XML file?");
throw LoaderException.TryNext("Invalid binary TLL file format. Maybe a GlobalClone/XML file?");
int off = 0;

View File

@@ -138,7 +138,9 @@ namespace ChanSort.Loader.Philips
if (majorVersion == -1)
return new DbSerializer(inputFile);
throw LoaderException.Fail(majorVersion == int.MinValue ? SerializerBase.ERR_UnknownFormat : $"Philips ChannelMap format version {majorVersion} is not supported (yet).");
if (majorVersion != int.MinValue)
throw LoaderException.Fail($"Philips ChannelMap format version {majorVersion} is not supported (yet).");
throw LoaderException.TryNext(SerializerBase.ERR_UnknownFormat);
}
}
}

View File

@@ -1804,7 +1804,7 @@ namespace ChanSort.Ui
this.miMarkForSwapping.Enabled = mayEdit && sel.Count == 1;
this.miMarkForSwapping.Down = swapMarkChannel != null;
this.miSwapWithMarked.Enabled = mayEdit && swapMarkList != null && this.CurrentChannelList == swapMarkList;
this.miSwapWithMarked.Enabled = mayEdit && (sel.Count == 2 || swapMarkList != null && this.CurrentChannelList == swapMarkList);
this.miSkipOn.Enabled = this.miSkipOff.Enabled = this.currentTvSerializer?.Features.CanSkipChannels ?? false;
this.miLockOn.Enabled = this.miLockOff.Enabled = this.currentTvSerializer?.Features.CanLockChannels ?? false;
this.miHideOn.Enabled = this.miHideOff.Enabled = this.currentTvSerializer?.Features.CanHideChannels ?? false;
@@ -2057,9 +2057,6 @@ namespace ChanSort.Ui
private void SwapWithMarked()
{
if (this.swapMarkList == null || this.swapMarkList != this.CurrentChannelList || this.swapMarkSubList != this.subListIndex)
return;
GridView gv;
if (this.gridLeft.ContainsFocus)
gv = this.gviewLeft;
@@ -2069,6 +2066,26 @@ namespace ChanSort.Ui
return;
var chanB = (ChannelInfo)gv.FocusedRowObject;
if (this.swapMarkList == null || this.swapMarkList != this.CurrentChannelList || this.swapMarkSubList != this.subListIndex)
{
if (gv.SelectedRowsCount != 2)
return;
// allow implicit selection of 2 channels to swap
var sel = GetSelectedChannels(gv);
if (sel[0] == chanB)
this.swapMarkChannel = sel[1];
else if (sel[1] == chanB)
this.swapMarkChannel = sel[0];
else
return;
this.swapMarkList = this.CurrentChannelList;
this.swapMarkSubList = this.subListIndex;
}
if (chanB == null || chanB == this.swapMarkChannel)
return;
@@ -2079,10 +2096,20 @@ namespace ChanSort.Ui
this.gviewLeft.BeginDataUpdate();
this.gviewRight.BeginDataUpdate();
this.swapMarkChannel.NewProgramNr = chanB.NewProgramNr;
chanB.NewProgramNr = nrA;
this.miMarkForSwapping.Down = false;
this.swapMarkList = null;
this.swapMarkSubList = -1;
this.swapMarkChannel = null;
this.gviewRight.EndDataUpdate();
this.gviewLeft.EndDataUpdate();
this.DataRoot.NeedsSaving = true;
}
#endregion

View File

@@ -1,6 +1,12 @@
ChanSort Change Log
===================
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"
- swapping mark (strike through) is now automatically removed after swapping
- swapping is now recognized as a change and will prompt to save the list on exit
2022-11-30
- fixed Samsung .zip lists changing channel names to "Chinese" characters in the saved file
(caused by a breaking change in the new version of the Microsoft.Data.Sqlite library)