Exemple #1
0
        protected override void ProcessRecord()
        {
            if (Reset)
            {
                // wipes all the current listeners out first, before loading the config file
                RestService.ResetService();
            }

            if (Auto)
            {
                Config = "restservice.properties";
            }

            if (!string.IsNullOrEmpty(Config))
            {
                RestService.ConfigFile = Config;
            }

            // add on any at the prompt.
            if (!ListenOn.IsNullOrEmpty())
            {
                RestService.AddListeners(ListenOn);
            }


            IEnumerable <string> activeModules;

            using (var ps = Runspace.DefaultRunspace.Dynamic()) {
                IEnumerable <object> modules = ps.GetModule();
                activeModules = modules.Select(each => each as PSModuleInfo).Where(each => each != null).Select(each => each.Path).ToArray();
            }

            RestService.StartService(activeModules);
        }
        protected override void ProcessRecord()
        {
            if (Auto)
            {
                Config = "restservice.properties";
            }

            if (!string.IsNullOrEmpty(Config))
            {
                RestService.ConfigFile = Config;

                if (!ListenOn.IsNullOrEmpty())
                {
                    RestService.AddListeners(ListenOn);
                }
            }
            else
            {
                RestService.AddListeners(ListenOn);
            }
        }