本文整理汇总了C#中Microsoft.Tools.WindowsInstallerXml.Msi.Database.TableExists方法的典型用法代码示例。如果您正苦于以下问题:C# Database.TableExists方法的具体用法?C# Database.TableExists怎么用?C# Database.TableExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Tools.WindowsInstallerXml.Msi.Database
的用法示例。
在下文中一共展示了Database.TableExists方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRowsFromTable
public static TableRow[] GetRowsFromTable(Database msidb, string tableName)
{
if (!msidb.TableExists(tableName))
{
Trace.WriteLine(string.Format("Table name does {0} not exist Found.", tableName));
return new TableRow[0];
}
string query = string.Concat("SELECT * FROM `", tableName, "`");
using (var view = new ViewWrapper(msidb.OpenExecuteView(query)))
{
var /*<TableRow>*/ rows = new ArrayList(view.Records.Count);
ColumnInfo[] columns = view.Columns;
foreach (object[] values in view.Records)
{
HybridDictionary valueCollection = new HybridDictionary(values.Length);
for (int cIndex = 0; cIndex < columns.Length; cIndex++)
{
valueCollection[columns[cIndex].Name] = values[cIndex];
}
rows.Add(new TableRow(valueCollection));
}
return (TableRow[]) rows.ToArray(typeof(TableRow));
}
}
示例2: ProcessMergeModules
/// <summary>
/// Retrieve files and their information from merge modules.
/// </summary>
/// <param name="output">Internal representation of the msi database to operate upon.</param>
/// <param name="fileRows">The indexed file rows.</param>
private void ProcessMergeModules(Output output, FileRowCollection fileRows)
{
Table wixMergeTable = output.Tables["WixMerge"];
if (null != wixMergeTable)
{
IMsmMerge2 merge = NativeMethods.GetMsmMerge();
// Get the output's minimum installer version
int outputInstallerVersion = int.MinValue;
Table summaryInformationTable = output.Tables["_SummaryInformation"];
if (null != summaryInformationTable)
{
foreach (Row row in summaryInformationTable.Rows)
{
if (14 == (int)row[0])
{
outputInstallerVersion = Convert.ToInt32(row[1], CultureInfo.InvariantCulture);
break;
}
}
}
foreach (Row row in wixMergeTable.Rows)
{
bool containsFiles = false;
WixMergeRow wixMergeRow = (WixMergeRow)row;
try
{
// read the module's File table to get its FileMediaInformation entries and gather any other information needed from the module.
using (Database db = new Database(wixMergeRow.SourceFile, OpenDatabase.ReadOnly))
{
if (db.TableExists("File") && db.TableExists("Component"))
{
Hashtable uniqueModuleFileIdentifiers = System.Collections.Specialized.CollectionsUtil.CreateCaseInsensitiveHashtable();
using (View view = db.OpenExecuteView("SELECT `File`, `Directory_` FROM `File`, `Component` WHERE `Component_`=`Component`"))
{
// add each file row from the merge module into the file row collection (check for errors along the way)
while (true)
{
using (Record record = view.Fetch())
{
if (null == record)
{
break;
}
// NOTE: this is very tricky - the merge module file rows are not added to the
// file table because they should not be created via idt import. Instead, these
// rows are created by merging in the actual modules
FileRow fileRow = new FileRow(null, this.core.TableDefinitions["File"]);
fileRow.File = record[1];
fileRow.Compressed = wixMergeRow.FileCompression;
fileRow.Directory = record[2];
fileRow.DiskId = wixMergeRow.DiskId;
fileRow.FromModule = true;
fileRow.PatchGroup = -1;
fileRow.Source = String.Concat(this.TempFilesLocation, Path.DirectorySeparatorChar, "MergeId.", wixMergeRow.Number.ToString(CultureInfo.InvariantCulture.NumberFormat), Path.DirectorySeparatorChar, record[1]);
FileRow collidingFileRow = fileRows[fileRow.File];
FileRow collidingModuleFileRow = (FileRow)uniqueModuleFileIdentifiers[fileRow.File];
if (null == collidingFileRow && null == collidingModuleFileRow)
{
fileRows.Add(fileRow);
// keep track of file identifiers in this merge module
uniqueModuleFileIdentifiers.Add(fileRow.File, fileRow);
}
else // collision(s) detected
{
// case-sensitive collision with another merge module or a user-authored file identifier
if (null != collidingFileRow)
{
this.core.OnMessage(WixErrors.DuplicateModuleFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id, collidingFileRow.File));
}
// case-insensitive collision with another file identifier in the same merge module
if (null != collidingModuleFileRow)
{
this.core.OnMessage(WixErrors.DuplicateModuleCaseInsensitiveFileIdentifier(wixMergeRow.SourceLineNumbers, wixMergeRow.Id, fileRow.File, collidingModuleFileRow.File));
}
}
containsFiles = true;
}
}
}
}
// Get the summary information to detect the Schema
using (SummaryInformation summaryInformation = new SummaryInformation(db))
{
string moduleInstallerVersionString = summaryInformation.GetProperty(14);
//.........这里部分代码省略.........
示例3: MergeModules
//.........这里部分代码省略.........
merge.CloseModule();
}
}
}
}
finally
{
if (databaseOpen)
{
merge.CloseDatabase(commit);
}
if (logOpen)
{
merge.CloseLog();
}
}
// stop processing if an error previously occurred
if (this.core.EncounteredError)
{
return;
}
using (Database db = new Database(tempDatabaseFile, OpenDatabase.Direct))
{
Table suppressActionTable = output.Tables["WixSuppressAction"];
// suppress individual actions
if (null != suppressActionTable)
{
foreach (Row row in suppressActionTable.Rows)
{
if (db.TableExists((string)row[0]))
{
string query = String.Format(CultureInfo.InvariantCulture, "SELECT * FROM {0} WHERE `Action` = '{1}'", row[0].ToString(), (string)row[1]);
using (View view = db.OpenExecuteView(query))
{
using (Record record = view.Fetch())
{
if (null != record)
{
this.core.OnMessage(WixWarnings.SuppressMergedAction((string)row[1], row[0].ToString()));
view.Modify(ModifyView.Delete, record);
}
}
}
}
}
}
// query for merge module actions in suppressed sequences and drop them
foreach (string tableName in suppressedTableNames)
{
if (!db.TableExists(tableName))
{
continue;
}
using (View view = db.OpenExecuteView(String.Concat("SELECT `Action` FROM ", tableName)))
{
while (true)
{
using (Record resultRecord = view.Fetch())
{
示例4: Validate
/// <summary>
/// Validate a database.
/// </summary>
/// <param name="databaseFile">The database to validate.</param>
/// <returns>true if validation succeeded; false otherwise.</returns>
public bool Validate(string databaseFile)
{
Dictionary<string, string> indexedICEs = new Dictionary<string, string>();
Dictionary<string, string> indexedSuppressedICEs = new Dictionary<string, string>();
int previousUILevel = (int)InstallUILevels.Basic;
IntPtr previousHwnd = IntPtr.Zero;
InstallUIHandler previousUIHandler = null;
if (null == databaseFile)
{
throw new ArgumentNullException("databaseFile");
}
// initialize the validator extension
this.extension.DatabaseFile = databaseFile;
this.extension.Output = this.output;
this.extension.InitializeValidator();
// if we don't have the temporary files object yet, get one
if (null == this.tempFiles)
{
this.tempFiles = new TempFileCollection();
}
Directory.CreateDirectory(this.TempFilesLocation); // ensure the base path is there
// index the ICEs
if (null != this.ices)
{
foreach (string ice in this.ices)
{
indexedICEs[ice] = null;
}
}
// index the suppressed ICEs
if (null != this.suppressedICEs)
{
foreach (string suppressedICE in this.suppressedICEs)
{
indexedSuppressedICEs[suppressedICE] = null;
}
}
// copy the database to a temporary location so it can be manipulated
string tempDatabaseFile = Path.Combine(this.TempFilesLocation, Path.GetFileName(databaseFile));
File.Copy(databaseFile, tempDatabaseFile);
// remove the read-only property from the temporary database
FileAttributes attributes = File.GetAttributes(tempDatabaseFile);
File.SetAttributes(tempDatabaseFile, attributes & ~FileAttributes.ReadOnly);
Mutex mutex = new Mutex(false, "WixValidator");
try
{
if (!mutex.WaitOne(0))
{
this.OnMessage(WixVerboses.ValidationSerialized());
mutex.WaitOne();
}
using (Database database = new Database(tempDatabaseFile, OpenDatabase.Direct))
{
bool propertyTableExists = database.TableExists("Property");
string productCode = null;
// remove the product code from the database before opening a session to prevent opening an installed product
if (propertyTableExists)
{
using (View view = database.OpenExecuteView("SELECT `Value` FROM `Property` WHERE Property = 'ProductCode'"))
{
using (Record record = view.Fetch())
{
if (null != record)
{
productCode = record.GetString(1);
using (View dropProductCodeView = database.OpenExecuteView("DELETE FROM `Property` WHERE `Property` = 'ProductCode'"))
{
}
}
}
}
}
// merge in the cube databases
foreach (string cubeFile in this.cubeFiles)
{
try
{
using (Database cubeDatabase = new Database(cubeFile, OpenDatabase.ReadOnly))
{
try
{
database.Merge(cubeDatabase, "MergeConflicts");
}
//.........这里部分代码省略.........
示例5: UnbindDatabase
/// <summary>
/// Unbind an MSI database file.
/// </summary>
/// <param name="databaseFile">The database file.</param>
/// <param name="database">The opened database.</param>
/// <param name="outputType">The type of output to create.</param>
/// <param name="exportBasePath">The path where files should be exported.</param>
/// <param name="skipSummaryInfo">Option to skip unbinding the _SummaryInformation table.</param>
/// <returns>The output representing the database.</returns>
private Output UnbindDatabase(string databaseFile, Database database, OutputType outputType, string exportBasePath, bool skipSummaryInfo)
{
string modularizationGuid = null;
Output output = new Output(SourceLineNumberCollection.FromFileName(databaseFile));
View validationView = null;
// set the output type
output.Type = outputType;
// get the codepage
database.Export("_ForceCodepage", this.TempFilesLocation, "_ForceCodepage.idt");
using (StreamReader sr = File.OpenText(Path.Combine(this.TempFilesLocation, "_ForceCodepage.idt")))
{
string line;
while (null != (line = sr.ReadLine()))
{
string[] data = line.Split('\t');
if (2 == data.Length)
{
output.Codepage = Convert.ToInt32(data[0], CultureInfo.InvariantCulture);
}
}
}
// get the summary information table if it exists; it won't if unbinding a transform
if (!skipSummaryInfo)
{
using (SummaryInformation summaryInformation = new SummaryInformation(database))
{
Table table = new Table(null, this.tableDefinitions["_SummaryInformation"]);
for (int i = 1; 19 >= i; i++)
{
string value = summaryInformation.GetProperty(i);
if (0 < value.Length)
{
Row row = table.CreateRow(output.SourceLineNumbers);
row[0] = i;
row[1] = value;
}
}
output.Tables.Add(table);
}
}
try
{
// open a view on the validation table if it exists
if (database.TableExists("_Validation"))
{
validationView = database.OpenView("SELECT * FROM `_Validation` WHERE `Table` = ? AND `Column` = ?");
}
// get the normal tables
using (View tablesView = database.OpenExecuteView("SELECT * FROM _Tables"))
{
while (true)
{
using (Record tableRecord = tablesView.Fetch())
{
if (null == tableRecord)
{
break;
}
string tableName = tableRecord.GetString(1);
using (View tableView = database.OpenExecuteView(String.Format(CultureInfo.InvariantCulture, "SELECT * FROM `{0}`", tableName)))
{
TableDefinition tableDefinition = new TableDefinition(tableName, false, false);
Hashtable tablePrimaryKeys = new Hashtable();
using (Record columnNameRecord = tableView.GetColumnInfo(MsiInterop.MSICOLINFONAMES),
columnTypeRecord = tableView.GetColumnInfo(MsiInterop.MSICOLINFOTYPES))
{
int columnCount = columnNameRecord.GetFieldCount();
// index the primary keys
using (Record primaryKeysRecord = database.PrimaryKeys(tableName))
{
int primaryKeysFieldCount = primaryKeysRecord.GetFieldCount();
for (int i = 1; i <= primaryKeysFieldCount; i++)
{
tablePrimaryKeys[primaryKeysRecord.GetString(i)] = null;
}
}
//.........这里部分代码省略.........
示例6: ImportStreams
/// <summary>
/// Adds all the streams to the final output.
/// </summary>
/// <param name="databasePath">Path to database.</param>
/// <param name="output">Output object that points at final output.</param>
private void ImportStreams(string databasePath, Output output)
{
using (Database db = new Database(databasePath, OpenDatabase.Direct))
{
View streamsView = null;
View binaryView = null;
View iconView = null;
View certificateView = null;
try
{
streamsView = db.OpenExecuteView("SELECT `Name`, `Data` FROM `_Streams`");
if (db.TableExists("Binary"))
{
binaryView = db.OpenExecuteView("SELECT `Name`, `Data` FROM `Binary`");
}
if (db.TableExists("Icon"))
{
iconView = db.OpenExecuteView("SELECT `Name`, `Data` FROM `Icon`");
}
if (db.TableExists("MsiDigitalCertificate"))
{
certificateView = db.OpenExecuteView("SELECT `DigitalCertificate`, `CertData` FROM `MsiDigitalCertificate`");
}
foreach (ImportStream importStream in output.ImportStreams)
{
string src;
using (Record record = new Record(2))
{
try
{
switch (importStream.Type)
{
case ImportStreamType.Cabinet:
this.OnMessage(WixVerboses.ImportCabinetStream(importStream.StreamName, importStream.Path));
record[1] = importStream.StreamName;
record.SetStream(2, importStream.Path);
streamsView.Modify(ModifyView.Assign, record);
break;
case ImportStreamType.DigitalCertificate:
src = this.extension.FileResolutionHandler(importStream.Path, FileResolutionType.DigitalCertificate);
this.OnMessage(WixVerboses.ImportDigitalCertificateStream(null, VerboseLevel.Trace, src));
record[1] = importStream.StreamName;
record.SetStream(2, importStream.Path);
certificateView.Modify(ModifyView.Assign, record);
break;
case ImportStreamType.Binary:
src = this.extension.FileResolutionHandler(importStream.Path, FileResolutionType.Binary);
this.OnMessage(WixVerboses.ImportBinaryStream(null, VerboseLevel.Trace, src));
if (OutputType.Module == output.Type)
{
record[1] = String.Concat(importStream.StreamName, ".", output.ModularizationGuid);
}
else
{
record[1] = importStream.StreamName;
}
if (55 < record[1].Length)
{
throw new WixInvalidAttributeException(null, "Binary", "Id", String.Format("Identifier cannot be longer than 55 characters. Binary identifier: {0}", record[1]));
}
record.SetStream(2, src);
binaryView.Modify(ModifyView.Assign, record);
break;
case ImportStreamType.Icon:
src = this.extension.FileResolutionHandler(importStream.Path, FileResolutionType.Icon);
this.OnMessage(WixVerboses.ImportIconStream(null, VerboseLevel.Verbose, src));
if (OutputType.Module == output.Type)
{
int start = importStream.StreamName.LastIndexOf(".");
if (-1 == start)
{
record[1] = String.Concat(importStream.StreamName, ".", output.ModularizationGuid);
}
else
{
record[1] = String.Concat(importStream.StreamName.Substring(0, start), ".", output.ModularizationGuid, importStream.StreamName.Substring(start));
}
}
else
{
record[1] = importStream.StreamName;
}
if (55 < record[1].Length)
{
throw new WixInvalidAttributeException(null, "Icon", "Id", String.Format("Identifier cannot be longer than 55 characters. Icon identifier: {0}", record[1]));
}
//.........这里部分代码省略.........
示例7: UpdateFileInformation
/// <summary>
/// Update several msi tables with data contained in files references in the File table.
/// </summary>
/// <remarks>
/// For versioned files, update the file version and language in the File table. For
/// unversioned files, add a row to the MsiFileHash table for the file. For assembly
/// files, add a row to the MsiAssembly table and add AssemblyName information by adding
/// MsiAssemblyName rows.
/// </remarks>
/// <param name="output">Internal representation of the msi database to operate upon.</param>
private void UpdateFileInformation(Output output)
{
OutputTable mergeTable = output.OutputTables["Merge"];
if (null != mergeTable)
{
foreach (OutputRow outputRow in mergeTable.OutputRows)
{
MergeRow mergeRow = (MergeRow)outputRow.Row;
string moduleFile = null;
try
{
moduleFile = this.extension.FileResolutionHandler(mergeRow.SourceFile, FileResolutionType.Module);
}
catch (WixFileNotFoundException wfnfe)
{
this.OnMessage(WixErrors.BinderExtensionMissingFile(null, ErrorLevel.Normal, wfnfe.Message));
continue;
}
output.Modules.Add(mergeRow);
try
{
// read the module's File table to get its FileMediaInformation entries
using (Database db = new Database(moduleFile, OpenDatabase.ReadOnly))
{
mergeRow.HasFiles = false;
if (db.TableExists("File") && db.TableExists("Component"))
{
Hashtable uniqueModuleFileIdentifiers = System.Collections.Specialized.CollectionsUtil.CreateCaseInsensitiveHashtable();
using (View view = db.OpenExecuteView("SELECT `File`, `Directory_` FROM `File`, `Component` WHERE `Component_`=`Component`"))
{
Record record;
while (view.Fetch(out record))
{
FileMediaInformation fileMediaInformation = new FileMediaInformation(record[1], record[2], mergeRow.DiskId, String.Concat(this.tempFiles.BasePath, Path.DirectorySeparatorChar, "MergeId.", mergeRow.Id.GetHashCode().ToString("X4", CultureInfo.InvariantCulture.NumberFormat), Path.DirectorySeparatorChar, record[1]), mergeRow.Number, mergeRow.FileCompression, moduleFile, -1);
FileMediaInformation otherFileMediaInformation = output.FileMediaInformationCollection[fileMediaInformation.FileId];
string collidingModuleFileIdentifier = (string)uniqueModuleFileIdentifiers[fileMediaInformation.FileId];
if (null == otherFileMediaInformation && null == collidingModuleFileIdentifier)
{
output.FileMediaInformationCollection.Add(fileMediaInformation);
// keep track of file identifiers in this merge module
uniqueModuleFileIdentifiers.Add(fileMediaInformation.FileId, fileMediaInformation.FileId);
}
else // collision(s) detected
{
// case-sensitive collision with another merge module or a user-authored file identifier
if (null != otherFileMediaInformation)
{
this.OnMessage(WixErrors.DuplicateModuleFileIdentifier(mergeRow.SourceLineNumbers, mergeRow.Id, fileMediaInformation.FileId));
}
// case-insensitive collision with another file identifier in the same merge module
if (null != collidingModuleFileIdentifier)
{
this.OnMessage(WixErrors.DuplicateModuleCaseInsensitiveFileIdentifier(mergeRow.SourceLineNumbers, mergeRow.Id, fileMediaInformation.FileId, collidingModuleFileIdentifier));
}
}
mergeRow.HasFiles = true;
}
}
}
}
}
catch (FileNotFoundException fnfe)
{
throw new WixFileNotFoundException(null, moduleFile, fnfe);
}
catch (IOException ioe)
{
throw new WixMergeModuleOpenException(mergeRow.SourceLineNumbers, mergeRow.Id, moduleFile, ioe);
}
}
}
// calculate sequence numbers and media disk id layout for all file media information objects
if (OutputType.Module == output.Type)
{
int lastSequence = 0;
foreach (FileMediaInformation fmi in output.FileMediaInformationCollection)
{
fmi.Modularize(output.ModularizationGuid);
fmi.Sequence = ++lastSequence;
}
}
else
//.........这里部分代码省略.........
示例8: MergeModules
//.........这里部分代码省略.........
}
if (logOpen)
{
merge.CloseLog();
}
}
// create a Hashtable of all the suppressed sequence types
Hashtable suppressedTableNames = new Hashtable();
if (output.SuppressAdminSequence)
{
suppressedTableNames[Action.SequenceTypeToString(SequenceType.adminExecute)] = null;
suppressedTableNames[Action.SequenceTypeToString(SequenceType.adminUI)] = null;
}
if (output.SuppressAdvertiseSequence)
{
suppressedTableNames[Action.SequenceTypeToString(SequenceType.advertiseExecute)] = null;
}
if (output.SuppressUISequence)
{
suppressedTableNames[Action.SequenceTypeToString(SequenceType.adminUI)] = null;
suppressedTableNames[Action.SequenceTypeToString(SequenceType.installUI)] = null;
}
using (Database db = new Database(databasePath, OpenDatabase.Direct))
{
OutputTable suppressActionOutputTable = output.OutputTables["SuppressAction"];
// suppress individual actions
if (null != suppressActionOutputTable)
{
foreach (OutputRow outputRow in suppressActionOutputTable.OutputRows)
{
if (db.TableExists((string)outputRow.Row[0]))
{
Row row = outputRow.Row;
string query = String.Format("SELECT * FROM {0} WHERE `Action` = '{1}'", row[0].ToString(), (string)row[1]);
using (View view = db.OpenExecuteView(query))
{
Record record;
if (view.Fetch(out record))
{
this.OnMessage(WixWarnings.SuppressMergedAction((string)row[1], row[0].ToString()));
view.Modify(ModifyView.Delete, record);
record.Close();
}
}
}
}
}
// query for merge module actions in suppressed sequences and drop them
foreach (string tableName in suppressedTableNames.Keys)
{
if (!db.TableExists(tableName))
{
continue;
}
using (View view = db.OpenExecuteView(String.Concat("SELECT `Action` FROM ", tableName)))
{
Record resultRecord;
while (view.Fetch(out resultRecord))
{
示例9: InscribeDatabase
/// <summary>
/// Updates database with signatures from external cabinets.
/// </summary>
/// <param name="databaseFile">Path to MSI database.</param>
/// <param name="outputFile">Ouput for updated MSI database.</param>
/// <param name="tidy">Clean up files.</param>
/// <returns>True if database is updated.</returns>
public bool InscribeDatabase(string databaseFile, string outputFile, bool tidy)
{
// Keeps track of whether we've encountered at least one signed cab or not - we'll throw a warning if no signed cabs were encountered
bool foundUnsignedExternals = false;
bool shouldCommit = false;
FileAttributes attributes = File.GetAttributes(databaseFile);
if (FileAttributes.ReadOnly == (attributes & FileAttributes.ReadOnly))
{
this.OnMessage(WixErrors.ReadOnlyOutputFile(databaseFile));
return shouldCommit;
}
using (Database database = new Database(databaseFile, OpenDatabase.Transact))
{
// Just use the English codepage, because the tables we're importing only have binary streams / MSI identifiers / other non-localizable content
int codepage = 1252;
// list of certificates for this database (hash/identifier)
Dictionary<string, string> certificates = new Dictionary<string, string>();
// Reset the in-memory tables for this new database
Table digitalSignatureTable = new Table(null, this.tableDefinitions["MsiDigitalSignature"]);
Table digitalCertificateTable = new Table(null, this.tableDefinitions["MsiDigitalCertificate"]);
// If any digital signature records exist that are not of the media type, preserve them
if (database.TableExists("MsiDigitalSignature"))
{
using (View digitalSignatureView = database.OpenExecuteView("SELECT `Table`, `SignObject`, `DigitalCertificate_`, `Hash` FROM `MsiDigitalSignature` WHERE `Table` <> 'Media'"))
{
while (true)
{
using (Record digitalSignatureRecord = digitalSignatureView.Fetch())
{
if (null == digitalSignatureRecord)
{
break;
}
Row digitalSignatureRow = null;
digitalSignatureRow = digitalSignatureTable.CreateRow(null);
string table = digitalSignatureRecord.GetString(0);
string signObject = digitalSignatureRecord.GetString(1);
digitalSignatureRow[0] = table;
digitalSignatureRow[1] = signObject;
digitalSignatureRow[2] = digitalSignatureRecord.GetString(2);
if (false == digitalSignatureRecord.IsNull(3))
{
// Export to a file, because the MSI API's require us to provide a file path on disk
string hashPath = Path.Combine(this.TempFilesLocation, "MsiDigitalSignature");
string hashFileName = string.Concat(table,".", signObject, ".bin");
Directory.CreateDirectory(hashPath);
hashPath = Path.Combine(hashPath, hashFileName);
using (FileStream fs = File.Create(hashPath))
{
int bytesRead;
byte[] buffer = new byte[1024 * 4];
while (0 != (bytesRead = digitalSignatureRecord.GetStream(3, buffer, buffer.Length)))
{
fs.Write(buffer, 0, bytesRead);
}
}
digitalSignatureRow[3] = hashFileName;
}
}
}
}
}
// If any digital certificates exist, extract and preserve them
if (database.TableExists("MsiDigitalCertificate"))
{
using (View digitalCertificateView = database.OpenExecuteView("SELECT * FROM `MsiDigitalCertificate`"))
{
while (true)
{
using (Record digitalCertificateRecord = digitalCertificateView.Fetch())
{
if (null == digitalCertificateRecord)
{
break;
}
string certificateId = digitalCertificateRecord.GetString(1); // get the identifier of the certificate
// Export to a file, because the MSI API's require us to provide a file path on disk
//.........这里部分代码省略.........