externalLibs/Carbon/Carbon/Carbon.types.ps1xml

<?xml version="1.0" encoding="utf-8"?>
<!--
   Copyright 2012 Aaron Jensen
    
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
    
       http://www.apache.org/licenses/LICENSE-2.0
    
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
-->
<Types>
    <Type>
        <Name>System.Diagnostics.Process</Name>
        <Members>
            <ScriptProperty>
                <Name>ParentProcessID</Name>
                <GetScriptBlock>
                    $filter = "ProcessID='{0}'" -f $this.Id
                    $process = Get-WmiObject Win32_Process -Filter $filter
                    $process.ParentProcessID
                </GetScriptBlock>
            </ScriptProperty>
        </Members>
    </Type>
    <Type>
        <Name>System.ServiceProcess.ServiceController</Name>
        <Members>
            <ScriptProperty>
                <Name>StartMode</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig();
                    [System.ServiceProcess.ServiceStartMode][int]$this.Configuration.StartType
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>UserName</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.UserName
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptMethod>
                <Name>LoadServiceConfig</Name>
                <Script>
                    if( -not ($this | Get-Member -Name 'Configuration') )
                    {
                        $value = New-Object 'Carbon.Service.ServiceInfo' $this.Name
                        Add-Member -InputObject $this -MemberType NoteProperty -Name 'Configuration' -Value $value
                    }
                </Script>
            </ScriptMethod>
            <ScriptProperty>
                <Name>FailureProgram</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.FailureProgram
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>Description</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.Description
                </GetScriptBlock>
                </ScriptProperty>
            <ScriptProperty>
                <Name>FirstFailure</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.FirstFailure
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>SecondFailure</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.SecondFailure
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>ThirdFailure</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.ThirdFailure
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>Path</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.Path
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>RebootDelay</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.RebootDelay
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>RebootDelayMinutes</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.RebootDelayMinutes
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>RebootMessage</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.RebootMessage
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>ResetPeriod</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.ResetPeriod
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>ResetPeriodDays</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.ResetPeriodDays
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>RestartDelay</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.RestartDelay
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>RestartDelayMinutes</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.RestartDelayMinutes
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>RunCommandDelay</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.RunCommandDelay
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>RunCommandDelayMinutes</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.RunCommandDelayMinutes
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>ErrorControl</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.ErrorControl
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>LoadOrderGroup</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.LoadOrderGroup
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>TagID</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.TagID
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>StartType</Name>
                <GetScriptBlock>
                    $this.LoadServiceConfig()
                    $this.Configuration.StartType
                </GetScriptBlock>
            </ScriptProperty>
        </Members>
    </Type>
    <Type>
        <Name>System.IO.DirectoryInfo</Name>
        <Members>
            <ScriptProperty>
                <Name>IsJunction</Name>
                <GetScriptBlock>
                    (($this.Attributes -band [IO.FileAttributes]::ReparsePoint) -eq [IO.FileAttributes]::ReparsePoint)
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>TargetPath</Name>
                <GetScriptBlock>
                    if( -not $this.IsJunction )
                    {
                        return
                    }
                     
                    [Carbon.IO.JunctionPoint]::GetTarget( $this.FullName )
                </GetScriptBlock>
            </ScriptProperty>
        </Members>
    </Type>
    <Type>
        <Name>System.Security.Cryptography.X509Certificates.X509Certificate2</Name>
        <Members>
            <ScriptProperty>
                <Name>IssuedTo</Name>
                <GetScriptBlock>
                    $this.GetNameInfo( 'SimpleName', $false )
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>IssuedBy</Name>
                <GetScriptBlock>
                    $this.GetNameInfo( 'SimpleName', $true )
                </GetScriptBlock>
            </ScriptProperty>
        </Members>
    </Type>
    <Type>
        <Name>System.Security.Cryptography.X509Certificates.X509Store</Name>
        <Members>
            <ScriptProperty>
                <Name>DisplayName</Name>
                <GetScriptBlock>
                    switch( $this.Name )
                    {
                        'AddressBook' { return 'Other People' }
                        'AuthRoot' { return 'Third-Party Root Certification Authorities' }
                        'CA' { return 'Intermediate Certification Authorities' }
                        'CertificateAuthority' { return 'Intermediate Certification Authorities' }
                        'Disallowed' { return 'Untrusted Certificates' }
                        'My' { return 'Personal' }
                        'Root' { return 'Trusted Root Certification Authorities' }
                        'TrustedPeople' { return 'Trusted People' }
                        'TrustedPublisher' { return 'Trusted Publishers' }
                        default { return '' }
                    }
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>StoreName</Name>
                <GetScriptBlock>
                    if( $this.Name -eq 'CA' )
                    {
                        return [Security.Cryptography.X509Certificates.StoreName]::CertificateAuthority
                    }
 
                    foreach( $value in ([Enum]::GetValues([Security.Cryptography.X509Certificates.StoreName])) )
                    {
                        if( $this.Name -eq $value.ToString() )
                        {
                            return $value
                        }
                    }
 
                    return ''
                </GetScriptBlock>
            </ScriptProperty>
        </Members>
    </Type>
    <Type>
        <Name>Carbon.Firewall.Rule</Name>
        <Members>
            <AliasProperty>
                <Name>LocalIP</Name>
                <ReferencedMemberName>
                    LocalIPAddress
                </ReferencedMemberName>
            </AliasProperty>
            <AliasProperty>
                <Name>RemoteIP</Name>
                <ReferencedMemberName>
                    RemoteIPAddress
                </ReferencedMemberName>
            </AliasProperty>
        </Members>
    </Type>
    <Type>
        <Name>Carbon.TaskScheduler.TaskInfo</Name>
        <Members>
            <AliasProperty>
                <Name>State</Name>
                <ReferencedMemberName>Status</ReferencedMemberName>
            </AliasProperty>
            <ScriptProperty>
                <Name>FullName</Name>
                <GetScriptBlock>
                    return Join-Path -Path $this.TaskPath -ChildPath $this.TaskName
                </GetScriptBlock>
            </ScriptProperty>
        </Members>
    </Type>
</Types>