Skip to content

Commit

Permalink
Fix temp Plugin runtime cache name (#1500)
Browse files Browse the repository at this point in the history
* Fix temp Plugin runtime cache name

#1499

* gud
  • Loading branch information
stevencohn authored Jul 23, 2024
1 parent 04a6c55 commit 30677cb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
8 changes: 7 additions & 1 deletion OneMore/Commands/File/RunPluginCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,13 @@ private async Task<string> PrepareHierarchyCache()

// derive a temp file name from the notebook ID which is of the form {ID}{}{}
// so grab just the ID part which should be a hyphenated Guid value
var name = notebook.Attribute("ID").Value;
var name = notebook.Name.LocalName == "Notebooks"
? notebook.Elements(ns + "Notebook").FirstOrDefault()?.Attribute("ID").Value
: notebook.Attribute("ID").Value;

// shouldn't happen, but fall back to generic Guid
name ??= Guid.NewGuid().ToString("D");

name = name.Substring(1, name.IndexOf('}') - 1).Replace("-", string.Empty);
workpath = Path.Combine(Path.GetTempPath(), $"{name}.xml");

Expand Down
17 changes: 16 additions & 1 deletion OneMore/Commands/Tools/ShowXmlDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,9 @@ private int Colorize(RichTextBox box, bool editedBy)
else
{
// recycleBin
matches = Regex.Matches(box.Text, "(?:isRecycleBin|isInRecycleBin|isDeletedPages)=\"[^\"]*\"");
matches = Regex.Matches(box.Text,
"(?:isRecycleBin|isInRecycleBin|isDeletedPages)=\"[^\"]*\"");

foreColor = manager.GetColor("XmlTrash");

foreach (Match m in matches)
Expand All @@ -594,6 +596,19 @@ private int Colorize(RichTextBox box, bool editedBy)
box.SelectionLength = m.Length;
box.SelectionColor = foreColor;
}

// locked
matches = Regex.Matches(box.Text,
"(?:encrypted|locked)=\"[^\"]*\"");

foreColor = manager.GetColor("MenuItemBorder");

foreach (Match m in matches)
{
box.SelectionStart = m.Index;
box.SelectionLength = m.Length;
box.SelectionColor = foreColor;
}
}

return selectionStart < 0 ? 0 : selectionStart;
Expand Down

0 comments on commit 30677cb

Please sign in to comment.