mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-26 13:12:39 +01:00
Merge pull request #4386 from OmrSi/work-on-multiple-replace
Add Multiple Replace group state to Export + Fix bug in CLI
This commit is contained in:
commit
013c8de1d0
@ -14,6 +14,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
internal const string Group = "Group";
|
||||
internal const string GroupName = "Name";
|
||||
internal const string GroupEnabled = "Enabled";
|
||||
internal const string MultipleSearchAndReplaceItem = "MultipleSearchAndReplaceItem";
|
||||
internal const string RuleEnabled = "Enabled";
|
||||
internal const string FindWhat = "FindWhat";
|
||||
@ -167,7 +168,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
}
|
||||
else
|
||||
{
|
||||
ImportRulesFile(fileName);
|
||||
Configuration.Settings.MultipleSearchAndReplaceGroups.AddRange(ImportGroupsFile(fileName));
|
||||
}
|
||||
}
|
||||
RunFromBatch(subtitle);
|
||||
@ -763,10 +764,10 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
var group = new MultipleSearchAndReplaceGroup();
|
||||
var nameNode = groupNode.SelectSingleNode(GroupName);
|
||||
if (nameNode != null)
|
||||
{
|
||||
group.Name = nameNode.InnerText;
|
||||
}
|
||||
var enabledNode = groupNode.SelectSingleNode(GroupEnabled);
|
||||
|
||||
group.Name = nameNode != null ? nameNode.InnerText : "Untitled";
|
||||
group.Enabled = enabledNode != null ? Convert.ToBoolean(enabledNode.InnerText) : false;
|
||||
|
||||
group.Rules = new List<MultipleSearchAndReplaceSetting>();
|
||||
list.Add(group);
|
||||
@ -786,9 +787,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
if (list.Count == 0)
|
||||
{
|
||||
// import into "untitled" group if only rules
|
||||
var group = new MultipleSearchAndReplaceGroup();
|
||||
group.Name = "untitled";
|
||||
group.Rules = new List<MultipleSearchAndReplaceSetting>();
|
||||
var group = new MultipleSearchAndReplaceGroup
|
||||
{
|
||||
Name = "untitled",
|
||||
Rules = new List<MultipleSearchAndReplaceSetting>()
|
||||
};
|
||||
var replaceItems = doc.DocumentElement?.SelectNodes("//MultipleSearchAndReplaceItem");
|
||||
if (replaceItems != null)
|
||||
{
|
||||
|
@ -108,6 +108,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
textWriter.WriteStartElement(MultipleReplace.Group, string.Empty);
|
||||
textWriter.WriteElementString(MultipleReplace.GroupName, group.Name);
|
||||
textWriter.WriteElementString(MultipleReplace.GroupEnabled, group.Enabled.ToString());
|
||||
foreach (var item in group.Rules)
|
||||
{
|
||||
textWriter.WriteStartElement(MultipleReplace.MultipleSearchAndReplaceItem, string.Empty);
|
||||
|
Loading…
Reference in New Issue
Block a user