Option Explicit
Dim oFS, oManifest, args, oFestures, iFeatureCount, sSolutionId
dim arFeatures(20)
iFeatureCount = 0
sSolutionId = "3EB8F7B8-7C95-45f0-AF92-646F96B0F7E9"
set args = WScript.Arguments
' Create the File System Object
Set oFS = CreateObject("Scripting.FileSystemObject")
Set oManifest = oFS.CreateTextFile(args(0) + "manifest.xml", true)
oManifest.WriteLine ""
dim oFile, oGacFolder, oBinFolder
set oGacFolder = oFS.GetFolder(args(0) + "DLLS\GAC")
set oBinFolder = oFS.GetFolder(args(0) + "DLLS")
dim sSafeControls, oSafeXml
if (oGacFolder.Files.Count > 0 or oBinFolder.Files.Count > 0) then
oManifest.WriteLine " "
for each oFile in oGacFolder.Files
oManifest.WriteLine " "
if (oFS.FileExists(args(0) + "DLLS\SafeControls\" + oFile.Name + ".xml")) then
set oSafeXml = oFS.OpenTextFile(args(0) + "DLLS\SafeControls\" + oFile.Name + ".xml")
sSafeControls = oSafeXml.ReadAll
oManifest.Write Mid(sSafeControls, 4)
oManifest.WriteBlankLines 1
oSafeXml.Close
end if
oManifest.WriteLine " "
next
for each oFile in oBinFolder.Files
oManifest.WriteLine " "
if (oFS.FileExists(args(0) + "DLLS\SafeControls\" + oFile.Name + ".xml")) then
set oSafeXml = oFS.OpenTextFile(args(0) + "DLLS\SafeControls\" + oFile.Name + ".xml")
sSafeControls = oSafeXml.ReadAll
oManifest.Write Mid(sSafeControls, 4)
oManifest.WriteBlankLines 1
oSafeXml.Close
end if
oManifest.WriteLine " "
next
oManifest.WriteLine " "
end if
oManifest.WriteLine " "
' Add the files in the manifest
EnumTemplateFolder args(0) + "TEMPLATE", "TEMPLATE"
oManifest.WriteLine " "
oManifest.WriteLine " "
' Add the features
dim sFeature
for each sFeature in arFeatures
if (sFeature <> "") then oManifest.WriteLine sFeature
next
oManifest.WriteLine " "
oManifest.WriteLine " "
' Add the files in the manifest
EnumRootFolder args(0) + "ROOT", "ROOT"
oManifest.WriteLine " "
if (oFS.FileExists(args(0) + "cas.xml")) then
dim sCasXML, oCasFile
set oCasFile = oFS.OpenTextFile(args(0) + "cas.xml")
sCasXml = oCasFile.ReadAll
oManifest.Write Mid(sCasXml, 4)
oManifest.WriteBlankLines 1
oCasFile.Close
end if
oManifest.WriteLine ""
oManifest.Close
sub EnumTemplateFolder(sFolder, sRelativePath)
dim oFolder, oFolders, oSub, oFile
set oFolder = oFS.GetFolder(sFolder)
for each oFile in oFolder.Files
dim sTestFolder, iPos
iPos = InStrRev(sFolder, "TEMPLATE\FEATURES")
if (iPos > 0) then
sTestFolder = Mid(sFolder, iPos + 18)
else
sTestFolder = sFolder
end if
if (InStr(1, sTestFolder, "\") > 0) then
if (InStr(1, sFolder, "FEATURES") = 0) then
oManifest.WriteLine " "
else
oManifest.WriteLine " "
end if
end if
if (lcase(oFile.Name) = "feature.xml") then
arFeatures(iFeatureCount) = " "
iFeatureCount = iFeatureCount + 1
end if
next
if (sRelativePath = "TEMPLATE") then sRelativePath = ""
if (sRelativePath = "FEATURES") then sRelativePath = ""
if (sRelativePath <> "") then sRelativePath = sRelativePath + "\"
for each oSub in oFolder.SubFolders
if (Instr(oSub.Path, "_tfs")=0) then
EnumTemplateFolder oSub.Path, sRelativePath + oSub.Name
end if
next
end sub
sub EnumRootFolder(sFolder, sRelativePath)
dim oFolder, oFolders, oSub, oFile
set oFolder = oFS.GetFolder(sFolder)
for each oFile in oFolder.Files
dim sTestFolder, iPos
oManifest.WriteLine " "
next
if (sRelativePath = "ROOT") then sRelativePath = ""
if (sRelativePath <> "") then sRelativePath = sRelativePath + "\"
for each oSub in oFolder.SubFolders
if (Instr(oSub.Path, "_tfs")=0) then
EnumRootFolder oSub.Path, sRelativePath + oSub.Name
end if
next
end sub