SnippetServer

public static class SnippetServer
Maintains all loaded snippets.

Properties

Folders

#
Gets all folders currently tracked by this server.
public static IEnumerable<string> Folders { get; }

Snippets

#
Gets all folders currently tracked by this server.
public static IEnumerable<Snippet> Snippets { get; }

UserCount

#
Gets the number of snippets across all user folders. Snippets shipped with the installation are not counted.
public static int UserCount { get; }

UserSnippets

#
Gets all snippets which come from user folders, i.e. folders added with isUser: true. Snippets shipped with the installation are excluded.
public static IEnumerable<Snippet> UserSnippets { get; }

Methods

AddFolder

#
Add a folder containing snippets to this server. The folder is scanned for *.ghz files and a watcher is installed to keep the snippet list in sync with the file system. Duplicate folders are silently ignored.
public static void AddFolder(
folder,
Folder to scan.
isUser
True if this folder holds user-authored snippets. Folders shipped with the installation should pass false so they can be excluded from the user-only enumerator.
)

FindById

#
Look up a tracked snippet by its Snippet.Id. Returns null if no match is found.
public static Snippet FindById(
id
)

RemoveFolder

#
Remove a folder from this server. Its watcher is disposed and its tracked snippets are forgotten.
public static bool RemoveFolder(
folder
)
True if the folder was being tracked and has now been removed.

Search

#
Search all snippets and append them to a result.
public static void Search(
queryFragments,
Clean search query terms.
results
Result to append Snippet instances to.
)

Events

SnippetsChanged

#
Raised whenever the tracked folder list changes, or any folder's snippet list changes.
public static event EventHandler SnippetsChanged