This commit is contained in:
2012-11-30 21:35:06 -05:00
commit 3963d6363a
346 changed files with 351799 additions and 0 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
+46
View File
@@ -0,0 +1,46 @@
param($installPath, $toolsPath, $package, $project)
# VS 11 and above supports the new intellisense JS files
$supportsJsIntelliSenseFile = [System.Version]::Parse($dte.Version).Major -ge 11
if (-not $supportsJsIntelliSenseFile) {
Write-Host "IntelliSense JS files are not supported by your version of VS: " + $dte.Version
exit
}
# Extract the version number from the jquery file in the package's content\scripts folder
$packageScriptsFolder = Join-Path $installPath Content\Scripts
$jqueryFileName = Join-Path $packageScriptsFolder "jquery-*.js" | Get-ChildItem -Exclude "*.min.js","*-vsdoc.js" | Split-Path -Leaf
$jqueryFileName -match "jquery-((?:\d+\.)?(?:\d+\.)?(?:\d+\.)?(?:\d+)).js"
$ver = $matches[1]
# Determine the project scripts folder path
$projectFolderPath = $project.Properties.Item("FullPath").Value
$projectScriptsFolderPath = Join-Path $projectFolderPath Scripts
# Get the project item for the scripts folder
try {
$scriptsFolderProjectItem = $project.ProjectItems.Item("Scripts")
}
catch {
exit
}
# Delete the vsdoc file from the project
try {
$vsDocProjectItem = $scriptsFolderProjectItem.ProjectItems.Item("jquery-$ver-vsdoc.js")
$vsDocProjectItem.Delete()
}
catch {
exit
}
# Copy the intellisense file to the project from the tools folder
$intelliSenseFileName = "jquery-$ver.intellisense.js"
$intelliSenseFileSourcePath = Join-Path $toolsPath $intelliSenseFileName
try {
$scriptsFolderProjectItem.ProjectItems.AddFromFileCopy($intelliSenseFileSourcePath)
}
catch {
# This will throw if the file already exists, so we need to catch here
}
File diff suppressed because it is too large Load Diff
+64
View File
@@ -0,0 +1,64 @@
param($installPath, $toolsPath, $package, $project)
function Get-Checksum($file) {
$cryptoProvider = New-Object "System.Security.Cryptography.MD5CryptoServiceProvider"
$fileInfo = Get-Item "$file"
trap { ;
continue } $stream = $fileInfo.OpenRead()
if ($? -eq $false) {
#Write-Host "Couldn't open file for reading"
return $null
}
$bytes = $cryptoProvider.ComputeHash($stream)
$checksum = ''
foreach ($byte in $bytes) {
$checksum += $byte.ToString('x2')
}
$stream.Close() | Out-Null
return $checksum
}
# Extract the version number from the jquery file in the package's content\scripts folder
$packageScriptsFolder = Join-Path $installPath Content | Join-Path -ChildPath Scripts
$jqueryFileName = Join-Path $packageScriptsFolder "jquery-*.js" | Get-ChildItem -Exclude "*.min.js","*-vsdoc.js" | Split-Path -Leaf
$jqueryFileName -match "jquery-((?:\d+\.)?(?:\d+\.)?(?:\d+\.)?(?:\d+)).js"
$ver = $matches[1]
# Determine the file paths
$projectFolder = $project.Properties.Item("FullPath").Value
$intelliSenseFileName = "jquery-$ver.intellisense.js"
$projectScriptsFolder = Join-Path $projectFolder Scripts
$projectIntelliSenseFilePath = Join-Path $projectScriptsFolder $intelliSenseFileName
$origIntelliSenseFilePath = Join-Path $toolsPath $intelliSenseFileName
if (Test-Path $projectIntelliSenseFilePath) {
if ((Get-Checksum $projectIntelliSenseFilePath) -eq (Get-Checksum $origIntelliSenseFilePath)) {
# The intellisense file in the project matches the file in the tools folder, delete it
try {
# Get the project item for the scripts folder
$scriptsFolderProjectItem = $project.ProjectItems.Item("Scripts")
# Get the project item for the intellisense file
$intelliSenseFileProjectItem = $scriptsFolderProjectItem.ProjectItems.Item($intelliSenseFileName)
}
catch {
# The item wasn't found
exit
}
# Delete the project item
$intelliSenseFileProjectItem.Delete()
}
else {
$projectScriptsFolderLeaf = Split-Path $projectScriptsFolder -Leaf
Write-Host "Skipping '$projectScriptsFolderLeaf\$intelliSenseFileName' because it was modified." -ForegroundColor Magenta
}
}
else {
# The intellisense file was not found in project
}
Binary file not shown.