Skip to content

Commit c3241b3

Browse files
author
Sébastien Geiser
committed
Save TextSource
1 parent 9d785e8 commit c3241b3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

RegexDialog/RegExToolDialog.xaml.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,16 @@ private void OpenRegex()
17401740
.FirstOrDefault(c => c.Value.StartsWith("#CSharpTextSource\r\n"))?
17411741
.Value
17421742
.Replace("#CSharpTextSource\r\n", string.Empty) ?? string.Empty;
1743+
if(Enum.TryParse(root.SelectNodes("//comment()")
1744+
.Cast<XmlComment>()
1745+
.FirstOrDefault(c => c.Value.StartsWith("#TextSource"))
1746+
.Value
1747+
.Replace("#TextSource ", string.Empty)
1748+
, out RegexTextSource regexTextSource))
1749+
{
1750+
Config.Instance.TextSourceOn = regexTextSource;
1751+
}
1752+
17431753

17441754
string[] xOptions = root.SelectSingleNode("//Options").InnerText.Split(' ');
17451755

@@ -1791,6 +1801,7 @@ private void Save_as_MenuItem_Click(object sender, RoutedEventArgs e)
17911801
root.AppendChild(xmlDoc.CreateComment("ReplaceIsCSharp"));
17921802
root.AppendChild(replacePatternElement);
17931803
root.AppendChild(optionsElement);
1804+
root.AppendChild(xmlDoc.CreateComment($"#TextSource {Config.Instance.TextSourceOn}"));
17941805
root.AppendChild(xmlDoc.CreateComment($"#CSharpTextSource\r\n{Config.Instance.CSharpTextSourceEditorText}"));
17951806

17961807
XmlText findPatternText = xmlDoc.CreateTextNode(RegexEditor.Text);

0 commit comments

Comments
 (0)