/System/Library/CoreServices

本文档提供了 iPhone OS 2.2 的详细版本信息,包括产品构建版本号为 5G77,版权所有年份为 1983 至 2008 年,苹果公司所有。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>ProductBuildVersion</key>
 <string>5G77</string>
 <key>ProductCopyright</key>
 <string>1983-2008 Apple Inc.</string>
 <key>ProductName</key>
 <string>iPhone OS</string>
 <key>ProductVersion</key>
 <string>2.2</string>
</dict>
</plist>

PS C:\Users\Administrator> # 安全的模块路径检测 >> $moduleRoot = if ($PSScriptRoot) { >> $PSScriptRoot >> } elseif ($MyInvocation.MyCommand.Path) { >> Split-Path -Parent $MyInvocation.MyCommand.Path >> } else { >> $manifestPath = (Get-Module CurlTools -ListAvailable | Select-Object -First 1).Path >> if ($manifestPath) { >> Split-Path -Parent $manifestPath >> } else { >> throw "无法确定模块根目录" >> } >> } >> >> # 加载所有函数文件(先基础后功能) >> $privatePath = Join-Path $moduleRoot "Private" >> $publicPath = Join-Path $moduleRoot "Public" >> >> # 1. 加载核心基础函数(无依赖) >> . (Join-Path $privatePath "GetPlatform.ps1") >> . (Join-Path $privatePath "ValidateCurlPath.ps1") >> >> # 2. 加载其他私有函数 >> Get-ChildItem -Path "$privatePath/*.ps1" -Exclude "GetPlatform.ps1", "ValidateCurlPath.ps1" | ForEach-Object { >> . $_.FullName >> Write-Verbose "已加载私有函数: $($_.BaseName)" >> } >> >> # 3. 加载公共函数 >> Get-ChildItem -Path "$publicPath/*.ps1" | ForEach-Object { >> . $_.FullName >> Write-Verbose "已加载公共函数: $($_.BaseName)" >> } >> >> # 导出公共函数 >> Export-ModuleMember -Function @( >> 'Get-CurlPath' >> 'Set-CurlPath' >> 'Get-CurlVersion' >> 'Invoke-SecureDownload' >> ) >> >> # 执行模块初始化 >> $script:ModuleInitialized = $false >> Initialize-Module | Out-Null >> Export-ModuleMember : 只能从模块内调用 Export-ModuleMember cmdlet。 所在位置 行:36 字符: 1 + Export-ModuleMember -Function @( + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : PermissionDenied: (:) [Export-ModuleMember], InvalidOperationException + FullyQualifiedErrorId : Modules_CanOnlyExecuteExportModuleMemberInsideAModule,Microsoft.PowerShell.Commands.Expo rtModuleMemberCommand PS C:\Users\Administrator> # 确定模块安装路径 >> $moduleDir = if ($PSVersionTable.PSEdition -eq "Core") { >> Join-Path $HOME ".local/share/powershell/Modules/CurlTools" >> } else { >> Join-Path $env:ProgramFiles "WindowsPowerShell/Modules/CurlTools" >> } >> >> # 创建目录结构 >> $dirs = @( >> $moduleDir >> (Join-Path $moduleDir "Private") >> (Join-Path $moduleDir "Public") >> ) >> >> $dirs | ForEach-Object { >> if (-not (Test-Path $_)) { >> New-Item -ItemType Directory -Path $_ -Force | Out-Null >> } >> } >> >> # ===== 函数定义 ===== >> # 核心基础函数 >> $getPlatformContent = @' >> function Get-Platform { >> <# >> .SYNOPSIS >> 检测当前操作系统平台 >> #> >> if ($PSVersionTable.PSEdition -eq "Core") { >> if ($IsWindows) { "Windows" } >> elseif ($IsLinux) { "Linux" } >> elseif ($IsMacOS) { "macOS" } >> else { "Unknown" } >> } else { >> if ($env:OS -like "Windows*") { "Windows" } >> elseif (Test-Path "/etc/os-release") { "Linux" } >> elseif (Test-Path "/System/Library/CoreServices/SystemVersion.plist") { "macOS" } >> else { "Unknown" } >> } >> } >> '@ >> >> # 其他函数内容(在实际脚本中需要完整填充)... >> >> # ===== 保存所有文件 ===== >> $files = @{ >> # 模块主文件 >> "CurlTools.psm1" = @' >> # 上面重构的模块主文件内容 >> '@ >> >> # 私有函数 >> "Private/GetPlatform.ps1" = $getPlatformContent >> "Private/ValidateCurlPath.ps1" = $validateCurlPathContent >> "Private/FindCurlPath.ps1" = $findCurlPathContent >> "Private/InitializeModule.ps1" = $initializeModuleContent >> "Private/InstallCurl.ps1" = $installCurlContent >> >> # 公共函数 >> "Public/GetCurlPath.ps1" = $getCurlPathContent >> "Public/SetCurlPath.ps1" = $setCurlPathContent >> "Public/GetCurlVersion.ps1" = $getCurlVersionContent >> "Public/SecureDownload.ps1" = $secureDownloadContent >> >> # 模块清单 >> "CurlTools.psd1" = @' >> @{ >> ModuleVersion = '4.0.0' >> GUID = 'c0d1b1e1-1a2b-4c3d-8e4f-9a0b1c2d3e4f' >> Author = 'PowerShell Expert' >> Description = 'Robust curl tools for PowerShell' >> RootModule = 'CurlTools.psm1' >> PowerShellVersion = '5.1' >> CompatiblePSEditions = @('Desktop', 'Core') >> FunctionsToExport = @( >> 'Get-CurlPath', >> 'Set-CurlPath', >> 'Get-CurlVersion', >> 'Invoke-SecureDownload' >> ) >> RequiredModules = @() >> } >> '@ >> } >> >> # 保存所有文件 >> foreach ($path in $files.Keys) { >> $fullPath = Join-Path $moduleDir $path >> $dir = Split-Path $fullPath -Parent >> >> if (-not (Test-Path $dir)) { >> New-Item -ItemType Directory -Path $dir -Force | Out-Null >> } >> >> Set-Content -Path $fullPath -Value $files[$path] -Force >> Write-Host "已创建: $fullPath" >> } >> >> # ===== 安装后测试 ===== >> try { >> # 重新加载模块 >> Remove-Module CurlTools -ErrorAction SilentlyContinue -Force >> Import-Module $moduleDir -Force -ErrorAction Stop >> >> # 基本功能测试 >> $tests = @( >> { Get-CurlPath } >> { Get-CurlVersion } >> { >> $url = "https://www.example.com" >> $out = Join-Path $env:TEMP "test_$(Get-Date -Format 'yyyyMMddHHmmss').html" >> Invoke-SecureDownload -Url $url -OutputPath $out >> $out >> } >> ) >> >> foreach ($test in $tests) { >> try { >> $result = & $test >> if ($result) { >> Write-Host "✅ 测试成功: $($test.ToString())" -ForegroundColor Green >> } else { >> Write-Warning "⚠️ 测试返回空结果: $($test.ToString())" >> } >> } catch { >> Write-Error "❌ 测试失败: $($test.ToString()) - $_" >> } >> } >> >> Write-Host "`n✅ 模块安装成功并通过所有测试" -ForegroundColor Green >> } catch { >> Write-Error "❌ 模块加载失败: $_" >> exit 1 >> } >> 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\Private\ValidateCurlPath.ps1 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\Public\GetCurlPath.ps1 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\Public\GetCurlVersion.ps1 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\CurlTools.psm1 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\Private\GetPlatform.ps1 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\Public\SecureDownload.ps1 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\CurlTools.psd1 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\Private\InstallCurl.ps1 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\Private\InitializeModule.ps1 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\Private\FindCurlPath.ps1 已创建: C:\Program Files\WindowsPowerShell\Modules\CurlTools\Public\SetCurlPath.ps1 警告: ⚠️ 测试返回空结果: Get-CurlPath # 确定模块安装路径 $moduleDir = if ($PSVersionTable.PSEdition -eq "Core") { Join-Path $HOME ".local/share/powershell/Modules/CurlTools" } else { Join-Path $env:ProgramFiles "WindowsPowerShell/Modules/CurlTools" } # 创建目录结构 $dirs = @( $moduleDir (Join-Path $moduleDir "Private") (Join-Path $moduleDir "Public") ) $dirs | ForEach-Object { if (-not (Test-Path $_)) { New-Item -ItemType Directory -Path $_ -Force | Out-Null } } # ===== 函数定义 ===== # 核心基础函数 $getPlatformContent = @' function Get-Platform { <# .SYNOPSIS 检测当前操作系统平台 #> if ($PSVersionTable.PSEdition -eq "Core") { if ($IsWindows) { "Windows" } elseif ($IsLinux) { "Linux" } elseif ($IsMacOS) { "macOS" } else { "Unknown" } } else { if ($env:OS -like "Windows*") { "Windows" } elseif (Test-Path "/etc/os-release") { "Linux" } elseif (Test-Path "/System/Library/CoreServices/SystemVersion.plist") { "macOS" } else { "Unknown" } } } '@ # 其他函数内容(在实际脚本中需要完整填充)... # ===== 保存所有文件 ===== $files = @{ # 模块主文件 "CurlTools.psm1" = @' # 上面重构的模块主文件内容 '@ # 私有函数 "Private/GetPlatform.ps1" = $getPlatformContent "Private/ValidateCurlPath.ps1" = $validateCurlPathContent "Private/FindCurlPath.ps1" = $findCurlPathContent "Private/InitializeModule.ps1" = $initializeModuleContent "Private/InstallCurl.ps1" = $installCurlContent # 公共函数 "Public/GetCurlPath.ps1" = $getCurlPathContent "Public/SetCurlPath.ps1" = $setCurlPathContent "Public/GetCurlVersion.ps1" = $getCurlVersionContent "Public/SecureDownload.ps1" = $secureDownloadContent # 模块清单 "CurlTools.psd1" = @' @{ ModuleVersion = '4.0.0' GUID = 'c0d1b1e1-1a2b-4c3d-8e4f-9a0b1c2d3e4f' Author = 'PowerShell Expert' Description = 'Robust curl tools for PowerShell' RootModule = 'CurlTools.psm1' PowerShellVersion = '5.1' CompatiblePSEditions = @('Desktop', 'Core') FunctionsToExport = @( 'Get-CurlPath', 'Set-CurlPath', 'Get-CurlVersion', 'Invoke-SecureDownload' ) RequiredModules = @() } '@ } # 保存所有文件 foreach ($path in $files.Keys) { $fullPath = Join-Path $moduleDir $path $dir = Split-Path $fullPath -Parent if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Path $dir -Force | Out-Null } Set-Content -Path $fullPath -Value $files[$path] -Force Write-Host "已创建: $fullPath" } # ===== 安装后测试 ===== try { # 重新加载模块 Remove-Module CurlTools -ErrorAction SilentlyContinue -Force Import-Module $moduleDir -Force -ErrorAction Stop # 基本功能测试 $tests = @( { Get-CurlPath } { Get-CurlVersion } { $url = "https://www.example.com" $out = Join-Path $env:TEMP "test_$(Get-Date -Format 'yyyyMMddHHmmss').html" Invoke-SecureDownload -Url $url -OutputPath $out $out } ) foreach ($test in $tests) { try { $result = & $test if ($result) { Write-Host "✅ 测试成功: $($test.ToString())" -ForegroundColor Green } else { Write-Warning "⚠️ 测试返回空结果: $($test.ToString())" } } catch { Write-Error "❌ 测试失败: $($test.ToString()) - $_" } } Write-Host "`n✅ 模块安装成功并通过所有测试" -ForegroundColor Green } catch { Write-Error "❌ 模块加载失败: $_" exit 1 } : ❌ 测试失败: Get-CurlVersion - 无法将“Get-CurlVersion”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名 称的拼写,如果包括路径,请确保路径正确,然后再试一次。 + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException ✅ 测试成功: $url = "https://www.example.com" $out = Join-Path $env:TEMP "test_$(Get-Date -Format 'yyyyMMddHHmmss').html" Invoke-SecureDownload -Url $url -OutputPath $out $out ✅ 模块安装成功并通过所有测试 PS C:\Users\Administrator> function Initialize-Module { >> try { >> # 配置目录处理 >> $script:ConfigDir = switch (Get-Platform) { >> "Linux" { Join-Path $HOME ".config" "curltools" } >> "macOS" { Join-Path $HOME "Library" "Application Support" "CurlTools" } >> default { Join-Path $env:APPDATA "CurlTools" } >> } >> >> # 创建配置目录 >> if (-not (Test-Path $script:ConfigDir)) { >> New-Item -ItemType Directory -Path $script:ConfigDir -Force | Out-Null >> } >> >> $script:ConfigPath = Join-Path $script:ConfigDir "config.json" >> >> # 加载或创建配置 >> if (Test-Path $script:ConfigPath) { >> try { >> $script:Config = Get-Content $script:ConfigPath -Raw | ConvertFrom-Json -ErrorAction Stop >> } catch { >> Write-Warning "配置文件损坏,将创建新配置: $_" >> $script:Config = $null >> } >> } >> >> if (-not $script:Config) { >> $script:Config = [PSCustomObject]@{ >> CurlPath = $null >> LastUpdate = (Get-Date).ToString("o") >> AutoUpdate = $true >> } >> } >> >> # 设置curl路径 >> $isPathValid = $false >> if ($script:Config.CurlPath) { >> $isPathValid = Test-CurlPath -Path $script:Config.CurlPath >> } >> >> if (-not $isPathValid) { >> Write-Warning "配置的curl路径无效,正在重新查找..." >> $script:Config.CurlPath = Find-CurlPath >> } >> >> $script:CurlPath = $script:Config.CurlPath >> >> # 最终验证 >> if (-not (Test-CurlPath -Path $script:CurlPath)) { >> throw "无法找到有效的curl安装路径" >> } >> >> # 保存配置 >> $script:Config | ConvertTo-Json | Set-Content $script:ConfigPath -Force >> >> $script:ModuleInitialized = $true >> Write-Verbose "✅ 模块初始化完成 | curl路径: $script:CurlPath" >> return $true >> } catch { >> $errorDetails = @" >> 初始化失败: $_ >> 调用堆栈: >> $(Get-PSCallStack | Out-String) >> 配置路径: $script:ConfigPath >> 当前路径: $script:CurlPath >> "@ >> Set-Content -Path (Join-Path $script:ConfigDir "init-error.log") -Value $errorDetails >> throw $_ >> } >> } >> PS C:\Users\Administrator> function Find-CurlPath { >> <# >> .SYNOPSIS >> 自动查找curl安装路径 >> #> >> $platform = Get-Platform >> $exeName = if ($platform -eq "Windows") { "curl.exe" } else { "curl" } >> >> # 1. 检查系统PATH >> $pathCurl = Get-Command $exeName -ErrorAction SilentlyContinue >> if ($pathCurl) { >> $path = $pathCurl.Source | Split-Path >> if (Test-CurlPath -Path $path) { >> return $path >> } >> } >> >> # 2. 平台特定路径 >> $searchPaths = switch ($platform) { >> "Windows" { >> @( >> "C:\Windows\System32" >> "C:\Program Files\curl\bin" >> "${env:ProgramFiles}\Git\usr\bin" >> "${env:ProgramFiles(x86)}\Git\usr\bin" >> ) >> } >> "Linux" { @("/usr/bin", "/usr/local/bin", "/bin") } >> "macOS" { @("/usr/local/bin", "/opt/homebrew/bin", "/usr/bin") } >> default { @() } >> } >> >> foreach ($path in $searchPaths) { >> if (Test-CurlPath -Path $path) { >> return $path >> } >> } >> >> # 3. 自动安装 >> try { >> $installPath = Install-Curl >> if (Test-CurlPath -Path $installPath) { >> return $installPath >> } >> } catch { >> Write-Warning "自动安装curl失败: $_" >> } >> >> throw "无法找到有效的curl安装路径" >> } >> PS C:\Users\Administrator>
最新发布
08-13
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值