SHARE
TWEET

uag get app attributes

a guest Apr 6th, 2013 35 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. param(
  2.         [Parameter(Mandatory=$true)]
  3.         [string]$SourceFile,
  4.         [Parameter(Mandatory=$true)]
  5.         [string]$AppName
  6. )
  7.  
  8. $fileObj = [system.IO.File]::OpenText($SourceFile)
  9. $str = $fileObj.ReadToEnd()
  10.  
  11. $reg = New-Object system.Text.RegularExpressions.Regex("m_csAppName_([0-9]+)=$AppName\r\n",[system.Text.RegularExpressions.RegexOptions]::Multiline)
  12.  
  13. $match = $reg.Match($str)
  14.  
  15. if (-not $match.Success){
  16.         Write-Error "Не удалось найти приложение с именем $AppName"
  17.         return -1
  18. }
  19.  
  20. $AppID = $match.Groups[1].Value
  21.  
  22. [regex]::Matches($str, "[\t]+(m_[^_]+_$AppID[^=]*=[^\r\n]*)\r\n", "Multiline") | foreach {
  23.         $_.Groups[1].Value
  24. }
RAW Paste Data
Pastebin PRO Summer Special!
Get 40% OFF on Pastebin PRO accounts!
Top