protected override void OnExecute() { if (this.List == true) { this.CommandContext.Out.Write(this.ScriptContext.GenerateDeclaration(ScriptContextBase.GetArgumentTypes(this.Arguments))); } else { var oldPath = Directory.GetCurrentDirectory(); try { DirectoryUtility.Prepare(this.CommandContext.BaseDirectory); Directory.SetCurrentDirectory(this.CommandContext.BaseDirectory); if (this.Filename != string.Empty) { this.Scripts = File.ReadAllText(this.Filename); } var authentication = this.CommandContext.GetAuthenticationInternal(this); if (this.IsAsync == false) { this.ScriptContext.RunInternal(this.Scripts, authentication); } else { this.ScriptContext.RunAsyncInternal(this.Scripts, authentication); } } finally { Directory.SetCurrentDirectory(oldPath); } } }
protected override void OnExecute() { if (this.List == true) { this.Out.Write(this.ScriptContext.GenerateDeclaration(ScriptContextBase.GetArgumentTypes(this.Arguments))); } else { if (this.Filename != string.Empty) { this.Scripts = File.ReadAllText(this.Filename); } var authentication = this.CommandContext.GetAuthenticationInternal(this); if (this.IsAsync == false) { this.ScriptContext.RunInternal(this.Scripts, authentication, this.GetProperties()); } else { this.ScriptContext.RunAsyncInternal(this.Scripts, authentication, this.GetProperties()); } } }