本文整理汇总了C#中Microsoft.Tools.WindowsInstallerXml.Output类的典型用法代码示例。如果您正苦于以下问题:C# Output类的具体用法?C# Output怎么用?C# Output使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Output类属于Microsoft.Tools.WindowsInstallerXml命名空间,在下文中一共展示了Output类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BundleFinalize
/// <summary>
/// Called after all output changes occur and right before the output is bound into its final format.
/// </summary>
public override void BundleFinalize(Output output)
{
this.overallRegid = null; // always reset overall regid on initialize.
Table tagTable = output.Tables["WixBundleTag"];
if (null != tagTable)
{
Table table = output.Tables["WixBundle"];
WixBundleRow bundleInfo = (WixBundleRow)table.Rows[0];
Version bundleVersion = TagBinder.CreateFourPartVersion(bundleInfo.Version);
// Try to collect all the software id tags from all the child packages.
IList<SoftwareTag> allTags = TagBinder.CollectPackageTags(output);
foreach (Row tagRow in tagTable.Rows)
{
string regid = (string)tagRow[1];
string name = (string)tagRow[2];
bool licensed = (null != tagRow[3] && 0 != (int)tagRow[3]);
string typeString = (string)tagRow[5];
TagType type = String.IsNullOrEmpty(typeString) ? TagType.Unknown : (TagType)Enum.Parse(typeof(TagType), typeString);
IList<SoftwareTag> containedTags = TagBinder.CalculateContainedTagsAndType(allTags, ref type);
using (MemoryStream ms = new MemoryStream())
{
TagBinder.CreateTagFile(ms, regid, bundleInfo.BundleId.ToString("D").ToUpperInvariant(), bundleInfo.Name, bundleVersion, bundleInfo.Publisher, licensed, type, containedTags);
tagRow[4] = Encoding.UTF8.GetString(ms.ToArray());
}
}
}
}
示例2: DatabaseInitialize
/// <summary>
/// Called before database binding occurs.
/// </summary>
public override void DatabaseInitialize(Output output)
{
this.overallRegid = null; // always reset overall regid on initialize.
// Ensure the tag files are generated to be imported by the MSI.
this.CreateProductTagFiles(output);
}
示例3: BundleFinalize
/// <summary>
/// Called after all output changes occur and right before the output is bound into its final format.
/// </summary>
public override void BundleFinalize(Output output)
{
Table tagTable = output.Tables["WixBundleTag"];
if (null != tagTable)
{
Table table = output.Tables["WixBundle"];
WixBundleRow bundleInfo = (WixBundleRow)table.Rows[0];
string bundleId = bundleInfo.BundleId.ToString("D").ToUpperInvariant();
Version bundleVersion = TagBinder.CreateFourPartVersion(bundleInfo.Version);
string upgradeCode = NormalizeGuid(bundleInfo.UpgradeCode);
string uniqueId = String.Concat("wix:bundle/", bundleId);
string persistentId = String.Concat("wix:bundle.upgrade/", upgradeCode);
// Try to collect all the software id tags from all the child packages.
IList<SoftwareTag> containedTags = TagBinder.CollectPackageTags(output);
foreach (Row tagRow in tagTable.Rows)
{
string regid = (string)tagRow[1];
string name = (string)tagRow[2];
using (MemoryStream ms = new MemoryStream())
{
TagBinder.CreateTagFile(ms, uniqueId, bundleInfo.Name, bundleVersion, regid, bundleInfo.Publisher, persistentId, containedTags);
tagRow[5] = Encoding.UTF8.GetString(ms.ToArray());
}
}
}
}
示例4: AutoMediaAssigner
/// <summary>
/// Constructor for auto media assigner.
/// </summary>
/// <param name="output">Output</param>
/// <param name="core">Binder core.</param>
/// <param name="filesCompressed">True if files are compressed by default. </param>
public AutoMediaAssigner(Output output, BinderCore core, bool filesCompressed)
{
this.output = output;
this.core = core;
this.filesCompressed = filesCompressed;
this.cabinetNameTemplate = "Cab{0}.cab";
uncompressedFileRows = new FileRowCollection();
mediaRows = new MediaRowCollection();
cabinets = new Hashtable();
}
示例5: InspectTransform
public override void InspectTransform(Output transform)
{
Table fileTable = transform.Tables["File"];
if (null != fileTable && 0 < fileTable.Rows.Count)
{
Row fileRow = fileTable.Rows[0];
this.Core.OnMessage(ValidationWarnings.ExampleWarning(fileRow.SourceLineNumbers));
return;
}
this.Core.OnMessage(ValidationErrors.ExampleError());
}
示例6: DatabaseAfterResolvedFields
/// <summary>
/// Called after database variable resolution occurs.
/// </summary>
public override void DatabaseAfterResolvedFields(Output output)
{
Table wixBindUpdateFilesTable = output.Tables["WixBindUpdatedFiles"];
// We'll end up re-writing the tag files but this time we may have the ProductCode
// now to use as the unique id.
List<WixFileRow> updatedFileRows = this.CreateProductTagFiles(output);
foreach (WixFileRow updateFileRow in updatedFileRows)
{
Row row = wixBindUpdateFilesTable.CreateRow(updateFileRow.SourceLineNumbers);
row[0] = updateFileRow.File;
}
}
示例7: SubStorage
/// <summary>
/// Instantiate a new substorage.
/// </summary>
/// <param name="name">The substorage name.</param>
/// <param name="data">The substorage data.</param>
public SubStorage(string name, Output data)
{
if (null == name)
{
throw new ArgumentNullException("name");
}
if (null == data)
{
throw new ArgumentNullException("data");
}
this.name = name;
this.data = data;
}
示例8: PayloadInfoRow
public PayloadInfoRow(SourceLineNumberCollection sourceLineNumbers, Output output, string id, string name, string sourceFile,
bool contentFile, bool suppressSignatureValidation, string downloadUrl, string container, PackagingType packaging) :
base(sourceLineNumbers, output.Tables["PayloadInfo"])
{
this.Id = id;
this.Name = name;
this.SourceFile = sourceFile;
this.ContentFile = contentFile;
this.SuppressSignatureValidation = suppressSignatureValidation;
this.DownloadUrl = downloadUrl;
this.Container = container;
this.Packaging = packaging;
this.Resolve();
}
示例9: InspectPatch
public override void InspectPatch(Output patch)
{
foreach (SubStorage transform in patch.SubStorages)
{
// Skip patch transforms.
if (transform.Name.StartsWith("#"))
{
continue;
}
Table fileTable = transform.Data.Tables["File"];
if (null != fileTable && 0 < fileTable.Rows.Count)
{
Row fileRow = fileTable.Rows[0];
this.Core.OnMessage(ValidationWarnings.AnotherExampleWarning(fileRow.SourceLineNumbers));
return;
}
}
this.Core.OnMessage(ValidationErrors.ExampleError());
}
示例10: ResolveFeatureBacklinks
/// <summary>
/// Resolve the feature backlinks to the final feature that a component will live in.
/// </summary>
/// <param name="output">Active output to add sections to.</param>
/// <param name="componentsToFeatures">Component to feature complex references.</param>
/// <param name="allSymbols">All symbols loaded from the intermediates.</param>
/// <param name="referencedSymbols">Collection of all symbols referenced during linking.</param>
/// <param name="unresolvedReferences">Unresolved references.</param>
private void ResolveFeatureBacklinks(
Output output,
ConnectToFeatureCollection componentsToFeatures,
SymbolCollection allSymbols,
StringCollection referencedSymbols,
ArrayList unresolvedReferences)
{
Hashtable uniqueComponentIds = new Hashtable();
foreach (Section section in output.Sections)
{
foreach (FeatureBacklink blink in section.FeatureBacklinks)
{
Reference reference = blink.Reference;
Symbol symbol = Common.GetSymbolForReference(section, reference, allSymbols, referencedSymbols, unresolvedReferences, this);
if (null == symbol)
{
continue;
}
Row row = symbol.Row;
string parentFeature;
if (OutputType.Module == output.Type)
{
parentFeature = Guid.Empty.ToString("B");
}
else
{
ConnectToFeature connection = componentsToFeatures[blink.Component];
if (null == connection)
{
throw new WixMissingFeatureException(SourceLineNumberCollection.FromFileName(section.Intermediate.Path), blink);
}
parentFeature = connection.PrimaryFeature;
// check for unique, implicit, primary feature parents with multiple possible parent features
if (PedanticLevel.Legendary == this.pedanticLevel &&
!connection.IsExplicitPrimaryFeature &&
0 < connection.ConnectFeatures.Count &&
!uniqueComponentIds.Contains(blink.Component))
{
this.OnMessage(WixWarnings.ImplicitPrimaryFeature(blink.Component));
// remember this component so only one warning is generated for it
uniqueComponentIds[blink.Component] = null;
}
}
switch (blink.Type)
{
case FeatureBacklinkType.Class:
row[11] = parentFeature;
break;
case FeatureBacklinkType.Extension:
row[4] = parentFeature;
break;
case FeatureBacklinkType.PublishComponent:
row[4] = parentFeature;
break;
case FeatureBacklinkType.Shortcut:
row[4] = parentFeature;
break;
case FeatureBacklinkType.TypeLib:
row[6] = parentFeature;
break;
default:
throw new ApplicationException("Internal Error: Unknown FeatureBackLinkType.");
}
}
}
}
示例11: ProcessComplexReferences
/// <summary>
/// Process the complex references.
/// </summary>
/// <param name="output">Active output to add sections to.</param>
/// <param name="sections">Sections that are referenced during the link process.</param>
/// <param name="referencedSymbols">Collection of all symbols referenced during linking.</param>
/// <param name="componentsToComponentGroupsComplexReferences">Component to ComponentGroup complex references.</param>
/// <param name="componentGroupsToFeatures">ComponentGroups to features complex references.</param>
/// <param name="componentGroupsToModules">ComponentGroups to modules complex references.</param>
/// <param name="componentsToFeatures">Component to feature complex references.</param>
/// <param name="featuresToFeatures">Feature to feature complex references.</param>
private void ProcessComplexReferences(
Output output,
SectionCollection sections,
StringCollection referencedSymbols,
ComplexReferenceCollection componentsToComponentGroupsComplexReferences,
ConnectToFeatureCollection componentGroupsToFeatures,
ConnectToModuleCollection componentGroupsToModules,
ConnectToFeatureCollection componentsToFeatures,
ConnectToFeatureCollection featuresToFeatures)
{
Hashtable componentsToModules = new Hashtable();
foreach (Section section in sections)
{
foreach (ComplexReference cref in section.ComplexReferences)
{
ConnectToFeature connection;
switch (cref.ParentType)
{
case ComplexReferenceParentType.ComponentGroup:
switch (cref.ChildType)
{
case ComplexReferenceChildType.Component:
componentsToComponentGroupsComplexReferences.Add(cref);
break;
default:
throw new ApplicationException("Unexpected complex reference child type."); // TODO: come up with a real exception to throw (Unexpected complex reference child type)
}
break;
case ComplexReferenceParentType.Feature:
switch (cref.ChildType)
{
case ComplexReferenceChildType.Component:
connection = componentsToFeatures[cref.ChildId];
if (null == connection)
{
componentsToFeatures.Add(new ConnectToFeature(section, cref.ChildId, cref.ParentId, cref.IsPrimary));
}
else if (cref.IsPrimary && connection.IsExplicitPrimaryFeature)
{
this.OnMessage(WixErrors.MultiplePrimaryReferences(SourceLineNumberCollection.FromFileName(section.Intermediate.Path), cref.ChildType.ToString(), cref.ChildId, cref.ParentId, connection.PrimaryFeature));
continue;
}
else if (cref.IsPrimary)
{
connection.ConnectFeatures.Add(connection.PrimaryFeature); // move the guessed primary feature to the list of connects
connection.PrimaryFeature = cref.ParentId; // set the new primary feature
connection.IsExplicitPrimaryFeature = true; // and make sure we remember that we set it so we can fail if we try to set it again
}
else
{
connection.ConnectFeatures.Add(cref.ParentId);
}
// add a row to the FeatureComponents table
Row row = Common.CreateRowInSection(null, section, this.tableDefinitions["FeatureComponents"]);
if (this.sectionIdOnTuples)
{
row.SectionId = section.Id;
}
row[0] = cref.ParentId;
row[1] = cref.ChildId;
// index the component for finding orphaned records
string symbolName = String.Concat("Component:", cref.ChildId);
if (!referencedSymbols.Contains(symbolName))
{
referencedSymbols.Add(symbolName);
}
break;
case ComplexReferenceChildType.ComponentGroup:
connection = componentGroupsToFeatures[cref.ChildId];
if (null == connection)
{
componentGroupsToFeatures.Add(new ConnectToFeature(section, cref.ChildId, cref.ParentId, cref.IsPrimary));
}
else if (cref.IsPrimary && connection.IsExplicitPrimaryFeature)
{
this.OnMessage(WixErrors.MultiplePrimaryReferences(SourceLineNumberCollection.FromFileName(section.Intermediate.Path), cref.ChildType.ToString(), cref.ChildId, cref.ParentId, connection.PrimaryFeature));
continue;
}
else if (cref.IsPrimary)
{
connection.ConnectFeatures.Add(connection.PrimaryFeature);
connection.PrimaryFeature = cref.ParentId;
connection.IsExplicitPrimaryFeature = true;
}
else
//.........这里部分代码省略.........
示例12: Load
public void Load(string patchPath)
{
this.patch = Output.Load(patchPath, false, false);
}
示例13: CheckUninstallableTransform
/// <summary>
/// Ensure transform is uninstallable.
/// </summary>
/// <param name="productCode">Product code in transform.</param>
/// <param name="transform">Transform generated by torch.</param>
/// <param name="tables">Tables to be checked</param>
/// <returns>True if the transform is uninstallable</returns>
private bool CheckUninstallableTransform(string productCode, Output transform, ArrayList tables)
{
bool ret = true;
foreach (string table in tables)
{
Table wixTable = transform.Tables[table];
if (null != wixTable)
{
foreach (Row row in wixTable.Rows)
{
if (row.Operation == RowOperation.Add)
{
ret = false;
string primaryKey = row.GetPrimaryKey('/');
if (null == primaryKey)
{
primaryKey = string.Empty;
}
this.OnMessage(WixErrors.NewRowAddedInTable(row.SourceLineNumbers, productCode, wixTable.Name, primaryKey));
}
}
}
}
return ret;
}
示例14: CompareOutput
/// <summary>
/// Compare two Outputs
/// </summary>
/// <param name="targetOutput">The expected output</param>
/// <param name="updatedOutput">The actual output</param>
/// <param name="tables">The list of tables to compare</param>
/// <returns>Any differences found.</returns>
private static ArrayList CompareOutput(Output targetOutput, Output updatedOutput, params string[] tables)
{
ArrayList differences = new ArrayList();
Differ differ = new Differ();
differ.SuppressKeepingSpecialRows = true;
Output transform = differ.Diff(targetOutput, updatedOutput);
foreach (Table table in transform.Tables)
{
if (null != tables && -1 == Array.IndexOf(tables, table.Name))
{
// Skip this table
continue;
}
switch (table.Operation)
{
case TableOperation.Add:
differences.Add(String.Format(CultureInfo.InvariantCulture, "The {0} table has been added.", table.Name));
break;
case TableOperation.Drop:
differences.Add(String.Format(CultureInfo.InvariantCulture, "The {0} table has been dropped.", table.Name));
continue;
}
// index the target rows for better error messages
Hashtable targetRows = new Hashtable();
Table targetTable = targetOutput.Tables[table.Name];
if (null != targetTable)
{
foreach (Row row in targetTable.Rows)
{
string primaryKey = row.GetPrimaryKey('/');
// only index rows with primary keys since these are the ones that can be modified
if (null != primaryKey)
{
targetRows.Add(primaryKey, row);
}
}
}
foreach (Row row in table.Rows)
{
switch (row.Operation)
{
case RowOperation.Add:
differences.Add(String.Format(CultureInfo.InvariantCulture, "The {0} table, row '{1}' has been added.", table.Name, row.ToString()));
break;
case RowOperation.Delete:
differences.Add(String.Format(CultureInfo.InvariantCulture, "The {0} table, row '{1}' has been deleted.", table.Name, row.ToString()));
break;
case RowOperation.Modify:
if (!Verifier.Ignore(row))
{
string primaryKey = row.GetPrimaryKey('/');
Row targetRow = (Row)targetRows[primaryKey];
differences.Add(String.Format(CultureInfo.InvariantCulture, "The {0} table, row '{1}' has changed to '{2}'.", table.Name, targetRow.ToString(), row.ToString()));
}
break;
default:
throw new InvalidOperationException("Unknown diff row.");
}
}
}
return differences;
}
示例15: VerifyTableExists
/// <summary>
/// Verifies that a given table exists in the output
/// </summary>
/// <param name="output">Output object to verify.</param>
/// <param name="tableName">Name of the table to verify.</param>
/// <param name="wixoutFile">File where output object is stored. Only used to display error message.</param>
public static void VerifyTableExists(Output output, string tableName, string wixoutFile)
{
bool tableExists = CheckTableExists(output, tableName);
Assert.True(tableExists, String.Format("Table '{0}' does not exist in output '{1}'. It was expected to exist.", tableName, wixoutFile));
}