本文整理汇总了C#中System.Management.Automation.ProviderInfo类的典型用法代码示例。如果您正苦于以下问题:C# ProviderInfo类的具体用法?C# ProviderInfo怎么用?C# ProviderInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProviderInfo类属于System.Management.Automation命名空间,在下文中一共展示了ProviderInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PSDriveInfo
public PSDriveInfo(string name, ProviderInfo provider, string root, string description, PSCredential credential)
{
this.credentials = PSCredential.Empty;
if (name == null)
{
throw PSTraceSource.NewArgumentNullException("name");
}
if (provider == null)
{
throw PSTraceSource.NewArgumentNullException("provider");
}
if (root == null)
{
throw PSTraceSource.NewArgumentNullException("root");
}
this.name = name;
this.provider = provider;
this.root = root;
this.description = description;
if (credential != null)
{
this.credentials = credential;
}
this.currentWorkingDirectory = string.Empty;
this.Trace();
}
示例2: Start
/// <summary>
/// Starts the specified provider. This method is called by the Windows PowerShell runtime to initialize the
/// provider when the provider is loaded into a session.
/// </summary>
/// <param name="providerInfo">
/// A <see cref="ProviderInfo"/> object that describes the provider to be initialized.
/// </param>
/// <returns>A <see cref="ProviderInfo"/> object that contains information about the provider.</returns>
protected override ProviderInfo Start(ProviderInfo providerInfo)
{
// Increase console window size
this.IncreaseWindowSize(120, 50);
return base.Start(providerInfo);
}
示例3: ValidateDirectory
public static void ValidateDirectory(ProviderInfo provider, string directory)
{
validateFileSystemPath(provider, directory);
if (!Directory.Exists(directory))
{
Exception exception;
if (File.Exists(directory))
{
exception = new InvalidOperationException($"{directory} is not a directory.");
ExceptionHelper.SetUpException(
ref exception,
ERR_NO_DIRECTORY,
ErrorCategory.InvalidOperation,
directory);
}
else
{
exception =
new FileNotFoundException(
$"The directory {directory} could not be found.");
ExceptionHelper.SetUpException(
ref exception,
ERR_NO_DIRECTORY,
ErrorCategory.InvalidData,
directory);
}
throw exception;
}
}
示例4: PathInfo
internal PathInfo(PSDriveInfo drive, ProviderInfo provider, Path path, SessionState sessionState)
{
Drive = drive;
Provider = provider;
_path = path;
_sessionState = sessionState;
}
示例5: UniversalProviderInfo
protected UniversalProviderInfo(ProviderInfo providerInfo) : base(providerInfo) {
try {
PropertySheet = PropertySheet.Parse(@"@import ""pstab.properties"";", "default");
} catch (Exception) {
PropertySheet = new PropertySheet();
}
}
示例6: PSDriveInfo
public PSDriveInfo(string name, ProviderInfo provider, string root, string description, PSCredential credential)
{
Name = name;
Provider = provider;
Root = root;
Description = description;
Credential = credential;
CurrentLocation = string.Empty;
}
示例7: AzureDriveInfo
public AzureDriveInfo(Rule aliasRule, ProviderInfo providerInfo, PSCredential psCredential = null)
: base(GetDriveInfo(aliasRule, providerInfo, psCredential))
{
Path = new Path {
Account = aliasRule.HasProperty("key") ? aliasRule["key"].Value : aliasRule.Parameter,
Container = aliasRule.HasProperty("container") ? aliasRule["container"].Value : "",
SubPath = aliasRule.HasProperty("root") ? aliasRule["root"].Value.Replace('/', '\\').Replace("\\\\", "\\").Trim('\\') : "",
};
Path.Validate();
Secret = aliasRule.HasProperty("secret") ? aliasRule["secret"].Value : psCredential != null ? psCredential.Password.ToString() : null;
}
示例8: ProviderInfo
protected ProviderInfo(ProviderInfo providerInfo)
{
_sessionState = providerInfo._sessionState;
PSSnapIn = providerInfo.PSSnapIn;
Name = providerInfo.Name;
Description = providerInfo.Description;
Home = providerInfo.Home;
ImplementingType = providerInfo.ImplementingType;
Capabilities = providerInfo.Capabilities;
HelpFile = providerInfo.HelpFile;
}
示例9: GetProviderAssemblyPath
private static string GetProviderAssemblyPath(ProviderInfo providerInfo)
{
if (providerInfo == null)
{
return null;
}
if (providerInfo.ImplementingType == null)
{
return null;
}
return Path.GetDirectoryName(providerInfo.ImplementingType.Assembly.Location);
}
示例10: GetLocationResolver
public static ILocationResolver GetLocationResolver(ProviderInfo providerInfo) {
var result = providerInfo as ILocationResolver;
if (result == null) {
if (providerInfo.Name == "FileSystem") {
return new FilesystemLocationProvider(providerInfo);
}
}
if (result == null) {
throw new ClrPlusException("Unable to create location resolver for {0}".format(providerInfo.Name));
}
return result;
}
示例11: base
internal DirectoryServiceDriveInfo
(
String name,
ProviderInfo provider,
String description,
PSCredential credential,
DirectoryRootInfo rootInfo
)
: base(name, provider, name + ':', description, credential)
{
_rootInfo = rootInfo;
}
示例12: validateFileSystemPath
private static void validateFileSystemPath(ProviderInfo provider, string directory)
{
if (!isFileSystemPath(provider))
{
Exception exception = new ArgumentException("The syntax of the command is incorrect.");
ExceptionHelper.SetUpException(
ref exception,
ERR_BAD_PROVIDER,
ErrorCategory.InvalidArgument,
directory);
throw exception;
}
}
示例13: Start
protected override ProviderInfo Start(ProviderInfo sitecoreProviderInfo)
{
try
{
sitecoreProviderInfo.Description = "Sitcore Content Provider";
providerInfo = sitecoreProviderInfo;
LogInfo("Executing Start(string providerInfo='{0}')", sitecoreProviderInfo.Name);
return sitecoreProviderInfo;
}
catch (Exception ex)
{
LogError(ex, "Error while executing Start(string providerInfo='{0}')", sitecoreProviderInfo.Name);
throw;
}
}
示例14: ProviderInfo
protected ProviderInfo(ProviderInfo providerInfo)
{
this.helpFile = "";
if (providerInfo == null)
{
throw PSTraceSource.NewArgumentNullException("providerInfo");
}
this.name = providerInfo.Name;
this.implementingType = providerInfo.ImplementingType;
this.capabilities = providerInfo.capabilities;
this.description = providerInfo.description;
this.hiddenDrive = providerInfo.hiddenDrive;
this.home = providerInfo.home;
this.helpFile = providerInfo.helpFile;
this.pssnapin = providerInfo.pssnapin;
this.sessionState = providerInfo.sessionState;
}
示例15: PathInfo
internal PathInfo(PSDriveInfo drive, ProviderInfo provider, string path, SessionState sessionState)
{
if (provider == null)
{
throw PSTraceSource.NewArgumentNullException("provider");
}
if (path == null)
{
throw PSTraceSource.NewArgumentNullException("path");
}
if (sessionState == null)
{
throw PSTraceSource.NewArgumentNullException("sessionState");
}
this.drive = drive;
this.provider = provider;
this.path = path;
this.sessionState = sessionState;
}