private List <ISESnippet> LoadOneDiskSnippetXmlFile(string fullFilePathName) { if (!fullFilePathName.EndsWith(".snippets.ps1xml", StringComparison.OrdinalIgnoreCase)) { throw new InvalidOperationException(Strings.Format(GuiStrings.SnippetWrongExtensionFormat, new object[] { ".snippets.ps1xml" })); } List <ISESnippet> result; try { string s = WPFHelper.ReadIfRunnable(fullFilePathName, this.authManager, true); StringReader textReader = new StringReader(s); XPathDocument docNav = new XPathDocument(textReader); List <ISESnippet> list = new List <ISESnippet>(); ISESnippetCollection.ParseAddToList(fullFilePathName, docNav, list, true); result = list; } catch (XmlException innerException) { throw new InvalidOperationException(Strings.Format(GuiStrings.SnippetBadXmlFormat, new object[] { fullFilePathName }), innerException); } catch (InvalidOperationException) { throw; } catch (Exception innerException2) { throw new InvalidOperationException(Strings.Format(GuiStrings.SnippetLoadFileMissing, new object[] { fullFilePathName }), innerException2); } return(result); }
private static int ParseAddToList(string filename, XPathDocument docNav, List <ISESnippet> loadDestination) { return(ISESnippetCollection.ParseAddToList(filename, docNav, loadDestination, false)); }
internal static int InternalAccessToParseAddToList(string filename, XPathDocument docNav, List <ISESnippet> loadDestination) { return(ISESnippetCollection.ParseAddToList(filename, docNav, loadDestination)); }