Team Ai
Datasetpublic

MegaBites-AI/Windows-powershell

sourceHugging Facemitupdated 6mo agoView on Hugging Face
0likes372downloads
DefaultHost.cs136 linesDownload Raw Back to hostifaces
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4using System;5using System.Globalization;6using System.Management.Automation;7using System.Management.Automation.Host;8 9using Dbg = System.Diagnostics;10 11namespace Microsoft.PowerShell12{13    /// <summary>14    /// This is the default host implementing PSHost offering minimal host capabilities.15    /// Runspace is the primary user of this class.16    /// </summary>17    internal class DefaultHost : PSHost18    {19        #region ctor20 21        /// <summary>22        /// Creates an instance based on the current culture and current UI culture.23        /// </summary>24        /// <param name="currentCulture">Current culture for this host.</param>25        /// <param name="currentUICulture">Current UI culture for this host.</param>26        /// <exception/>27        internal DefaultHost(CultureInfo currentCulture, CultureInfo currentUICulture)28        {29            CurrentCulture = currentCulture;30            CurrentUICulture = currentUICulture;31        }32 33        #endregion ctor34 35        #region properties36 37        /// <summary>See base class</summary>38        public override string Name { get { return "Default Host"; } }39 40        /// <summary>See base class</summary>41        public override Version Version { get; } = PSVersionInfo.PSVersion;42 43        /// <summary>See base class</summary>44        public override Guid InstanceId { get; } = Guid.NewGuid();45 46        /// <summary>47        /// See base class48        /// This property is not supported.49        /// </summary>50        public override PSHostUserInterface UI { get { return null; } }51 52        /// <summary>53        /// See base class.54        /// </summary>55        public override CultureInfo CurrentCulture { get; } = null;56 57        /// <summary>58        /// See base class.59        /// </summary>60        public override CultureInfo CurrentUICulture { get; } = null;61 62        #endregion properties63 64        #region methods65 66        /// <summary>67        /// See base class.68        /// </summary>69        /// <value></value>70        /// <exception/>71        public override72        void73        SetShouldExit(int exitCode)74        {75            // No op76        }77 78        /// <summary>79        /// See base class.80        /// </summary>81        /// <value></value>82        /// <exception cref="NotSupportedException">83        /// On calling this method84        /// </exception>85        public override86        void87        EnterNestedPrompt()88        {89            throw PSTraceSource.NewNotSupportedException();90        }91 92        /// <summary>93        /// See base class.94        /// </summary>95        /// <value></value>96        /// <exception cref="NotSupportedException">97        /// On calling this method98        /// </exception>99        public override100        void101        ExitNestedPrompt()102        {103            throw PSTraceSource.NewNotSupportedException();104        }105 106        /// <summary>107        /// See base class.108        /// </summary>109        /// <value></value>110        /// <exception/>111        public override112        void113        NotifyBeginApplication()114        {115            // No op116        }117 118        /// <summary>119        /// See base class.120        /// </summary>121        /// <value></value>122        /// <exception/>123        public override124        void125        NotifyEndApplication()126        {127            // No op128        }129        #endregion methods130 131        #region private fields132 133        #endregion private fields134    }135}136