Exemplo n.º 1
0
        public bool IsSessionService(string pluginId, string serviceId)
        {
            PluginPackage     pluginPackage     = (from x in mPluginPackages where x.PluginId == pluginId select x).SingleOrDefault();
            PluginServiceInfo pluginServiceInfo = pluginPackage.GetService(serviceId);

            return(pluginServiceInfo.IsSession);
        }
Exemplo n.º 2
0
        public ObservableList <OnlinePluginPackage> GetOnlinePluginsIndex()
        {
            // edit at: "https://github.com/Ginger-Automation/Ginger-Plugins-Index/blob/master/PluginsList.json";

            // raw url to get the file content
            string url = "https://raw.githubusercontent.com/Ginger-Automation/Ginger-Plugins-Index/master/PluginsList.json";

            Reporter.ToLog(eLogLevel.INFO, "Getting Plugins list from " + url);

            ObservableList <OnlinePluginPackage> list = GitHTTPClient.GetJSON <ObservableList <OnlinePluginPackage> >(url);

            Reporter.ToLog(eLogLevel.INFO, "Online Plugins count=" + list.Count);
            ObservableList <PluginPackage> installedPlugins = mSolutionRepository.GetAllRepositoryItems <PluginPackage>();

            foreach (OnlinePluginPackage onlinePluginPackage in list)
            {
                PluginPackage pluginPackage = (from x in installedPlugins where x.PluginId == onlinePluginPackage.Id select x).FirstOrDefault();
                if (pluginPackage != null)
                {
                    onlinePluginPackage.CurrentPackage = pluginPackage.PluginPackageVersion;
                    onlinePluginPackage.Status         = "Installed - " + pluginPackage.PluginPackageVersion;
                }
            }
            return(list);
        }
Exemplo n.º 3
0
        // Get list of installed plugins in Ginger folder 'PluginPackages'
        public List <PluginPackage> GetInstalledPluginPackages()
        {
            if (mInstalledPluginPackages != null)
            {
                //TODO: check for new added plugins

                return(mInstalledPluginPackages);
            }

            mInstalledPluginPackages = new List <PluginPackage>();

            string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            if (path.Contains("GingerWPF"))                      // We are running from GingerWPF in debug mode
            {
                path = path.Replace(@"GingerWPF\bin\Debug", ""); // temp need to be Ginger installation folder !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
            }

            if (path.Contains("GingerCoreNETUnitTest"))   // We are running from GingerWPF in debug mode
            {
                path = path.Replace(@"GingerCoreNETUnitTest\bin\Debug\netcoreapp2.0", "");
            }

            string pluginPackagesPath = Path.Combine(path, "PluginPackages");

            // Each directory is a plugin package

            foreach (string d in Directory.GetDirectories(pluginPackagesPath))
            {
                PluginPackage p = new PluginPackage(d);
                mInstalledPluginPackages.Add(p);
            }
            return(mInstalledPluginPackages);
        }
Exemplo n.º 4
0
        public bool IsSessionService(string pluginId, string serviceId)
        {
            string key = pluginId + "." + serviceId;
            bool   isSession;
            bool   bFound = PluginServiceIsSeesionDictionary.TryGetValue(key, out isSession);

            if (bFound)
            {
                return(isSession);
            }

            PluginPackage pluginPackage = (from x in mPluginPackages where x.PluginId == pluginId select x).SingleOrDefault();

            pluginPackage.PluginPackageOperations = new PluginPackageOperations(pluginPackage);

            PluginServiceInfo pluginServiceInfo = ((PluginPackageOperations)pluginPackage.PluginPackageOperations).GetService(serviceId);

            if (pluginServiceInfo != null)
            {
                PluginServiceIsSeesionDictionary.Add(key, pluginServiceInfo.IsSession);
                return(pluginServiceInfo.IsSession);
            }
            else
            {
                throw new Exception("IsSessionService Error: pluginServiceInfo not found for: " + pluginId + "." + serviceId);
            }
        }
Exemplo n.º 5
0
        public List <ActionInputValueInfo> GetActionEditInfo(string pluginId, string serviceId, string actionId)
        {
            PluginPackage    pluginPackage    = (from x in mPluginPackages where x.PluginID == pluginId select x).SingleOrDefault();
            StandAloneAction standAloneAction = (from x in pluginPackage.LoadServicesInfoFromFile() where x.ServiceID == serviceId && x.ID == actionId select x).SingleOrDefault();

            return(standAloneAction.InputValues);
        }
Exemplo n.º 6
0
        // We search the plug in for all files it can edit if this plugin implemented capability of text editor
        //        public List<PlugInTextFileEditorBase> TextEditors()
        //        {
        //            List<PlugInTextFileEditorBase> list = new List<PlugInTextFileEditorBase>();
        //            //TODO:: Need to be handled once PACT implementation is done
        //            //foreach (PlugInCapability c in PlugIn.Capabilities())
        //            //{
        //            //    if (c is PlugInTextFileEditorBase)
        //            //    {
        //            //        list.Add((PlugInTextFileEditorBase)c);
        //            //    }
        //            //}
        //            return list;
        //        }

        //        public List<string> GetExtentionsByEditorID(string plugInEditorID)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB.Extensions;
        //                }
        //            }
        //            return null;
        //        }

        //        public PlugInTextFileEditorBase GetPlugInTextFileEditorBaseByEditorID(string plugInEditorID)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB;
        //                }
        //            }
        //            return null;
        //        }

        //        public string GetTemplateContentByEditorID(string plugInEditorID, string plugInExtension)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB.GetTemplatesByExtensions("." + plugInExtension);
        //                }
        //            }
        //            return null;
        //        }


        public void StartService(string PluginId)
        {
            if (string.IsNullOrEmpty(PluginId))
            {
                throw new Exception("Plugin action missing PluginId");
            }
            PluginPackage pluginPackage = (from x in mPluginPackages where x.PluginID == PluginId select x).SingleOrDefault();

            if (pluginPackage == null)
            {
                throw new Exception("PluginPackage not found in solution PluginId=" + PluginId);
            }
            if (string.IsNullOrEmpty(pluginPackage.StartupDLL))
            {
                throw new Exception("PluginPackage StartupDLL is missing in the Ginger.PluginPackage.json" + PluginId);
            }

            string dll = Path.Combine(pluginPackage.Folder, pluginPackage.StartupDLL);

            string nodeFileName = NodeConfigFile.CreateNodeConfigFile(PluginId + "1");  // TODO: check if 1 exist then try 2,3 in case more than one same id service start
            string cmd          = "dotnet " + dll + " " + nodeFileName;

            System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + cmd);
            procStartInfo.UseShellExecute = true;
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = procStartInfo;
            proc.Start();

            //TODO: delete the temp file - or create temp files tracker with auto delete
        }
Exemplo n.º 7
0
        public void Execute(string PluginId, string ServiceId, NewPayLoad payLoad)
        {
            GingerGrid gingerGrid = WorkSpace.Instance.LocalGingerGrid;

            // string PID = GA.InputParams["PluginID"].GetValueAsString();
            PluginPackage p = (from x in mPluginPackages where x.PluginID == PluginId select x).SingleOrDefault();

            if (p == null)
            {
                throw new Exception("Plugin id not found: " + PluginId);
                // GA.AddError("Execute", "Plugin id not found: " + PID);
                // return;
            }

            //TODO: use nameof after ActPlugin move to common
            // string serviceID = GA.InputParams["PluginActionID"].GetValueAsString();


            GingerNodeInfo GNI = (from x in gingerGrid.NodeList where x.Name == p.PluginID select x).FirstOrDefault();

            //run script only if service is not up
            if (GNI == null)
            {
                string script = CommandProcessor.CreateLoadPluginScript(p.Folder);

                // hard coded!!!!!!!!!!  - use ServiceId
                script += CommandProcessor.CreateStartServiceScript("PACTService", p.PluginID, SocketHelper.GetLocalHostIP(), gingerGrid.Port);
                // script += CommandProcessor.CreateStartServiceScript("ExcelService", p.PluginID, SocketHelper.GetLocalHostIP(), gingerGrid.Port);


                Task t = new Task(() =>
                {
                    // GingerConsoleHelper.Execute(script);  // keep it for regular service dll load
                    string StarterDLL = Path.Combine(p.Folder, "GingerPACTPluginConsole.dll");
                    StartService(StarterDLL);
                });
                t.Start();
            }

            int counter = 0;

            while (GNI == null && counter < 30)
            {
                Thread.Sleep(1000);
                GNI = (from x in gingerGrid.NodeList where x.Name == "PACT" select x).FirstOrDefault();
                counter++;
            }
            if (GNI == null)
            {
                // GA.AddError("Execute", "Cannot execute action beacuse Service was not found or was not abale to start: " + p.PluginID);
            }

            GingerNodeProxy GNA = new GingerNodeProxy(GNI);

            GNA.Reserve();
            GNA.GingerGrid = gingerGrid;

            //GNA.RunAction(GA);
        }
Exemplo n.º 8
0
        public List <ActionInputValueInfo> GetActionEditInfo(string pluginId, string serviceId, string actionId)
        {
            PluginPackage           pluginPackage     = (from x in mPluginPackages where x.PluginId == pluginId select x).SingleOrDefault();
            PluginServiceInfo       pluginServiceInfo = (from x in pluginPackage.Services where x.ServiceId == serviceId select x).SingleOrDefault();
            PluginServiceActionInfo actionInfo        = (from x in pluginServiceInfo.Actions where x.ActionId == actionId select x).SingleOrDefault();

            return(actionInfo.InputValues);
        }
Exemplo n.º 9
0
        public bool IsSessionService(string pluginId, string serviceId)
        {
            // TODO: Cache
            PluginPackage pluginPackage = (from x in mPluginPackages where x.PluginId == pluginId select x).SingleOrDefault();

            pluginPackage.LoadServicesFromJSON();
            PluginServiceInfo pluginServiceInfo = (from x in pluginPackage.Services where x.ServiceId == serviceId select x).SingleOrDefault();

            return(pluginServiceInfo.IsSession);
        }
Exemplo n.º 10
0
        //private void UpdateActionParamTypes(GingerAction gA, MethodInfo methodInfo)
        //{
        //    foreach (ParameterInfo PI in methodInfo.GetParameters())
        //    {
        //        if (PI.ParameterType != typeof(GingerAction))
        //        {
        //            ActionParam AP = gA.InputParams.GetOrCreateParam(PI.Name);
        //            AP.ParamType = PI.ParameterType;
        //        }
        //    }
        //}

        public void AddPluginPackage(string folder)
        {
            // Verify folder exist
            if (!System.IO.Directory.Exists(folder))
            {
                throw new Exception("Plugin folder not found: " + folder);
            }

            PluginPackage p = new PluginPackage(folder);

            mPluginPackages.Add(p);
        }
Exemplo n.º 11
0
        public void AddPluginPackage(string folder)
        {
            // Verify folder exist
            if (!System.IO.Directory.Exists(folder))
            {
                throw new Exception("Plugin folder not found: " + folder);
            }

            PluginPackage pluginPackage = new PluginPackage(folder);

            mSolutionRepository.AddRepositoryItem(pluginPackage);
        }
Exemplo n.º 12
0
 private bool isPrivatePlugin(PluginPackage solutionPlugin)
 {
     // Plugin is considered private when the folder is not in LocalUserApplicationDataFolderPath
     // It means developer added the plugin using folder and not install from online
     if (solutionPlugin.Folder.StartsWith(Common.GeneralLib.General.LocalUserApplicationDataFolderPath))
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
Exemplo n.º 13
0
        public void Execute(GingerAction GA)
        {
            GingerGrid gingerGrid = WorkSpace.Instance.LocalGingerGrid;

            string        PID = GA.InputParams["PluginID"].GetValueAsString();
            PluginPackage p   = (from x in mPluginPackages where x.PluginID == PID select x).SingleOrDefault();

            if (p == null)
            {
                GA.AddError("Execute", "Plugin id not found: " + PID);
                return;
            }

            //TODO: use nameof after ActPlugin move to common
            string serviceID = GA.InputParams["PluginActionID"].GetValueAsString();

            GingerNodeInfo GNI = (from x in gingerGrid.NodeList where x.Name == p.PluginID select x).FirstOrDefault();

            //run script only if service is not up
            if (GNI == null)
            {
                string script = CommandProcessor.CreateLoadPluginScript(p.Folder);

                // hard coded!!!!!!!!!!
                script += CommandProcessor.CreateStartServiceScript("ExcelService", p.PluginID, SocketHelper.GetLocalHostIP(), gingerGrid.Port);

                Task t = new Task(() =>
                {
                    GingerConsoleHelper.Execute(script);
                });
                t.Start();
            }

            int counter = 0;

            while (GNI == null && counter < 30)
            {
                Thread.Sleep(1000);
                GNI = (from x in gingerGrid.NodeList where x.Name == p.PluginID select x).FirstOrDefault();
                counter++;
            }


            GingerNodeProxy GNA = new GingerNodeProxy(GNI);

            GNA.Reserve();
            GNA.GingerGrid = gingerGrid;

            GNA.RunAction(GA);
        }
Exemplo n.º 14
0
        public List <GingerAction> GetDriverActions(DriverInfo DI)
        {
            List <GingerAction> actions = new List <GingerAction>();
            PluginPackage       p       = (from x in mPluginPackages where x.Folder == DI.PluginPackageFolder select x).FirstOrDefault();
            PluginDriverBase    driver  = p.GetDriver(DI.Name);

            foreach (ActionHandler AH in driver.ActionHandlers)
            {
                GingerAction GA = new GingerAction(AH.ID);
                UpdateActionParamTypes(GA, AH.MethodInfo);
                actions.Add(GA);
            }
            return(actions);
        }
Exemplo n.º 15
0
        // We search the plug in for all files it can edit if this plugin implemented capability of text editor
        //        public List<PlugInTextFileEditorBase> TextEditors()
        //        {
        //            List<PlugInTextFileEditorBase> list = new List<PlugInTextFileEditorBase>();
        //            //TODO:: Need to be handled once PACT implementation is done
        //            //foreach (PlugInCapability c in PlugIn.Capabilities())
        //            //{
        //            //    if (c is PlugInTextFileEditorBase)
        //            //    {
        //            //        list.Add((PlugInTextFileEditorBase)c);
        //            //    }
        //            //}
        //            return list;
        //        }

        //        public List<string> GetExtentionsByEditorID(string plugInEditorID)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB.Extensions;
        //                }
        //            }
        //            return null;
        //        }

        //        public PlugInTextFileEditorBase GetPlugInTextFileEditorBaseByEditorID(string plugInEditorID)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB;
        //                }
        //            }
        //            return null;
        //        }

        //        public string GetTemplateContentByEditorID(string plugInEditorID, string plugInExtension)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB.GetTemplatesByExtensions("." + plugInExtension);
        //                }
        //            }
        //            return null;
        //        }


        public System.Diagnostics.Process StartService(string pluginId, string serviceID)
        {
            Console.WriteLine("Starting Service: " + serviceID + " from Plugin: " + pluginId);
            if (string.IsNullOrEmpty(pluginId))
            {
                throw new ArgumentNullException(nameof(pluginId));
            }
            PluginPackage pluginPackage = (from x in mPluginPackages where x.PluginId == pluginId select x).SingleOrDefault();

            pluginPackage.PluginPackageOperations = new PluginPackageOperations(pluginPackage);
            Console.WriteLine("Loading Plugin Services from JSON...");

            // TODO: only once !!!!!!!!!!!!!!!!!!!!!!!!! temp
            pluginPackage.PluginPackageOperations.LoadServicesFromJSON();

            if (pluginPackage == null)
            {
                throw new Exception("PluginPackage not found in solution PluginId=" + pluginId);
            }
            if (string.IsNullOrEmpty(pluginPackage.PluginPackageOperations.StartupDLL))
            {
                throw new Exception("StartupDLL is missing in the Ginger.PluginPackage.json for: " + pluginId);
            }

            string dll = Path.Combine(pluginPackage.Folder, pluginPackage.PluginPackageOperations.StartupDLL);

            Console.WriteLine("Plug-in dll path: " + dll);
            string nodeFileName = CreateNodeConfigFile(pluginId, serviceID);

            Console.WriteLine("nodeFileName: " + nodeFileName);

            string cmd = "\"" + dll + "\" \"" + nodeFileName + "\"";

            Console.WriteLine("Creating Process..");

            System.Diagnostics.Process proc = WorkSpace.Instance.OSHelper.Dotnet(cmd);

            mProcesses.Add(new PluginProcessWrapper(pluginId, serviceID, proc));
            Console.WriteLine("Plug-in Running on the Process ID: " + proc.Id);
            return(proc);
            //TODO: delete the temp file - or create temp files tracker with auto delete
        }
Exemplo n.º 16
0
        // We search the plug in for all files it can edit if this plugin implemented capability of text editor
        //        public List<PlugInTextFileEditorBase> TextEditors()
        //        {
        //            List<PlugInTextFileEditorBase> list = new List<PlugInTextFileEditorBase>();
        //            //TODO:: Need to be handled once PACT implementation is done
        //            //foreach (PlugInCapability c in PlugIn.Capabilities())
        //            //{
        //            //    if (c is PlugInTextFileEditorBase)
        //            //    {
        //            //        list.Add((PlugInTextFileEditorBase)c);
        //            //    }
        //            //}
        //            return list;
        //        }

        //        public List<string> GetExtentionsByEditorID(string plugInEditorID)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB.Extensions;
        //                }
        //            }
        //            return null;
        //        }

        //        public PlugInTextFileEditorBase GetPlugInTextFileEditorBaseByEditorID(string plugInEditorID)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB;
        //                }
        //            }
        //            return null;
        //        }

        //        public string GetTemplateContentByEditorID(string plugInEditorID, string plugInExtension)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB.GetTemplatesByExtensions("." + plugInExtension);
        //                }
        //            }
        //            return null;
        //        }


        public System.Diagnostics.Process StartService(string pluginId, string serviceID)
        {
            if (string.IsNullOrEmpty(pluginId))
            {
                throw new ArgumentNullException(nameof(pluginId));
            }
            PluginPackage pluginPackage = (from x in mPluginPackages where x.PluginId == pluginId select x).SingleOrDefault();

            // TODO: only once !!!!!!!!!!!!!!!!!!!!!!!!! temp
            pluginPackage.LoadServicesFromJSON();


            if (pluginPackage == null)
            {
                throw new Exception("PluginPackage not found in solution PluginId=" + pluginId);
            }
            if (string.IsNullOrEmpty(pluginPackage.StartupDLL))
            {
                throw new Exception("StartupDLL is missing in the Ginger.PluginPackage.json for: " + pluginId);
            }

            string dll = Path.Combine(pluginPackage.Folder, pluginPackage.StartupDLL);

            string nodeFileName = NodeConfigFile.CreateNodeConfigFile(pluginId + "1", serviceID);  // TODO: check if 1 exist then try 2,3 in case more than one same id service start
            string cmd          = "dotnet \"" + dll + "\" \"" + nodeFileName + "\"";

            System.Diagnostics.ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + cmd);
            procStartInfo.UseShellExecute = true;

            // TODO: Make it config not to show the console window
            // procStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = procStartInfo;
            proc.Start();
            mProcesses.Add(new PluginProcessWrapper(pluginId, serviceID, proc));
            return(proc);
            //TODO: delete the temp file - or create temp files tracker with auto delete
        }
Exemplo n.º 17
0
        // We search the plug in for all files it can edit if this plugin implemented capability of text editor
        //        public List<PlugInTextFileEditorBase> TextEditors()
        //        {
        //            List<PlugInTextFileEditorBase> list = new List<PlugInTextFileEditorBase>();
        //            //TODO:: Need to be handled once PACT implementation is done
        //            //foreach (PlugInCapability c in PlugIn.Capabilities())
        //            //{
        //            //    if (c is PlugInTextFileEditorBase)
        //            //    {
        //            //        list.Add((PlugInTextFileEditorBase)c);
        //            //    }
        //            //}
        //            return list;
        //        }

        //        public List<string> GetExtentionsByEditorID(string plugInEditorID)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB.Extensions;
        //                }
        //            }
        //            return null;
        //        }

        //        public PlugInTextFileEditorBase GetPlugInTextFileEditorBaseByEditorID(string plugInEditorID)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB;
        //                }
        //            }
        //            return null;
        //        }

        //        public string GetTemplateContentByEditorID(string plugInEditorID, string plugInExtension)
        //        {
        //            foreach (PlugInTextFileEditorBase PITFEB in TextEditors())
        //            {
        //                if (PITFEB.EditorID == plugInEditorID)
        //                {
        //                    return PITFEB.GetTemplatesByExtensions("." + plugInExtension);
        //                }
        //            }
        //            return null;
        //        }


        public System.Diagnostics.Process StartService(string pluginId, string serviceID)
        {
            Console.WriteLine("Staring Service...");
            if (string.IsNullOrEmpty(pluginId))
            {
                throw new ArgumentNullException(nameof(pluginId));
            }
            PluginPackage pluginPackage = (from x in mPluginPackages where x.PluginId == pluginId select x).SingleOrDefault();

            Console.WriteLine("Loading Plugin Services from JSON...");
            // TODO: only once !!!!!!!!!!!!!!!!!!!!!!!!! temp
            pluginPackage.LoadServicesFromJSON();

            if (pluginPackage == null)
            {
                throw new Exception("PluginPackage not found in solution PluginId=" + pluginId);
            }
            if (string.IsNullOrEmpty(pluginPackage.StartupDLL))
            {
                throw new Exception("StartupDLL is missing in the Ginger.PluginPackage.json for: " + pluginId);
            }

            string dll = Path.Combine(pluginPackage.Folder, pluginPackage.StartupDLL);

            string nodeFileName = CreateNodeConfigFile(pluginId, serviceID);
            string cmd          = "dotnet \"" + dll + "\" \"" + nodeFileName + "\"";

            Console.WriteLine("Creating Process..");

            // TODO: move to GingerUtils to start a process !!!!!!!!!!!!!!!!
            System.Diagnostics.ProcessStartInfo procStartInfo = null;

            if (GingerUtils.OperatingSystem.IsWindows())
            {
                procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c " + cmd);
                procStartInfo.UseShellExecute = true;
            }
            else if (GingerUtils.OperatingSystem.IsLinux())
            {
                cmd = "-c \"gnome-terminal -x bash -ic 'cd $HOME; dotnet " + dll + " " + nodeFileName + "'\"";
                Console.WriteLine("Command: " + cmd);
                procStartInfo = new System.Diagnostics.ProcessStartInfo("/bin/bash", " " + cmd + " ");
                procStartInfo.UseShellExecute        = false;
                procStartInfo.CreateNoWindow         = false;
                procStartInfo.RedirectStandardOutput = true;
            }

            // TODO: Make it config not to show the console window
            // procStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = procStartInfo;

            Console.WriteLine("Staring Process..");
            proc.Start();

            mProcesses.Add(new PluginProcessWrapper(pluginId, serviceID, proc));
            Console.WriteLine("Plugin Running on the Process ID:" + proc.Id);
            return(proc);
            //TODO: delete the temp file - or create temp files tracker with auto delete
        }
 public PluginPackageOperations(PluginPackage pluginPackage)
 {
     PluginPackage = pluginPackage;
     PluginPackage.PluginPackageOperations = this;
 }
Exemplo n.º 19
0
        public void UninstallPluginPackage(OnlinePluginPackage pluginPackageInfo)
        {
            PluginPackage pluginPackage = (from x in mPluginPackages where x.PluginId == pluginPackageInfo.Id select x).FirstOrDefault();

            WorkSpace.Instance.SolutionRepository.DeleteRepositoryItem(pluginPackage);
        }