Folders

public static class Folders
Provides static properties for files and folders relevant to the Grasshopper process.

Fields

DocumentationWipFolderName

#
Gets the standard name for the documentation authoring folder.
public const string DocumentationWipFolderName = "Documentation In Progress"

Properties

CoreComponentsFolder

#
Gets the folder in which all core component assemblies are stored.
public static string CoreComponentsFolder { get; }

CoreSnippetsFolder

#
Gets the Grasshopper native snippet folder.
public static string CoreSnippetsFolder { get; }

DiagnosticsFolder

#
Gets the Grasshopper diagnostics folder for the roaming user. This is where logged data and other output useful for debugging is kept.
public static string DiagnosticsFolder { get; }

DisplayRulesFolder

#
Gets the Grasshopper folder for named display rules for the roaming user.
public static string DisplayRulesFolder { get; }

DisplayStylesFolder

#
Gets the Grasshopper folder for display styles for the roaming user.
public static string DisplayStylesFolder { get; }

DllAssembly

#
Gets the location of the Grasshopper2.dll file.
public static string DllAssembly { get; }

DocumentationAuthoringFolder

#
Gets or sets the folder within which in-progress documenation content resides. When set, and when the folder exists, various UI elements providing access to documentation editing tools become visible.
public static string DocumentationAuthoringFolder { get; set; }

DocumentationCacheFolder

#
Gets the folder for storing cached content generated or downloaded for the documentation.
public static string DocumentationCacheFolder { get; }

DocumentationCustomFolders

#
Gets all enabled, user specified custom documentation folders. This property automatically selects the correct language subfolder if possible, so it does more work than DocumentationCustomFolderSet.
public static IEnumerable<string> DocumentationCustomFolders { get; }

DocumentationCustomFolderSet

#
Gets all specified custom folders including the 'enabled' state for each. This property will return all set folders, even if they do not exist on the disc.
public static IEnumerable<(string folder, bool enabled)> DocumentationCustomFolderSet { get; }

DocumentationFolder

#
Gets the folder which holds the canonical documentation content. For a source build that is the 'Grasshopper2Documentation' folder in the repository; for an installed instance it is the 'Documentation' folder which ships alongside Grasshopper. Returns null when neither can be located.
public static string DocumentationFolder { get; }

GrasshopperPluginId

#
Gets the plugin ID of the Grasshopper 2 Rhino plugin.
public static Guid GrasshopperPluginId { get; }

LocalAppDataFolder

#
Gets the Grasshopper application data folder for the non-roaming user.
public static string LocalAppDataFolder { get; }

PluginFolder

#
Gets the folder that contains the installed grasshopper core files.
public static string PluginFolder { get; }

ResourcesFolder

#
Gets the folder that contains the installed grasshopper resources.
public static string ResourcesFolder { get; }

RhpAssembly

#
Gets the location of the Grasshopper2.rhp file.
public static string RhpAssembly { get; }

RoamingAppDataFolder

#
Gets the Grasshopper application data folder for the roaming user. This is where resources and settings are stored since no elevated priviliges are required to access the appdata folder.
public static string RoamingAppDataFolder { get; }

SettingsFolder

#
Gets the Grasshopper settings folder for the roaming user.
public static string SettingsFolder { get; }

SkinsFolder

#
Gets the Grasshopper folder for canvas skins for the roaming user.
public static string SkinsFolder { get; }

UnnamedFilesFolder

#
Gets the folder under which autosave files for unnamed documents live. Named documents place their autosaves next to the original file on disk; unnamed documents have nowhere to put a sibling autosave, so they get a managed home under LocalAppDataFolder instead. Filenames within this folder are keyed by a short prefix of the document's runtime Document.Identity.
public static string UnnamedFilesFolder { get; }

UserSnippetsFolder

#
Gets the Grasshopper snippet folder for the roaming user.
public static string UserSnippetsFolder { get; }

Methods

AddCustomDocumentationFolder

#
Add a custom documentation folder alongside the enabled state.
public static void AddCustomDocumentationFolder(
folder,
enabled
)

EditCustomDocumentationFolders

#
Show the editor for adding and removing custom documentation folders.
public static bool EditCustomDocumentationFolders()
True if a change to the custom folders as made.

EnsureDefaultResources

#
Ensure that all required resource files exist. This method will copy resource files from the Grasshopper2.dll assembly resources into the Resources folder in the app data. Note however that it will only replace missing files, not invalid files.
public static string[] EnsureDefaultResources()
Array of files that were re-instated.

GetResourceAsBitmap

#
Try and get embedded resources from an assembly in image format.
public static Bitmap GetResourceAsBitmap(
assembly,
Assembly.
location
Resource location.
)
The image contents of the resource, or null if the resource cannot be found.

GetResourceAsBytes

#
Try and get embedded resources from an assembly in byte array format.
public static byte[] GetResourceAsBytes(
assembly,
Assembly.
location
Resource location.
)
The byte contents of the resource, or null if the resource cannot be found.

GetResourceAsStream

#
Try and get embedded resources from an assembly as a byte stream.
public static Stream GetResourceAsStream(
assembly,
Assembly.
location
Resource location.
)
The byte stream of the resource, or null if the resource cannot be found.

GetResourceAsString

#
Try and get embedded resources from an assembly in text format.
public static string GetResourceAsString(
assembly,
Assembly.
location
Resource location.
)
The textual contents of the resource, or null if the resource cannot be found.

RemoveCustomDocumentationFolder

#
Remove a custom documentation folder.
public static void RemoveCustomDocumentationFolder(
folder
)

RequestInternetAccess

#
Check the RhinoApp.IsInternetAccessAllowed state and displays a message when it returns false.
public static bool RequestInternetAccess()

ResourceFolder

#
Gets a specific resource folder.
public static string ResourceFolder(
ResourceFolder
folder
Folder type.
)
Folder path.

SanitizeFolder

#
Ensure that a folder uri ends with the OS-specific directory separator.
public static string SanitizeFolder(
folder
)

ShowDirectoryInOsFileViewer

#
Ask the OS to display a folder in its native viewer.
public static void ShowDirectoryInOsFileViewer(
directory
)

ShowFileInOsFileViewer

#
Ask the OS to display a file in its native viewer.
public static void ShowFileInOsFileViewer(
filePath
)

ShowUrlInOsBrowser

#
Ask the OS to display a url in its standard browser.
public static void ShowUrlInOsBrowser(
url
)

TryFindResourceUri

#
Try and find the uri of embedded resources within some assembly. The hint must name the resource in full, although the namespace prefix may be omitted and casing is not significant. Partial names are not matched, as suffix matching yields false positives.
public static string TryFindResourceUri(
assembly,
Assembly to examine.
hint
Name hint.
)

TryFindResourceUris

#
Find all resources which match the given pattern.
public static IEnumerable<string> TryFindResourceUris(
assembly,
pattern
)

WatchFile

#
Start watching a file for changes.
public static IDisposable WatchFile(
filePath,
changed,
created,
deleted,
renamed
)
Disposable object used to disable the watcher.