示例#1
0
        public bool CallRider(string args)
        {
            var paths      = RiderPathLocator.GetAllFoundPaths(myPluginSettings.OperatingSystemFamilyRider);
            var defaultApp = myRiderPathProvider.GetDefaultRiderApp(EditorPrefsWrapper.ExternalScriptEditor, paths);

            if (string.IsNullOrEmpty(defaultApp))
            {
                return(false);
            }

            var proc = new Process();

            if (myPluginSettings.OperatingSystemFamilyRider == OperatingSystemFamilyRider.MacOSX)
            {
                proc.StartInfo.FileName  = "open";
                proc.StartInfo.Arguments = string.Format("-n {0}{1}{0} --args {2}", "\"", "/" + defaultApp, args);
                myLogger.Verbose("{0} {1}", proc.StartInfo.FileName, proc.StartInfo.Arguments);
            }
            else
            {
                proc.StartInfo.FileName  = defaultApp;
                proc.StartInfo.Arguments = args;
                myLogger.Verbose("{2}{0}{2}" + " {1}", proc.StartInfo.FileName, proc.StartInfo.Arguments, "\"");
            }

            proc.StartInfo.UseShellExecute = true; // avoid HandleInheritance
            proc.Start();

            ActivateWindow(proc.Id);
            return(true);
        }
示例#2
0
        // This an entry point
        static PluginEntryPoint()
        {
            PluginSettings.InitLog();                         // init log before doing any logging
            ourLogEventCollector = new UnityEventCollector(); // start collecting Unity messages asap

            ourPluginSettings    = new PluginSettings();
            ourRiderPathProvider = new RiderPathProvider(ourPluginSettings);

            if (IsLoadedFromAssets()) // old mechanism, when EditorPlugin was copied to Assets folder
            {
                var riderPath = ourRiderPathProvider.GetDefaultRiderApp(EditorPrefsWrapper.ExternalScriptEditor,
                                                                        RiderPathLocator.GetAllFoundPaths(ourPluginSettings.OperatingSystemFamilyRider));
                if (string.IsNullOrEmpty(riderPath))
                {
                    return;
                }

                AddRiderToRecentlyUsedScriptApp(riderPath);
                if (!PluginSettings.RiderInitializedOnce)
                {
                    EditorPrefsWrapper.ExternalScriptEditor = riderPath;
                    PluginSettings.RiderInitializedOnce     = true;
                }
                if (Enabled)
                {
                    InitForPluginLoadedFromAssets();
                    Init();
                }
            }
            else
            {
                Init();
            }
        }