本文整理汇总了C#中Microsoft.Deployment.WindowsInstaller.Record.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# Record.GetString方法的具体用法?C# Record.GetString怎么用?C# Record.GetString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Deployment.WindowsInstaller.Record
的用法示例。
在下文中一共展示了Record.GetString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTablePrimaryKeys
private static IList<string> GetTablePrimaryKeys(Database db, string table)
{
if (table == "_Tables")
{
return new string[] { "Name" };
}
else if (table == "_Columns")
{
return new string[] { "Table", "Number" };
}
else if (table == "_Storages")
{
return new string[] { "Name" };
}
else if (table == "_Streams")
{
return new string[] { "Name" };
}
else
{
int hrec;
uint ret = RemotableNativeMethods.MsiDatabaseGetPrimaryKeys(
(int) db.Handle, table, out hrec);
if (ret != 0)
{
throw InstallerException.ExceptionFromReturnCode(ret);
}
using (Record rec = new Record((IntPtr) hrec, true, null))
{
string[] keys = new string[rec.FieldCount];
for (int i = 0; i < keys.Length; i++)
{
keys[i] = rec.GetString(i + 1);
}
return keys;
}
}
}
示例2: GetPatchFileList
/// <summary>
/// [MSI 4.0] Gets the list of files that can be updated by one or more patches.
/// </summary>
/// <param name="productCode">ProductCode (GUID) of the product which is
/// the target of the patches</param>
/// <param name="patches">list of file paths of one or more patches to be
/// analyzed</param>
/// <returns>List of absolute paths of files that can be updated when the
/// patches are applied on this system.</returns>
/// <remarks><p>
/// Win32 MSI API:
/// <a href="http://msdn.microsoft.com/library/en-us/msi/setup/msigetpatchfilelist.asp">MsiGetPatchFileList</a>
/// </p></remarks>
internal static IList<string> GetPatchFileList(string productCode, IList<string> patches)
{
if (String.IsNullOrEmpty(productCode))
{
throw new ArgumentNullException("productCode");
}
if (patches == null || patches.Count == 0)
{
throw new ArgumentNullException("patches");
}
StringBuilder patchList = new StringBuilder();
foreach (string patch in patches)
{
if (patch != null)
{
if (patchList.Length != 0)
{
patchList.Append(';');
}
patchList.Append(patch);
}
}
if (patchList.Length == 0)
{
throw new ArgumentNullException("patches");
}
IntPtr phFileRecords;
uint cFiles;
uint ret = NativeMethods.MsiGetPatchFileList(
productCode,
patchList.ToString(),
out cFiles,
out phFileRecords);
if (ret != 0)
{
throw InstallerException.ExceptionFromReturnCode(ret);
}
List<string> files = new List<string>();
for (uint i = 0; i < cFiles; i++)
{
int hFileRec = Marshal.ReadInt32(phFileRecords, (int) i);
using (Record fileRec = new Record(hFileRec, true, null))
{
files.Add(fileRec.GetString(1));
}
}
return files;
}
示例3: UIRecordHandler
/// <summary>
/// Handler for external UI messages.
/// </summary>
/// <param name="messageType">The type of message.</param>
/// <param name="messageRecord">The message details.</param>
/// <param name="buttons">Buttons to show (unused).</param>
/// <param name="icon">The icon to show (unused).</param>
/// <param name="defaultButton">The default button (unused).</param>
/// <returns>How the message was handled.</returns>
public MessageResult UIRecordHandler(
InstallMessage messageType,
Record messageRecord,
MessageButtons buttons,
MessageIcon icon,
MessageDefaultButton defaultButton)
{
#if False
Console.WriteLine("Message type {0}: {1}", messageType.ToString(), this.session.FormatRecord(messageRecord));
#endif
if (!this.session.IsClosed && 1 <= messageRecord.FieldCount)
{
switch (messageType)
{
case InstallMessage.ActionStart:
// only try to interpret the messages if they're coming from WixRunImmediateUnitTests
string action = messageRecord.GetString(1);
this.runningTests = Constants.LuxCustomActionName == action;
return MessageResult.OK;
case InstallMessage.User:
if (this.runningTests)
{
string message = messageRecord.ToString();
int id = messageRecord.GetInteger(1);
if (Constants.TestIdMinimumSuccess <= id && Constants.TestIdMaximumSuccess >= id)
{
this.OnMessage(NitVerboses.TestPassed(message));
++this.passes;
}
else if (Constants.TestIdMinimumFailure <= id && Constants.TestIdMaximumFailure >= id)
{
this.OnMessage(NitErrors.TestFailed(message));
++this.failures;
}
}
return MessageResult.OK;
case InstallMessage.Error:
case InstallMessage.FatalExit:
this.OnMessage(NitErrors.PackageFailed(this.session.FormatRecord(messageRecord)));
return MessageResult.Error;
}
}
return MessageResult.OK;
}