本文整理汇总了C#中VarEnum类的典型用法代码示例。如果您正苦于以下问题:C# VarEnum类的具体用法?C# VarEnum怎么用?C# VarEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VarEnum类属于命名空间,在下文中一共展示了VarEnum类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetManagedMarshalType
/// <summary>
/// Gets the managed type that an object needs to be coverted to in order for it to be able
/// to be represented as a Variant.
///
/// In general, there is a many-to-many mapping between Type and VarEnum. However, this method
/// returns a simple mapping that is needed for the current implementation. The reason for the
/// many-to-many relation is:
/// 1. Int32 maps to VT_I4 as well as VT_ERROR, and Decimal maps to VT_DECIMAL and VT_CY. However,
/// this changes if you throw the wrapper types into the mix.
/// 2. There is no Type to represent COM types. __ComObject is a private type, and Object is too
/// general.
/// </summary>
internal static Type GetManagedMarshalType(VarEnum varEnum) {
Debug.Assert((varEnum & VarEnum.VT_BYREF) == 0);
if (varEnum == VarEnum.VT_CY) {
return typeof(CurrencyWrapper);
}
if (IsPrimitiveType(varEnum)) {
return _ComToManagedPrimitiveTypes[varEnum];
}
switch (varEnum) {
case VarEnum.VT_EMPTY:
case VarEnum.VT_NULL:
case VarEnum.VT_UNKNOWN:
case VarEnum.VT_DISPATCH:
case VarEnum.VT_VARIANT:
return typeof(Object);
case VarEnum.VT_ERROR:
return typeof(ErrorWrapper);
default:
throw new InvalidOperationException(string.Format("Unexpected VarEnum {0}.", varEnum));
}
}
开发者ID:jxnmaomao,项目名称:ironruby,代码行数:38,代码来源:VarEnumSelector.cs
示例2: GetManagedMarshalType
/// <summary>
/// Gets the managed type that an object needs to be coverted to in order for it to be able
/// to be represented as a Variant.
///
/// In general, there is a many-to-many mapping between Type and VarEnum. However, this method
/// returns a simple mapping that is needed for the current implementation. The reason for the
/// many-to-many relation is:
/// 1. Int32 maps to VT_I4 as well as VT_ERROR, and Decimal maps to VT_DECIMAL and VT_CY. However,
/// this changes if you throw the wrapper types into the mix.
/// 2. There is no Type to represent COM types. __ComObject is a private type, and Object is too
/// general.
/// </summary>
internal static Type GetManagedMarshalType(VarEnum varEnum) {
Debug.Assert((varEnum & VarEnum.VT_BYREF) == 0);
if (varEnum == VarEnum.VT_CY) {
return typeof(CurrencyWrapper);
}
if (Variant.IsPrimitiveType(varEnum)) {
return _ComToManagedPrimitiveTypes[varEnum];
}
switch (varEnum) {
case VarEnum.VT_EMPTY:
case VarEnum.VT_NULL:
case VarEnum.VT_UNKNOWN:
case VarEnum.VT_DISPATCH:
case VarEnum.VT_VARIANT:
return typeof(Object);
case VarEnum.VT_ERROR:
return typeof(ErrorWrapper);
default:
throw Error.UnexpectedVarEnum(varEnum);
}
}
开发者ID:tnachen,项目名称:ironruby,代码行数:38,代码来源:VarEnumSelector.cs
示例3: StaticFromObjectTest
public void StaticFromObjectTest(object inputObject, VarEnum expectedVarType)
{
using (PropVariant pv = PropVariant.FromObject(inputObject))
{
Assert.Equal(pv.Value, inputObject);
Assert.Equal(pv.VarType, expectedVarType);
Assert.False(pv.IsNullOrEmpty);
}
}
开发者ID:QuocHuy7a10,项目名称:Arianrhod,代码行数:10,代码来源:PropVariantTests.cs
示例4: GetMarshalAs
internal static void GetMarshalAs(ConstArray nativeType, out UnmanagedType unmanagedType, out VarEnum safeArraySubType, out string safeArrayUserDefinedSubType, out UnmanagedType arraySubType, out int sizeParamIndex, out int sizeConst, out string marshalType, out string marshalCookie, out int iidParamIndex)
{
int num;
int num2;
int num3;
_GetMarshalAs(nativeType.Signature, nativeType.Length, out num, out num2, out safeArrayUserDefinedSubType, out num3, out sizeParamIndex, out sizeConst, out marshalType, out marshalCookie, out iidParamIndex);
unmanagedType = (UnmanagedType) num;
safeArraySubType = (VarEnum) num2;
arraySubType = (UnmanagedType) num3;
}
开发者ID:randomize,项目名称:VimConfig,代码行数:10,代码来源:MetadataImport.cs
示例5: GetTypeForVarEnum
internal static Type GetTypeForVarEnum(VarEnum vt)
{
Type type;
switch (vt)
{
// VarEnums which can be used in VARIANTs, but which cannot occur in a TYPEDESC
case VarEnum.VT_EMPTY:
case VarEnum.VT_NULL:
case VarEnum.VT_RECORD:
type = typeof(void);
break;
// VarEnums which are not used in VARIANTs, but which can occur in a TYPEDESC
case VarEnum.VT_VOID:
type = typeof(void);
break;
case VarEnum.VT_HRESULT:
type = typeof(int);
break;
case ((VarEnum)37): // VT_INT_PTR:
type = typeof(IntPtr);
break;
case ((VarEnum)38): // VT_UINT_PTR:
type = typeof(UIntPtr);
break;
case VarEnum.VT_SAFEARRAY:
case VarEnum.VT_CARRAY:
type = typeof(Array);
break;
case VarEnum.VT_LPSTR:
case VarEnum.VT_LPWSTR:
type = typeof(string);
break;
case VarEnum.VT_PTR:
case VarEnum.VT_USERDEFINED:
type = typeof(object);
break;
// For VarEnums that can be used in VARIANTs and well as TYPEDESCs, just use VarEnumSelector
default:
type = VarEnumSelector.GetManagedMarshalType(vt);
break;
}
return type;
}
开发者ID:40a,项目名称:PowerShell,代码行数:53,代码来源:VarEnumSelector.cs
示例6: Clear
public void Clear()
{
VariantType = VarEnum.VT_EMPTY;
unsafe
{
fixed (Variant* p = &this)
{
NativeMethods.VariantClear((IntPtr)p);
}
}
}
开发者ID:JWSingleton,项目名称:SolidEdgeSpy,代码行数:12,代码来源:Variant.cs
示例7: QueryAvailableProperties
public int[] QueryAvailableProperties(string itemId, out string[] descriptions, out VarEnum[] dataTypes)
{
int dwCount = 0;
int[] pdwPropertyIDs = {};
int[] ppvtDataTypes = {};
string[] _descriptions = {};
DoComCall(ComObject, "IOpcItemProperties::QueryAvailableProperties",() =>
ComObject.QueryAvailableProperties(itemId, out dwCount, out pdwPropertyIDs, out _descriptions,
out ppvtDataTypes), itemId);
dataTypes = new VarEnum[ppvtDataTypes.Length];
for (int i = 0; i < dwCount; i++)
{
dataTypes[i] = (VarEnum) ppvtDataTypes[i];
}
descriptions = _descriptions;
return pdwPropertyIDs;
}
开发者ID:yuriik83,项目名称:TitaniumAS.Opc.Client,代码行数:17,代码来源:OpcItemProperties.cs
示例8: BrowseOpcItemIds
public string[] BrowseOpcItemIds(OpcDaBrowseType browseFilterType, string filterCriteria = "",
VarEnum dataTypeFilter = VarEnum.VT_EMPTY,
OpcDaAccessRights accessRightsFilter = OpcDaAccessRights.Ignore)
{
string szFilterCriteria = filterCriteria ?? "";
return DoComCall(ComObject, "IOPCBrowseServerAddressSpace::BrowseOpcItemIDs", () =>
{
IEnumString enumString;
ComObject.BrowseOPCItemIDs((OPCBROWSETYPE) browseFilterType, szFilterCriteria,
(short) dataTypeFilter,
(OPCACCESSRIGHTS) accessRightsFilter, out enumString);
return DoComCall(enumString, "IEnumString::EnumareateAllAndRelease",
() => enumString.EnumareateAllAndRelease(OpcConfiguration.BatchSize).ToArray(),
OpcConfiguration.BatchSize);
}, browseFilterType, szFilterCriteria, dataTypeFilter,
accessRightsFilter);
}
开发者ID:yuriik83,项目名称:TitaniumAS.Opc.Client,代码行数:18,代码来源:OpcBrowseServerAddressSpace.cs
示例9: GetItemIds
/// <summary>
/// Retrieves enumerator of current branch.
/// </summary>
/// <param name="type">Namespace browse mode. See <see cref="BrowseType"/></param>
/// <param name="filterCriteria">Mask of item/folder name.</param>
/// <param name="dataTypeFilter">Filter by type.</param>
/// <param name="accessRightsFilter">Filter by access rights.</param>
/// <returns>Enumerator of current namespace level.</returns>
public IEnumerable<string> GetItemIds(BrowseType type, string filterCriteria, VarEnum dataTypeFilter, int accessRightsFilter)
{
IEnumString enumerator;
browseServerSpace.BrowseOPCItemIDs(
type,
filterCriteria,
(short)dataTypeFilter,
accessRightsFilter,
out enumerator);
try
{
enumerator.Reset();
var itemBlock = new Queue<string>(blockSize);
while(true)
{
if (itemBlock.Count == 0)
{
var itemIds = new string[blockSize];
uint fetched;
var res = enumerator.Next((uint)blockSize, itemIds, out fetched);
if (res > 1)
Marshal.ThrowExceptionForHR(res);
for(var i = 0; i < fetched; i++)
itemBlock.Enqueue(itemIds[i]);
}
if (itemBlock.Count == 0)
break;
yield return itemBlock.Dequeue();
}
}
finally
{
if(enumerator != null)
Marshal.ReleaseComObject(enumerator);
}
}
开发者ID:shuralex,项目名称:ProcessControlStandards.OPC,代码行数:47,代码来源:ServerAddressSpaceBrowser.cs
示例10: ToType
private object ToType(VarEnum type, string value) {
switch ( type ) {
case VarEnum.VT_BOOL:
return XmlConvert.ToBoolean(value);
case VarEnum.VT_DATE:
return XmlConvert.ToDateTime(value, XmlDateTimeSerializationMode.Unspecified);
case VarEnum.VT_DECIMAL:
return XmlConvert.ToDecimal(value);
case VarEnum.VT_EMPTY:
return null;
case VarEnum.VT_I1:
return XmlConvert.ToSByte(value);
case VarEnum.VT_I2:
return XmlConvert.ToInt16(value);
case VarEnum.VT_INT:
case VarEnum.VT_I4:
return XmlConvert.ToInt32(value);
case VarEnum.VT_I8:
return XmlConvert.ToInt64(value);
case VarEnum.VT_R4:
return XmlConvert.ToSingle(value);
case VarEnum.VT_R8:
return XmlConvert.ToDouble(value);
case VarEnum.VT_UI1:
return XmlConvert.ToByte(value);
case VarEnum.VT_UI2:
return XmlConvert.ToUInt16(value);
case VarEnum.VT_UINT:
case VarEnum.VT_UI4:
return XmlConvert.ToUInt32(value);
case VarEnum.VT_UI8:
return XmlConvert.ToUInt64(value);
default:
return value;
}
}
开发者ID:kakkerlakgly,项目名称:pipelinetesting,代码行数:36,代码来源:InstConfigPropertyBag.cs
示例11: EncodeAttribute
/// <summary>
/// This function returns the Data bytes that accurately describes the object
/// </summary>
/// <returns></returns>
internal static void EncodeAttribute(Guid guid, object value, VarEnum type, Stream stream)
{
// samgeo - Presharp issue
// Presharp gives a warning when local IDisposable variables are not closed
// in this case, we can't call Dispose since it will also close the underlying stream
// which still needs to be written to
#pragma warning disable 1634, 1691
#pragma warning disable 6518
BinaryWriter bw = new BinaryWriter(stream);
// if this guid used the legacy internal attribute persistence APIs,
// then it doesn't include embedded type information (it's always a byte array)
if (UsesEmbeddedTypeInformation(guid))
{
//
ushort datatype = (ushort)type;
bw.Write(datatype);
}
// We know the type of the object. We must serialize it accordingly.
switch(type)
{
case (VarEnum.VT_ARRAY | VarEnum.VT_I1)://8208
{
char[] data = (char[])value;
bw.Write(data);
break;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_UI1)://8209
{
byte[] data = (byte[])value;
bw.Write(data);
break;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_I2)://8194
{
short [] data = (short[])value;
for( int i = 0; i < data.Length; i++ )
bw.Write(data[i]);
break;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_UI2)://8210
{
ushort [] data = (ushort[])value;
for( int i = 0; i < data.Length; i++ )
bw.Write(data[i]);
break;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_I4)://8195
{
int [] data = (int[])value;
for( int i = 0; i < data.Length; i++ )
bw.Write(data[i]);
break;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_UI4)://8211
{
uint [] data = (uint[])value;
for( int i = 0; i < data.Length; i++ )
bw.Write(data[i]);
break;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_I8)://8212
{
long [] data = (long[])value;
for( int i = 0; i < data.Length; i++ )
bw.Write(data[i]);
break;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_UI8)://8213
{
ulong [] data = (ulong[])value;
for( int i = 0; i < data.Length; i++ )
bw.Write(data[i]);
break;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_R4 )://8196
{
float [] data = (float[])value;
for( int i = 0; i < data.Length; i++ )
bw.Write(data[i]);
break;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_R8)://8197
{
double [] data = (double[])value;
for( int i = 0; i < data.Length; i++ )
bw.Write(data[i]);
break;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_DATE)://8199
{
DateTime [] data = (DateTime[])value;
for( int i = 0; i < data.Length; i++ )
bw.Write(data[i].ToOADate());
break;
}
//.........这里部分代码省略.........
开发者ID:JianwenSun,项目名称:cc,代码行数:101,代码来源:CustomAttributeSerializer.cs
示例12: DecodeAttribute
/// <summary>
/// Decodes a byte array (stored in the memory stream) into an object
/// If the GUID is one of the internal versions, then the type is assumed
/// to be byte array.
/// If however, the guid is of unknown origin or not v1 internal, then the type
/// information is assumed to be stored in the first 2 bytes of the stream.
/// </summary>
/// <param name="guid">Guid of property - to detect origin</param>
/// <param name="memStream">Buffer of data</param>
/// <param name="type">the type info stored in the stream</param>
/// <returns>object stored in data buffer</returns>
/// <remarks>The buffer stream passed in to the method will be closed after reading</remarks>
internal static object DecodeAttribute(Guid guid, Stream memStream, out VarEnum type)
{
// First determine the object type
using (BinaryReader br = new BinaryReader(memStream))
{
//
// if usesEmbeddedTypeInfo is true, we do not
// read the variant type from the ISF stream. Instead,
// we assume it to be a byte[]
//
bool usesEmbeddedTypeInfo = UsesEmbeddedTypeInformation(guid);
// if the Id has embedded type information then retrieve it from the stream
if (usesEmbeddedTypeInfo)
{
// We must read the data type from the stream
type = (VarEnum)br.ReadUInt16();
}
else
{
// The data is stored as byte array
type = (VarEnum.VT_ARRAY | VarEnum.VT_UI1);
}
switch (type)
{
case (VarEnum.VT_ARRAY | VarEnum.VT_I1):
return br.ReadChars((int)(memStream.Length - 2));
case (VarEnum.VT_ARRAY | VarEnum.VT_UI1):
{
//
// note: for (VarEnum.VT_ARRAY | VarEnum.VT_UI1),
// we might be reading data that didn't have the
// type embedded in the ISF stream, in which case
// we must not assume we've already read two bytes
//
int previouslyReadBytes = 2;
if (!usesEmbeddedTypeInfo)
{
previouslyReadBytes = 0;
}
return br.ReadBytes((int)(memStream.Length - previouslyReadBytes));
}
case (VarEnum.VT_ARRAY | VarEnum.VT_I2):
{
int count = (int)(memStream.Length - 2) / 2; // 2 is the size of one element
short[] val = new short[count];
for (int i = 0; i < count; i++)
val[i] = br.ReadInt16();
return val;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_UI2):
{
int count = (int)(memStream.Length - 2) / 2; // 2 is the size of one element
ushort[] val = new ushort[count];
for (int i = 0; i < count; i++)
val[i] = br.ReadUInt16();
return val;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_I4):
{
int count = (int)(memStream.Length - 2) / 4; // 2 is the size of one element
int[] val = new int[count];
for (int i = 0; i < count; i++)
val[i] = br.ReadInt32();
return val;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_UI4):
{
int count = (int)(memStream.Length - 2) / 4; // size of one element
uint[] val = new uint[count];
for (int i = 0; i < count; i++)
val[i] = br.ReadUInt32();
return val;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_I8):
{
int count = (int)(memStream.Length - 2) / Native.BitsPerByte; // size of one element
long[] val = new long[count];
for (int i = 0; i < count; i++)
val[i] = br.ReadInt64();
return val;
}
case (VarEnum.VT_ARRAY | VarEnum.VT_UI8):
{
int count = (int)(memStream.Length - 2) / Native.BitsPerByte; // size of one element
ulong[] val = new ulong[count];
for (int i = 0; i < count; i++)
val[i] = br.ReadUInt64();
//.........这里部分代码省略.........
开发者ID:JianwenSun,项目名称:cc,代码行数:101,代码来源:CustomAttributeSerializer.cs
示例13: VariantBuilder
internal VariantBuilder(VarEnum targetComType, ArgBuilder builder) {
_targetComType = targetComType;
_argBuilder = builder;
}
开发者ID:joshholmes,项目名称:ironruby,代码行数:4,代码来源:VariantBuilder.cs
示例14: GetByrefSetter
internal static System.Reflection.MethodInfo GetByrefSetter(VarEnum varType) {
switch (varType) {
#region Generated Outer Variant byref setter
// *** BEGIN GENERATED CODE ***
// generated by function: gen_byref_setters from: generate_comdispatch.py
case VarEnum.VT_I1: return typeof(Variant).GetMethod("SetAsByrefI1");
case VarEnum.VT_I2: return typeof(Variant).GetMethod("SetAsByrefI2");
case VarEnum.VT_I4: return typeof(Variant).GetMethod("SetAsByrefI4");
case VarEnum.VT_I8: return typeof(Variant).GetMethod("SetAsByrefI8");
case VarEnum.VT_UI1: return typeof(Variant).GetMethod("SetAsByrefUi1");
case VarEnum.VT_UI2: return typeof(Variant).GetMethod("SetAsByrefUi2");
case VarEnum.VT_UI4: return typeof(Variant).GetMethod("SetAsByrefUi4");
case VarEnum.VT_UI8: return typeof(Variant).GetMethod("SetAsByrefUi8");
case VarEnum.VT_INT: return typeof(Variant).GetMethod("SetAsByrefInt");
case VarEnum.VT_UINT: return typeof(Variant).GetMethod("SetAsByrefUint");
case VarEnum.VT_BOOL: return typeof(Variant).GetMethod("SetAsByrefBool");
case VarEnum.VT_ERROR: return typeof(Variant).GetMethod("SetAsByrefError");
case VarEnum.VT_R4: return typeof(Variant).GetMethod("SetAsByrefR4");
case VarEnum.VT_R8: return typeof(Variant).GetMethod("SetAsByrefR8");
case VarEnum.VT_DECIMAL: return typeof(Variant).GetMethod("SetAsByrefDecimal");
case VarEnum.VT_CY: return typeof(Variant).GetMethod("SetAsByrefCy");
case VarEnum.VT_DATE: return typeof(Variant).GetMethod("SetAsByrefDate");
case VarEnum.VT_BSTR: return typeof(Variant).GetMethod("SetAsByrefBstr");
case VarEnum.VT_UNKNOWN: return typeof(Variant).GetMethod("SetAsByrefUnknown");
case VarEnum.VT_DISPATCH: return typeof(Variant).GetMethod("SetAsByrefDispatch");
// *** END GENERATED CODE ***
#endregion
case VarEnum.VT_VARIANT:
return typeof(Variant).GetMethod("SetAsByrefVariant");
case VarEnum.VT_RECORD:
case VarEnum.VT_ARRAY:
return typeof(Variant).GetMethod("SetAsByrefVariantIndirect");
default:
throw Error.VariantGetAccessorNYI(varType);
}
}
开发者ID:andreakn,项目名称:ironruby,代码行数:43,代码来源:Variant.cs
示例15: InitVector
internal void InitVector(Array array, Type type, VarEnum varEnum)
{
Init(array, type, varEnum | VarEnum.VT_VECTOR);
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:4,代码来源:PropVariant.cs
示例16: GetSimpleArgBuilder
// This helper can produce a builder for types that are directly supported by Variant.
private static SimpleArgBuilder GetSimpleArgBuilder(Type elementType, VarEnum elementVarEnum) {
SimpleArgBuilder argBuilder;
switch (elementVarEnum) {
case VarEnum.VT_BSTR:
argBuilder = new StringArgBuilder(elementType);
break;
case VarEnum.VT_BOOL:
argBuilder = new BoolArgBuilder(elementType);
break;
case VarEnum.VT_DATE:
argBuilder = new DateTimeArgBuilder(elementType);
break;
case VarEnum.VT_CY:
argBuilder = new CurrencyArgBuilder(elementType);
break;
case VarEnum.VT_DISPATCH:
argBuilder = new DispatchArgBuilder(elementType);
break;
case VarEnum.VT_UNKNOWN:
argBuilder = new UnknownArgBuilder(elementType);
break;
case VarEnum.VT_VARIANT:
case VarEnum.VT_ARRAY:
case VarEnum.VT_RECORD:
argBuilder = new VariantArgBuilder(elementType);
break;
case VarEnum.VT_ERROR:
argBuilder = new ErrorArgBuilder(elementType);
break;
default:
argBuilder = new SimpleArgBuilder(elementType);
break;
}
return argBuilder;
}
开发者ID:tnachen,项目名称:ironruby,代码行数:38,代码来源:VarEnumSelector.cs
示例17: TryGetPrimitiveComTypeViaConversion
/// <summary>
/// Is there a unique primitive type that has the best conversion for the argument
/// </summary>
private static bool TryGetPrimitiveComTypeViaConversion(Type argumentType, out VarEnum primitiveVarEnum) {
// Look for a unique type family that the argument can be converted to.
List<VarEnum> compatibleComTypes = GetConversionsToComPrimitiveTypeFamilies(argumentType);
CheckForAmbiguousMatch(argumentType, compatibleComTypes);
if (compatibleComTypes.Count == 1) {
primitiveVarEnum = compatibleComTypes[0];
return true;
}
primitiveVarEnum = VarEnum.VT_VOID; // error
return false;
}
开发者ID:tnachen,项目名称:ironruby,代码行数:15,代码来源:VarEnumSelector.cs
示例18: ChangeTypeForCOM
/// <summary>
/// Converts a value to the specified type using COM conversion rules.
/// </summary>
public static int ChangeTypeForCOM(object source, VarEnum targetType, out object target)
{
return ChangeTypeForCOM(source, GetVarType(source), targetType, out target);
}
开发者ID:yuriik83,项目名称:UA-.NET,代码行数:7,代码来源:ComUtils.cs
示例19: SetSummaryInformation
/// <summary>
/// http://msdn.microsoft.com/en-us/library/windows/desktop/aa372045(v=vs.85).aspx
/// </summary>
public void SetSummaryInformation(MsiMethods.PropertyId propertyId, VarEnum datatype, object value)
{
var summaryHandle = IntPtr.Zero;
if (MsiMethods.MsiGetSummaryInformation(dbhandle, null, 7, ref summaryHandle) != (int)MsiMethods.ErrorCodes.Success)
{
throw new InstallerVerificationLibraryException("Could not open summary handler to");
}
switch (datatype)
{
case VarEnum.VT_FILETIME:
break;
case VarEnum.VT_I2:
case VarEnum.VT_I4:
if (MsiMethods.MsiSummaryInfoSetProperty(summaryHandle, (int)propertyId, (int)datatype, Convert.ToInt32(value), IntPtr.Zero, null) != (int)MsiMethods.ErrorCodes.Success)
{
throw new InstallerVerificationLibraryException("Could not set summary property" + propertyId);
}
break;
case VarEnum.VT_LPSTR:
if (MsiMethods.MsiSummaryInfoSetProperty(summaryHandle, (int)propertyId, (int)datatype, 0, IntPtr.Zero, Convert.ToString(value)) != (int)MsiMethods.ErrorCodes.Success)
{
throw new InstallerVerificationLibraryException("Could not set summary property" + propertyId);
}
break;
}
if (MsiMethods.MsiSummaryInfoPersist(summaryHandle) != (int)MsiMethods.ErrorCodes.Success)
{
throw new InstallerVerificationLibraryException("Could not persist summary property");
}
CloseHandle(summaryHandle);
}
开发者ID:pwibeck,项目名称:InstallerVerificationFramework,代码行数:37,代码来源:MsiDatabase.cs
示例20: OPCItemDef
public OPCItemDef(string id, bool activ, int hclt, VarEnum vt)
{
ItemID = id; Active = activ; HandleClient = hclt; RequestedDataType = vt;
}
开发者ID:Wolfury,项目名称:MTConnect4OPC,代码行数:4,代码来源:OPCGroup.cs
注:本文中的VarEnum类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论