Example #1
0
        void SetCustomLauncherText()
        {
            customLauncherEntry.IsEditable = launcherCombo.Active == 3; // custom
            var outputFileName = project.GetOutputFileName(project.DefaultConfiguration.Selector);

            switch (launcherCombo.Active)
            {
            case 0:
                // auto detect
                var version = project.GetRhinoVersion() ?? Helpers.DefaultRhinoVersion;
                var appPath = project.DetectApplicationPath(outputFileName, version);
                customLauncherEntry.Text = appPath;
                break;

            case 1:
                customLauncherEntry.Text = Helpers.StandardInstallPath;
                break;

            case 2:
                customLauncherEntry.Text = Helpers.StandardInstallWipPath;
                break;

            case 3:
                var currentLauncherIndex = GetLauncherComboIndex();
                if (currentLauncherIndex == 3) // custom
                {
                    customLauncherEntry.Text = project.ProjectProperties.GetValue(Helpers.RhinoLauncherProperty);
                }
                else
                {
                    customLauncherEntry.Text = string.Empty;
                }
                break;

            case 4:
                customLauncherEntry.Text = Helpers.GetXcodeDerivedDataPath(outputFileName);
                break;
            }
        }
        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;
                }
            }
        }