Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. function ExtractInclude ($line)
  2. {
  3. if ($line -like '*Content Include=*') {
  4. return $line.Split('"') | select -Skip 1 | select -First 1
  5. }
  6. }
  7.  
  8. function RemoveMissingInclude ([string]$path, [bool]$report) {
  9. $reader = [System.IO.File]::OpenText($path)
  10. $projectPath = (Split-Path $path) + "/"
  11.  
  12. try {
  13. for() {
  14. $line = $reader.ReadLine()
  15. if ($line -eq $null) { break }
  16.  
  17. $pathInclude = ExtractInclude($line)
  18.  
  19. if ($report) {
  20. if ($pathInclude -ne "") {
  21. if (-not (Test-Path "$projectPath$pathInclude")) { $pathInclude }
  22. }
  23. } else {
  24. if ($pathInclude -ne "") {
  25. if (Test-Path "$projectPath$pathInclude") { $line }
  26. } else {
  27. $line
  28. }
  29. }
  30. }
  31. }
  32. finally {
  33. $reader.Close()
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement