TypeData/PSAlphaFS.Types.ps1xml

<?xml version="1.0" ?>
<Types>
    <Type>
        <Name>Alphaleonis.Win32.Filesystem.FileInfo</Name>
        <Members>
            <ScriptProperty>
                <Name>Mode</Name>
                <GetScriptBlock> if ( $this.EntryInfo.IsDirectory ) { if ( $this.EntryInfo.IsSymbolicLink ){ return 'SymLink-d' } Else { return 'Directory' } } Else { if ( $this.EntryInfo.IsSymbolicLink ) { return 'SymLink-f' } Else { return 'File' } } </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>PSIsContainer</Name>
                <GetScriptBlock> $this.EntryInfo.IsDirectory </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>LinkType</Name>
                <GetScriptBlock> $s = $this.EntryInfo.ReparsePointTag ; switch($s){'Symlink' {return 'SymbolicLink';break};default {return $s}} </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>BaseName</Name>
                <GetScriptBlock> [Alphaleonis.Win32.Filesystem.Path]::GetFileNameWithoutExtension($this.Name) </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>PathLength</Name>
                <GetScriptBlock> $this.FullName.Length </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>IsLongPath</Name>
                <GetScriptBlock> $this.EntryInfo.IsLongPath </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>IsSymbolicLink</Name>
                <GetScriptBlock> $this.EntryInfo.IsSymbolicLink </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>IsDirectory</Name>
                <GetScriptBlock> $this.EntryInfo.IsDirectory </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>IsCompressed</Name>
                <GetScriptBlock> $this.EntryInfo.IsCompressed </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>IsHidden</Name>
                <GetScriptBlock> $this.EntryInfo.IsHidden </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>IsEncrypted</Name>
                <GetScriptBlock> $this.EntryInfo.IsEncrypted </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>IsMountPoint</Name>
                <GetScriptBlock> $this.EntryInfo.IsMountPoint </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>IsOffline</Name>
                <GetScriptBlock> $this.EntryInfo.IsOffline </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>FileHash</Name>
                <GetScriptBlock>
                    if(-not ($this.EntryInfo.IsDirectory))
                    {
                        return ($this.GetHash([Alphaleonis.Win32.Security.HashType]::SHA256))
                    }
                </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>Target</Name>
                <GetScriptBlock>
                    if($this.EntryInfo.IsSymbolicLink)
                    {
                        return (([Alphaleonis.Win32.Filesystem.File]::GetLinkTargetInfo($this.FullName, [Alphaleonis.Win32.Filesystem.PathFormat]::FullPath)).PrintName)
                    }
                </GetScriptBlock>
            </ScriptProperty>
            <MemberSet>
                <Name>PSStandardMembers</Name>
                <Members>
                    <PropertySet>
                        <Name>DefaultDisplayPropertySet</Name>
                        <ReferencedProperties>
                            <Name>Mode</Name>
                            <Name>LastWriteTime</Name>
                            <Name>Length</Name>
                            <Name>Name</Name>
                        </ReferencedProperties>
                    </PropertySet>
                </Members>
            </MemberSet>
        </Members>
    </Type>
    <Type>
        <Name>Alphaleonis.Win32.Filesystem.DriveInfo</Name>
        <Members>
            <AliasProperty>
                <Name>DriveLetter</Name>
                <ReferencedMemberName> Name </ReferencedMemberName>
            </AliasProperty>
            <AliasProperty>
                <Name>FileSystem</Name>
                <ReferencedMemberName> DriveFormat </ReferencedMemberName>
            </AliasProperty>
            <ScriptProperty>
                <Name>FreePercent</Name>
                <GetScriptBlock> return ($this.DiskSpaceInfo.AvailableFreeSpacePercent) </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>UsedPercent</Name>
                <GetScriptBlock> return ($this.DiskSpaceInfo.UsedSpacePercent) </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>Free</Name>
                <GetScriptBlock> return ($this.DiskSpaceInfo.AvailableFreeSpaceUnitSize) </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>Used</Name>
                <GetScriptBlock> return ($this.DiskSpaceInfo.UsedSpaceUnitSize) </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>Size</Name>
                <GetScriptBlock> return ($this.DiskSpaceInfo.TotalSizeUnitSize) </GetScriptBlock>
            </ScriptProperty>
            <ScriptProperty>
                <Name>UncPath</Name>
                <GetScriptBlock>
                if($this.DriveType -eq 'Network')
                {
                    return ([Alphaleonis.Win32.Filesystem.Path]::LocalToUnc([Alphaleonis.Win32.Filesystem.Path]::RemoveTrailingDirectorySeparator($this.Name)))
                }
                </GetScriptBlock>
            </ScriptProperty>
            <MemberSet>
                <Name>Driveinfolistview</Name>
                <Members>
                    <PropertySet>
                        <Name>DefaultDisplayPropertySet</Name>
                        <ReferencedProperties>
                            <Name>DriveLetter</Name>
                            <Name>VolumeLabel</Name>
                            <Name>FileSystem</Name>
                            <Name>DriveType</Name>
                            <Name>FreePercent</Name>
                            <Name>UsedPercent</Name>
                            <Name>Free</Name>
                            <Name>Used</Name>
                            <Name>Size</Name>
                            <Name>UncPath</Name>
                        </ReferencedProperties>
                    </PropertySet>
                </Members>
            </MemberSet>
        </Members>
    </Type>
</Types>