Inheritance: System.Configuration.ConfigurationElement
Ejemplo n.º 1
0
 public void Remove(ScriptConfigElement script)
 {
     if (BaseIndexOf(script) >= 0)
     {
         BaseRemove(script.Name);
     }
 }
        public void ExecuteScript(ScriptConfigElement e)
        {
            using (_instance = PowerShell.Create())
            {
                _instance.AddScript(File.ReadAllText(e.PathToScript));

                PSDataCollection<PSObject> outputCollection = new PSDataCollection<PSObject>();
                outputCollection.DataAdded += outputCollection_DataAdded;
                _instance.Streams.Progress.DataAdded += Progress_DataAdded;
                _instance.Streams.Error.DataAdded += Error_DataAdded;
                _instance.Streams.Verbose.DataAdded += Verbose_DataAdded;
                _instance.Streams.Debug.DataAdded += Debug_DataAdded;
                _instance.Streams.Warning.DataAdded += Warning_DataAdded;

                IAsyncResult result = _instance.BeginInvoke<PSObject, PSObject>(null,
                    outputCollection);

                while (result.IsCompleted == false)
                {
                    Thread.Sleep(500);
                }

                foreach (PSObject o in outputCollection)
                {
                    Console.WriteLine(o.GetType());
                    Console.WriteLine(o);
                }
            }
        }
        public static ScriptStat InitScriptStat(ScriptConfigElement e)
        {
            ScriptStat ss;

            if (_stats.ContainsKey(e.PathToScript))
            {
                ss = _stats[e.PathToScript];
            }
            else
            {
                ss = new ScriptStat();
                ss.Script = e.PathToScript;
                ss.Type = e.Type;
            }

            return ss;
        }
Ejemplo n.º 4
0
        public ScriptsCollection()
        {
            ScriptConfigElement script = (ScriptConfigElement)CreateNewElement();

            Add(script);
        }
Ejemplo n.º 5
0
 public void Add(ScriptConfigElement script)
 {
     BaseAdd(script);
 }
Ejemplo n.º 6
0
 public int IndexOf(ScriptConfigElement script)
 {
     return(BaseIndexOf(script));
 }
 public void Remove(ScriptConfigElement script)
 {
     if (BaseIndexOf(script) >= 0)
         BaseRemove(script.Name);
 }
 public void Add(ScriptConfigElement script)
 {
     BaseAdd(script);
 }
 public int IndexOf(ScriptConfigElement script)
 {
     return BaseIndexOf(script);
 }