public RhinoExecutionCommand(DotNetProject project, McNeelProjectType pluginType, string workingDirectory, string outputname, string startArguments, IDictionary <string, string> environmentVariables) { Project = project; Arguments = startArguments; WorkingDirectory = workingDirectory; Command = outputname; RhinoVersion = project.GetRhinoVersion() ?? Helpers.DefaultRhinoVersion; RhinoPluginType = pluginType; for (int i = 0; i < Project.References.Count; i++) { // old way of finding app by using the path to RhinoCommon.dll var reference = Project.References[i]; if (reference.HintPath != null && reference.HintPath.FileNameWithoutExtension == Helpers.RhinoCommonReferenceName) { RhinoCommonPath = reference.HintPath; } } string target = Command; if (!string.IsNullOrWhiteSpace(target) && File.Exists(target)) { PluginPath = target; BinDir = Path.GetDirectoryName(target); } EnvironmentVariables = environmentVariables != null ? new Dictionary <string, string>(environmentVariables) : new Dictionary <string, string>(); if (!string.IsNullOrEmpty(BinDir)) { EnvironmentVariables["RHINO_BIN_DIRECTORY"] = BinDir; } if (!string.IsNullOrEmpty(PluginPath)) { if (RhinoPluginType == McNeelProjectType.Grasshopper) { EnvironmentVariables["GRASSHOPPER_PLUGINS"] = PluginPath; } else if (RhinoPluginType == McNeelProjectType.RhinoCommon) { EnvironmentVariables["RHINO_PLUGIN_PATH"] = PluginPath; } } }
public static string GetExtension(this McNeelProjectType type) { switch (type) { case McNeelProjectType.None: case McNeelProjectType.DebugStarter: return(".dll"); case McNeelProjectType.Grasshopper: return(".gha"); case McNeelProjectType.RhinoCommon: return(".rhp"); default: throw new NotSupportedException(); } }
string GetTypeLabel(McNeelProjectType type) { switch (type) { case McNeelProjectType.None: return("Library"); case McNeelProjectType.DebugStarter: return("Rhino Development"); case McNeelProjectType.RhinoCommon: return("Rhino Plugin"); case McNeelProjectType.Grasshopper: return("Grasshopper Component"); default: return(null); } }