Пример #1
0
        internal static unsafe SecretReference FromNative(NativeTypes.FABRIC_SECRET_REFERENCE nativeSecretReference)
        {
            var secretRef = new SecretReference();

            secretRef.Name    = NativeTypes.FromNativeString(nativeSecretReference.Name);
            secretRef.Version = NativeTypes.FromNativeString(nativeSecretReference.Version);

            return(secretRef);
        }
Пример #2
0
        internal static unsafe SecretReference[] FromNativeArray(IntPtr nativeListPtr)
        {
            if (nativeListPtr == IntPtr.Zero)
            {
                throw new ArgumentNullException(nameof(nativeListPtr));
            }

            var nativeList = (NativeTypes.FABRIC_SECRET_REFERENCE_LIST *)nativeListPtr;

            if (nativeList->Count < 0)
            {
                throw new ArgumentOutOfRangeException("nativeList.Count", "Count of the list must be equal to or greater than zero.");
            }

            var managedArray = new SecretReference[nativeList->Count];
            var nativeItems  = (NativeTypes.FABRIC_SECRET_REFERENCE *)nativeList->Items;

            for (int itemIndex = 0; itemIndex < nativeList->Count; itemIndex++)
            {
                managedArray[itemIndex] = FromNative(nativeItems[itemIndex]);
            }

            return(managedArray);
        }