Beispiel #1
0
        internal AutomationEngine(PSHost hostInterface, RunspaceConfiguration runspaceConfiguration, InitialSessionState iss)
        {
            string str  = Environment.GetEnvironmentVariable("PathEXT") ?? string.Empty;
            bool   flag = false;

            if (str != string.Empty)
            {
                foreach (string str2 in str.Split(new char[] { ';' }))
                {
                    if (str2.Trim().Equals(".CPL", StringComparison.OrdinalIgnoreCase))
                    {
                        flag = true;
                        break;
                    }
                }
            }
            if (!flag)
            {
                str = (str == string.Empty) ? ".CPL" : (str.EndsWith(";", StringComparison.OrdinalIgnoreCase) ? (str + ".CPL") : (str + ";.CPL"));
                Environment.SetEnvironmentVariable("PathEXT", str);
            }
            if (runspaceConfiguration != null)
            {
                this._context = new ExecutionContext(this, hostInterface, runspaceConfiguration);
            }
            else
            {
                this._context = new ExecutionContext(this, hostInterface, iss);
            }
            this.EngineNewParser  = new Parser();
            this.commandDiscovery = new System.Management.Automation.CommandDiscovery(this._context);
            if (runspaceConfiguration != null)
            {
                runspaceConfiguration.Bind(this._context);
            }
            else
            {
                iss.Bind(this._context, false);
            }
            InitialSessionState.SetSessionStateDrive(this._context, true);
            InitialSessionState.CreateQuestionVariable(this._context);
        }
Beispiel #2
0
 internal AutomationEngine(PSHost hostInterface, RunspaceConfiguration runspaceConfiguration, InitialSessionState iss)
 {
     string str = Environment.GetEnvironmentVariable("PathEXT") ?? string.Empty;
     bool flag = false;
     if (str != string.Empty)
     {
         foreach (string str2 in str.Split(new char[] { ';' }))
         {
             if (str2.Trim().Equals(".CPL", StringComparison.OrdinalIgnoreCase))
             {
                 flag = true;
                 break;
             }
         }
     }
     if (!flag)
     {
         str = (str == string.Empty) ? ".CPL" : (str.EndsWith(";", StringComparison.OrdinalIgnoreCase) ? (str + ".CPL") : (str + ";.CPL"));
         Environment.SetEnvironmentVariable("PathEXT", str);
     }
     if (runspaceConfiguration != null)
     {
         this._context = new ExecutionContext(this, hostInterface, runspaceConfiguration);
     }
     else
     {
         this._context = new ExecutionContext(this, hostInterface, iss);
     }
     this.EngineNewParser = new Parser();
     this.commandDiscovery = new System.Management.Automation.CommandDiscovery(this._context);
     if (runspaceConfiguration != null)
     {
         runspaceConfiguration.Bind(this._context);
     }
     else
     {
         iss.Bind(this._context, false);
     }
     InitialSessionState.SetSessionStateDrive(this._context, true);
     InitialSessionState.CreateQuestionVariable(this._context);
 }