Exemplo n.º 1
0
        public static O2AppDomainFactory openO2ReplInClojureFolder(this API_Clojure apiClojure, bool openScriptInEditor_InsteadOfExecutingIt)
        {
            var defaultAssemblies = new List <string>()
            {
                "FluentSharp.CoreLib.dll".assembly_Location(),
                "FluentSharp.BCL.dll".assembly_Location(),
                "FluentSharp.REPL.exe".assembly_Location(),
                "O2_Platform_External_SharpDevelop.dll".assembly_Location()
            };

            var name       = "Clojure".add_RandomLetters(4);
            var baseFolder = apiClojure.RootFolder;
            //var o2ScriptsFolder = apiClojure.RootFolder.append("O2");
            var o2ScriptsFolder = apiClojure.RootFolder;
            var clojureExe      = apiClojure.ClojureExe;

            if (baseFolder.dirExists().isFalse())
            {
                "in openO2ReplInClojureFolder, provided base folder didn't exist: {0}".error(baseFolder);
                apiClojure.script_Me();
                return(null);
            }
            "Clojure-icon.png".local().file_Copy(o2ScriptsFolder);
            "Launch Clojure REPL.h2".local().file_Copy(o2ScriptsFolder);
            "API_Clojure.cs".local().file_Copy(o2ScriptsFolder);

            "[openO2ReplInClojureFolder] creating AppDomain on folder {0}".info(baseFolder);
            var o2AppDomain = new O2AppDomainFactory(name, baseFolder, defaultAssemblies);

            var scriptToExecute = "Launch Clojure REPL.h2".local().fileContents();
            //"Script to execute: {0}".info(scriptToExecute);
            var script_Base64Encoded = scriptToExecute.base64Encode();

            if (openScriptInEditor_InsteadOfExecutingIt)
            {
                scriptToExecute = "open.scriptEditor().inspector.set_Script(\"{0}\".base64Decode()).waitForClose();".line().format(script_Base64Encoded);
            }

            o2AppDomain.executeScriptInAppDomain(scriptToExecute, false, false);
            return(o2AppDomain);
        }
Exemplo n.º 2
0
 public static O2Proxy                           executeScriptInAppDomain(this O2AppDomainFactory o2AppDomain, string scriptToExecute)
 {
     return(o2AppDomain.executeScriptInAppDomain(scriptToExecute, false, false));
 }