C# Класс Opc.Ua.Com.ComUtils

Exposes WIN32 and COM API functions.
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
CloseHandle bool
CoCreateInstanceEx void
CoGetClassObject void
CoInitializeSecurity int
CoQueryProxyBlanket int
CoSetProxyBlanket int
ConvertCase char
DuplicateToken bool
FormatMessageW int
GetSystemDefaultLangID int
GetUserDefaultLangID int
IsLocalHost bool
LogonUser bool
NetApiBufferFree int
NetServerEnum int
VariantChangeTypeEx int
VariantClear void
VariantInit void
VariantToObjectArray System.Array

Открытые методы

Метод Описание
ChangeTypeForCOM ( object source, VarEnum sourceType, VarEnum targetType, object &target ) : int

Converts a value to the specified type using COM conversion rules.

ChangeTypeForCOM ( object source, VarEnum targetType, object &target ) : int

Converts a value to the specified type using COM conversion rules.

CompareLocales ( int localeId, string locale, bool ignoreRegion ) : bool

Compares a string locale to a WIN32 localeId

CreateComException ( Exception e ) : Exception

Converts an exception to an exception that returns a COM error code.

CreateComException ( Exception e, int errorId ) : Exception

Converts an exception to an exception that returns a COM error code.

CreateComException ( int errorId ) : Exception

Converts an exception to an exception that returns a COM error code.

CreateComException ( string message, int errorId ) : Exception

Creates a COM exception.

CreateException ( Exception e, string function ) : Exception

Creates an error message for a failed COM function call.

CreateInstance ( System.Guid clsid, string hostName, UserIdentity identity ) : object

Creates an instance of a COM server using the specified license key.

CreateInstance1 ( System.Guid clsid, string hostName, UserIdentity identity ) : object

Creates an instance of a COM server.

CreateInstance2 ( System.Guid clsid, string hostName, UserIdentity identity ) : object

Creates an instance of a COM server using the specified license key.

CreateInstanceWithLicenseKey ( System.Guid clsid, string hostName, UserIdentity identity, string licenseKey ) : object

Creates an instance of a COM server using the specified license key.

EnumComputers ( ) : string[]

Enumerates computers on the local network.

GetAccessRights ( byte accessLevel ) : int

Converts the UA access level to DA access rights.

GetDataTypeId ( short input ) : NodeId

Converts the VARTYPE to a UA Data Type ID.

GetDataTypeId ( short input, bool &isArray ) : NodeId

Converts the VARTYPE to a UA Data Type ID.

GetDateTime ( IntPtr pFiletime ) : System.DateTime

Unmarshals a WIN32 FILETIME from a pointer.

GetDateTime ( System filetime ) : System.DateTime

Unmarshals a WIN32 FILETIME.

GetDateTimes ( IntPtr &pArray, int size, bool deallocate ) : System.DateTime[]

Unmarshals an array of WIN32 FILETIMEs as DateTimes.

GetErrorCode ( Exception e, int defaultCode ) : int

Gets the error code for the exception.

This method ignores the exception but makes it possible to keep track of ignored exceptions.

GetErrorText ( Type type, int error ) : string

Returns the symbolic name for the specified error.

GetFILETIME ( System.DateTime datetime ) : System.Runtime.InteropServices.ComTypes.FILETIME

Marshals a DateTime as a WIN32 FILETIME.

GetFILETIMEs ( System.DateTime datetimes ) : IntPtr

Marshals an array of DateTimes into an unmanaged array of FILETIMEs

GetFILETIMEs ( IntPtr &pArray, int size ) : System.Runtime.InteropServices.ComTypes.FILETIME[]

Unmarshals an array of FILETIMEs

GetGUIDs ( IntPtr &pInput, int size, bool deallocate ) : System.Guid[]

Unmarshals an array of WIN32 GUIDs as Guid.

GetHdaAggregateId ( uint aggregateId ) : NodeId

Converts a HDA Aggregate ID to a UA aggregate ID

GetHdaAggregateId ( NodeId nodeId ) : uint

Converts a UA Aggregate ID to a HDA aggregate ID

GetHdaQualityCode ( uint quality ) : StatusCode

Converts a HDA quality code to a StatusCode.

GetHdaQualityCode ( StatusCode input ) : uint

Converts a UA status code to a HDA quality code.

GetInt16s ( short input ) : IntPtr

Allocates and marshals an array of 16 bit integers.

GetInt16s ( IntPtr &pArray, int size, bool deallocate ) : short[]

Unmarshals and frees a array of 16 bit integers.

GetInt32s ( int input ) : IntPtr

Allocates and marshals an array of 32 bit integers.

GetInt32s ( IntPtr &pArray, int size, bool deallocate ) : int[]

Unmarshals and frees an array of 32 bit integers.

GetLocale ( string input ) : int

Converts a Locale string to a LCID.

GetLocale ( int input ) : string

Converts a LCID to a Locale string.

GetPrincipalFromUserIdentity ( UserIdentity user ) : WindowsPrincipal

Returns the WindowsIdentity associated with a UserIdentity.

GetQualityCode ( short quality ) : StatusCode

Converts a DA quality code to a status code.

GetQualityCode ( StatusCode input ) : short

Converts a UA status code to a DA quality code.

GetStatusCodes ( IntPtr &pArray, int size, bool deallocate ) : int[]

Unmarshals and frees an array of HRESULTs.

GetSystemMessage ( int error, int localeId ) : string

Retrieves the system message text for the specified error.

GetSystemType ( short input ) : Type

Converts the VARTYPE to a SystemType

GetUInt32s ( IntPtr &pArray, int size, bool deallocate ) : int[]

Unmarshals and frees an array of 32 bit integers.

GetUnicodeStrings ( string values ) : IntPtr

Marshals an array of strings into a unmanaged memory buffer

GetUnicodeStrings ( IntPtr &pArray, int size, bool deallocate ) : string[]

Unmarshals and frees a array of unicode strings.

GetVARIANT ( Variant source ) : object

Converts an object into a value that can be marshalled to a VARIANT.

GetVARIANT ( object source ) : object

Converts an object into a value that can be marshalled to a VARIANT.

GetVARIANT ( object source, TypeInfo typeInfo ) : object

Converts an object into a value that can be marshalled to a VARIANT.

GetVARIANTs ( object values, bool preprocess ) : IntPtr

Marshals an array objects into an unmanaged array of VARIANTs.

GetVARIANTs ( IntPtr &pArray, int size, bool deallocate ) : object[]

Unmarshals an array of VARIANTs as objects.

GetValueRank ( short input ) : int

Converts the VARTYPE to a UA ValueRank.

GetVarType ( System type ) : VarEnum

Converts the system type to a VARTYPE.

GetVarType ( TypeInfo typeInfo ) : VarEnum

Converts the TypeInfo to a VARTYPE.

GetVarType ( object input ) : VarEnum

Returns the VARTYPE for the value.

InitializeSecurity ( ) : void

Initializes COM security.

IsRpcError ( Exception e ) : bool

Checks if the error is an RPC error.

IsUnknownError ( Exception e ) : bool

Checks if the error for the exception is one of the recognized errors.

IsValidComType ( object input ) : bool

Returns true is the object is a valid COM type.

Match ( string target, string pattern, bool caseSensitive ) : bool

Tests if the specified string matches the specified pattern.

ProcessComValue ( object value ) : object

Converts a COM value to something that UA clients can deal with.

ReleaseServer ( object server ) : void

Releases the server if it is a true COM server.

SetProxySecurity ( object server, IntPtr pAuthInfo ) : void

Sets the security settings for the proxy.

SetProxySecurity ( object server, UserIdentity user ) : void

Sets the security settings for the proxy.

TraceComError ( Exception e, string format ) : void

Reports an unexpected exception during a COM operation.

Приватные методы

Метод Описание
CloseHandle ( IntPtr handle ) : bool
CoCreateInstanceEx ( System.Guid &clsid, [ punkOuter, uint dwClsCtx, [ pServerInfo, uint dwCount, [ pResults ) : void
CoGetClassObject ( [ clsid, uint dwClsContext, [ pServerInfo, [ riid, [ ppv ) : void
CoInitializeSecurity ( IntPtr pSecDesc, int cAuthSvc, SOLE_AUTHENTICATION_SERVICE asAuthSvc, IntPtr pReserved1, uint dwAuthnLevel, uint dwImpLevel, IntPtr pAuthList, uint dwCapabilities, IntPtr pReserved3 ) : int
CoQueryProxyBlanket ( [ pProxy, uint &pAuthnSvc, uint &pAuthzSvc, [ pServerPrincName, uint &pAuthnLevel, uint &pImpLevel, IntPtr &pAuthInfo, uint &pCapabilities ) : int
CoSetProxyBlanket ( [ pProxy, uint pAuthnSvc, uint pAuthzSvc, IntPtr pServerPrincName, uint pAuthnLevel, uint pImpLevel, IntPtr pAuthInfo, uint pCapabilities ) : int
ConvertCase ( char c, bool caseSensitive ) : char
DuplicateToken ( IntPtr ExistingTokenHandle, int SECURITY_IMPERSONATION_LEVEL, IntPtr &DuplicateTokenHandle ) : bool
FormatMessageW ( int dwFlags, IntPtr lpSource, int dwMessageId, int dwLanguageId, IntPtr lpBuffer, int nSize, IntPtr Arguments ) : int
GetSystemDefaultLangID ( ) : int
GetUserDefaultLangID ( ) : int
IsLocalHost ( string hostName ) : bool

Determines if the host is the local host.

LogonUser ( string lpszUsername, string lpszDomain, string lpszPassword, int dwLogonType, int dwLogonProvider, IntPtr &phToken ) : bool
NetApiBufferFree ( IntPtr buffer ) : int
NetServerEnum ( IntPtr servername, uint level, IntPtr &bufptr, int prefmaxlen, int &entriesread, int &totalentries, uint servertype, IntPtr domain, IntPtr resume_handle ) : int
VariantChangeTypeEx ( IntPtr pvargDest, IntPtr pvarSrc, int lcid, ushort wFlags, short vt ) : int
VariantClear ( IntPtr pVariant ) : void
VariantInit ( IntPtr pVariant ) : void
VariantToObjectArray ( Array input ) : Array

Converts a Variant array to an Object array.

Описание методов

ChangeTypeForCOM() публичный статический Метод

Converts a value to the specified type using COM conversion rules.
public static ChangeTypeForCOM ( object source, VarEnum sourceType, VarEnum targetType, object &target ) : int
source object
sourceType VarEnum
targetType VarEnum
target object
Результат int

ChangeTypeForCOM() публичный статический Метод

Converts a value to the specified type using COM conversion rules.
public static ChangeTypeForCOM ( object source, VarEnum targetType, object &target ) : int
source object
targetType VarEnum
target object
Результат int

CompareLocales() публичный статический Метод

Compares a string locale to a WIN32 localeId
public static CompareLocales ( int localeId, string locale, bool ignoreRegion ) : bool
localeId int
locale string
ignoreRegion bool
Результат bool

CreateComException() публичный статический Метод

Converts an exception to an exception that returns a COM error code.
public static CreateComException ( Exception e ) : Exception
e System.Exception
Результат System.Exception

CreateComException() публичный статический Метод

Converts an exception to an exception that returns a COM error code.
public static CreateComException ( Exception e, int errorId ) : Exception
e System.Exception
errorId int
Результат System.Exception

CreateComException() публичный статический Метод

Converts an exception to an exception that returns a COM error code.
public static CreateComException ( int errorId ) : Exception
errorId int
Результат System.Exception

CreateComException() публичный статический Метод

Creates a COM exception.
public static CreateComException ( string message, int errorId ) : Exception
message string
errorId int
Результат System.Exception

CreateException() публичный статический Метод

Creates an error message for a failed COM function call.
public static CreateException ( Exception e, string function ) : Exception
e System.Exception
function string
Результат System.Exception

CreateInstance() публичный статический Метод

Creates an instance of a COM server using the specified license key.
public static CreateInstance ( System.Guid clsid, string hostName, UserIdentity identity ) : object
clsid System.Guid
hostName string
identity UserIdentity
Результат object

CreateInstance1() публичный статический Метод

Creates an instance of a COM server.
public static CreateInstance1 ( System.Guid clsid, string hostName, UserIdentity identity ) : object
clsid System.Guid
hostName string
identity UserIdentity
Результат object

CreateInstance2() публичный статический Метод

Creates an instance of a COM server using the specified license key.
public static CreateInstance2 ( System.Guid clsid, string hostName, UserIdentity identity ) : object
clsid System.Guid
hostName string
identity UserIdentity
Результат object

CreateInstanceWithLicenseKey() публичный статический Метод

Creates an instance of a COM server using the specified license key.
public static CreateInstanceWithLicenseKey ( System.Guid clsid, string hostName, UserIdentity identity, string licenseKey ) : object
clsid System.Guid
hostName string
identity UserIdentity
licenseKey string
Результат object

EnumComputers() публичный статический Метод

Enumerates computers on the local network.
public static EnumComputers ( ) : string[]
Результат string[]

GetAccessRights() публичный статический Метод

Converts the UA access level to DA access rights.
public static GetAccessRights ( byte accessLevel ) : int
accessLevel byte
Результат int

GetDataTypeId() публичный статический Метод

Converts the VARTYPE to a UA Data Type ID.
public static GetDataTypeId ( short input ) : NodeId
input short
Результат NodeId

GetDataTypeId() публичный статический Метод

Converts the VARTYPE to a UA Data Type ID.
public static GetDataTypeId ( short input, bool &isArray ) : NodeId
input short
isArray bool
Результат NodeId

GetDateTime() публичный статический Метод

Unmarshals a WIN32 FILETIME from a pointer.
public static GetDateTime ( IntPtr pFiletime ) : System.DateTime
pFiletime System.IntPtr A pointer to a FILETIME structure.
Результат System.DateTime

GetDateTime() публичный статический Метод

Unmarshals a WIN32 FILETIME.
public static GetDateTime ( System filetime ) : System.DateTime
filetime System
Результат System.DateTime

GetDateTimes() публичный статический Метод

Unmarshals an array of WIN32 FILETIMEs as DateTimes.
public static GetDateTimes ( IntPtr &pArray, int size, bool deallocate ) : System.DateTime[]
pArray System.IntPtr
size int
deallocate bool
Результат System.DateTime[]

GetErrorCode() публичный статический Метод

Gets the error code for the exception.
This method ignores the exception but makes it possible to keep track of ignored exceptions.
public static GetErrorCode ( Exception e, int defaultCode ) : int
e System.Exception The exception.
defaultCode int The default code.
Результат int

GetErrorText() публичный статический Метод

Returns the symbolic name for the specified error.
public static GetErrorText ( Type type, int error ) : string
type System.Type
error int
Результат string

GetFILETIME() публичный статический Метод

Marshals a DateTime as a WIN32 FILETIME.
public static GetFILETIME ( System.DateTime datetime ) : System.Runtime.InteropServices.ComTypes.FILETIME
datetime System.DateTime The DateTime object to marshal
Результат System.Runtime.InteropServices.ComTypes.FILETIME

GetFILETIMEs() публичный статический Метод

Marshals an array of DateTimes into an unmanaged array of FILETIMEs
public static GetFILETIMEs ( System.DateTime datetimes ) : IntPtr
datetimes System.DateTime The array of DateTimes to marshal
Результат System.IntPtr

GetFILETIMEs() публичный статический Метод

Unmarshals an array of FILETIMEs
public static GetFILETIMEs ( IntPtr &pArray, int size ) : System.Runtime.InteropServices.ComTypes.FILETIME[]
pArray System.IntPtr
size int
Результат System.Runtime.InteropServices.ComTypes.FILETIME[]

GetGUIDs() публичный статический Метод

Unmarshals an array of WIN32 GUIDs as Guid.
public static GetGUIDs ( IntPtr &pInput, int size, bool deallocate ) : System.Guid[]
pInput System.IntPtr
size int
deallocate bool
Результат System.Guid[]

GetHdaAggregateId() публичный статический Метод

Converts a HDA Aggregate ID to a UA aggregate ID
public static GetHdaAggregateId ( uint aggregateId ) : NodeId
aggregateId uint The aggregate id.
Результат NodeId

GetHdaAggregateId() публичный статический Метод

Converts a UA Aggregate ID to a HDA aggregate ID
public static GetHdaAggregateId ( NodeId nodeId ) : uint
nodeId NodeId The node id.
Результат uint

GetHdaQualityCode() публичный статический Метод

Converts a HDA quality code to a StatusCode.
public static GetHdaQualityCode ( uint quality ) : StatusCode
quality uint
Результат StatusCode

GetHdaQualityCode() публичный статический Метод

Converts a UA status code to a HDA quality code.
public static GetHdaQualityCode ( StatusCode input ) : uint
input StatusCode
Результат uint

GetInt16s() публичный статический Метод

Allocates and marshals an array of 16 bit integers.
public static GetInt16s ( short input ) : IntPtr
input short
Результат System.IntPtr

GetInt16s() публичный статический Метод

Unmarshals and frees a array of 16 bit integers.
public static GetInt16s ( IntPtr &pArray, int size, bool deallocate ) : short[]
pArray System.IntPtr
size int
deallocate bool
Результат short[]

GetInt32s() публичный статический Метод

Allocates and marshals an array of 32 bit integers.
public static GetInt32s ( int input ) : IntPtr
input int
Результат System.IntPtr

GetInt32s() публичный статический Метод

Unmarshals and frees an array of 32 bit integers.
public static GetInt32s ( IntPtr &pArray, int size, bool deallocate ) : int[]
pArray System.IntPtr
size int
deallocate bool
Результат int[]

GetLocale() публичный статический Метод

Converts a Locale string to a LCID.
public static GetLocale ( string input ) : int
input string
Результат int

GetLocale() публичный статический Метод

Converts a LCID to a Locale string.
public static GetLocale ( int input ) : string
input int
Результат string

GetPrincipalFromUserIdentity() публичный статический Метод

Returns the WindowsIdentity associated with a UserIdentity.
public static GetPrincipalFromUserIdentity ( UserIdentity user ) : WindowsPrincipal
user UserIdentity
Результат System.Security.Principal.WindowsPrincipal

GetQualityCode() публичный статический Метод

Converts a DA quality code to a status code.
public static GetQualityCode ( short quality ) : StatusCode
quality short
Результат StatusCode

GetQualityCode() публичный статический Метод

Converts a UA status code to a DA quality code.
public static GetQualityCode ( StatusCode input ) : short
input StatusCode
Результат short

GetStatusCodes() публичный статический Метод

Unmarshals and frees an array of HRESULTs.
public static GetStatusCodes ( IntPtr &pArray, int size, bool deallocate ) : int[]
pArray System.IntPtr
size int
deallocate bool
Результат int[]

GetSystemMessage() публичный статический Метод

Retrieves the system message text for the specified error.
public static GetSystemMessage ( int error, int localeId ) : string
error int
localeId int
Результат string

GetSystemType() публичный статический Метод

Converts the VARTYPE to a SystemType
public static GetSystemType ( short input ) : Type
input short
Результат System.Type

GetUInt32s() публичный статический Метод

Unmarshals and frees an array of 32 bit integers.
public static GetUInt32s ( IntPtr &pArray, int size, bool deallocate ) : int[]
pArray System.IntPtr
size int
deallocate bool
Результат int[]

GetUnicodeStrings() публичный статический Метод

Marshals an array of strings into a unmanaged memory buffer
public static GetUnicodeStrings ( string values ) : IntPtr
values string The array of strings to marshal
Результат System.IntPtr

GetUnicodeStrings() публичный статический Метод

Unmarshals and frees a array of unicode strings.
public static GetUnicodeStrings ( IntPtr &pArray, int size, bool deallocate ) : string[]
pArray System.IntPtr
size int
deallocate bool
Результат string[]

GetVARIANT() публичный статический Метод

Converts an object into a value that can be marshalled to a VARIANT.
public static GetVARIANT ( Variant source ) : object
source Variant The object to convert.
Результат object

GetVARIANT() публичный статический Метод

Converts an object into a value that can be marshalled to a VARIANT.
public static GetVARIANT ( object source ) : object
source object The object to convert.
Результат object

GetVARIANT() публичный статический Метод

Converts an object into a value that can be marshalled to a VARIANT.
public static GetVARIANT ( object source, TypeInfo typeInfo ) : object
source object The object to convert.
typeInfo System.Reflection.TypeInfo The type info.
Результат object

GetVARIANTs() публичный статический Метод

Marshals an array objects into an unmanaged array of VARIANTs.
public static GetVARIANTs ( object values, bool preprocess ) : IntPtr
values object An array of the objects to be marshalled
preprocess bool Whether the objects should have troublesome types removed before marhalling.
Результат System.IntPtr

GetVARIANTs() публичный статический Метод

Unmarshals an array of VARIANTs as objects.
public static GetVARIANTs ( IntPtr &pArray, int size, bool deallocate ) : object[]
pArray System.IntPtr
size int
deallocate bool
Результат object[]

GetValueRank() публичный статический Метод

Converts the VARTYPE to a UA ValueRank.
public static GetValueRank ( short input ) : int
input short
Результат int

GetVarType() публичный статический Метод

Converts the system type to a VARTYPE.
public static GetVarType ( System type ) : VarEnum
type System
Результат VarEnum

GetVarType() публичный статический Метод

Converts the TypeInfo to a VARTYPE.
public static GetVarType ( TypeInfo typeInfo ) : VarEnum
typeInfo System.Reflection.TypeInfo
Результат VarEnum

GetVarType() публичный статический Метод

Returns the VARTYPE for the value.
public static GetVarType ( object input ) : VarEnum
input object
Результат VarEnum

InitializeSecurity() публичный статический Метод

Initializes COM security.
public static InitializeSecurity ( ) : void
Результат void

IsRpcError() публичный статический Метод

Checks if the error is an RPC error.
public static IsRpcError ( Exception e ) : bool
e System.Exception
Результат bool

IsUnknownError() публичный статический Метод

Checks if the error for the exception is one of the recognized errors.
public static IsUnknownError ( Exception e ) : bool
e System.Exception
Результат bool

IsValidComType() публичный статический Метод

Returns true is the object is a valid COM type.
public static IsValidComType ( object input ) : bool
input object
Результат bool

Match() публичный статический Метод

Tests if the specified string matches the specified pattern.
public static Match ( string target, string pattern, bool caseSensitive ) : bool
target string
pattern string
caseSensitive bool
Результат bool

ProcessComValue() публичный статический Метод

Converts a COM value to something that UA clients can deal with.
public static ProcessComValue ( object value ) : object
value object
Результат object

ReleaseServer() публичный статический Метод

Releases the server if it is a true COM server.
public static ReleaseServer ( object server ) : void
server object
Результат void

SetProxySecurity() публичный статический Метод

Sets the security settings for the proxy.
public static SetProxySecurity ( object server, IntPtr pAuthInfo ) : void
server object
pAuthInfo System.IntPtr
Результат void

SetProxySecurity() публичный статический Метод

Sets the security settings for the proxy.
public static SetProxySecurity ( object server, UserIdentity user ) : void
server object
user UserIdentity
Результат void

TraceComError() публичный статический Метод

Reports an unexpected exception during a COM operation.
public static TraceComError ( Exception e, string format ) : void
e System.Exception
format string
Результат void