CDSoftware/Cdpss.ps1
function Get-CdpssUris { <# .SYNOPSIS �� $env:Cdpss\Settings\Uris.txt �У���ȡ Uri �ļ�ֵ�Ե� HashTable�� .DESCRIPTION �� $env:Cdpss\Settings\Uris.txt �У���ȡ Uri �ļ�ֵ�Ե� HashTable�� .OUTPUTS HashTable #> [CmdletBinding()] PARAM( ) PROCESS { if ($null -eq $env:Cdpss) { throw "��δ���� Cdpss �������������ȴ�����" } $lines = Get-Content "$env:Cdpss\Settings\Uris.txt" -Encoding UTF8 $ret = @{} foreach ($line in $lines) { $parts = $line.Split() $value = $parts[-1] for ($i = 0; $i -lt $parts.Length - 1; $i += 1) { $ret[$parts[$i]] = $value } } return $ret } } function Get-CdpssUri { <# .SYNOPSIS �� $env:Cdpss\Settings\Uris.txt �У���ȡ Uri �ļ�ֵ�Ե� HashTable�� .DESCRIPTION �� $env:Cdpss\Settings\Uris.txt �У���ȡ Uri �ļ�ֵ�Ե� HashTable�� .OUTPUTS HashTable����Ϊ����ļ���ֵΪ��Ӧ�� Uri �� $null���������ڶ�Ӧ�ļ�ʱ���� #> [CmdletBinding()] PARAM( [String[]] $Keys ) PROCESS { $dic = Get-CdpssUris $ret = @{} foreach ($key in $Keys) { $ret[$key] = $dic[$key] } return $ret } } |