internal NativeTypes.FABRIC_SECRET ToNative(PinCollection pinCollection) { var nativeSecret = new NativeTypes.FABRIC_SECRET(); nativeSecret.Name = pinCollection.AddObject(this.Name); nativeSecret.Version = pinCollection.AddObject(this.Version); nativeSecret.Value = pinCollection.AddObject(this.Value); return(nativeSecret); }
internal static unsafe Secret FromNative(NativeTypes.FABRIC_SECRET nativeSecret) { var secret = new Secret(); secret.Name = NativeTypes.FromNativeString(nativeSecret.Name); secret.Version = NativeTypes.FromNativeString(nativeSecret.Version); if (nativeSecret.Value != IntPtr.Zero) { secret.Value = NativeTypes.FromNativeToSecureString(nativeSecret.Value); } return(secret); }
internal static unsafe IntPtr ToNativeArray(PinCollection pinCollection, Secret[] secretRefs) { if (secretRefs == null) { throw new ArgumentNullException(nameof(secretRefs)); } var nativeArray = new NativeTypes.FABRIC_SECRET[secretRefs.Length]; for (int itemIndex = 0; itemIndex < secretRefs.Length; itemIndex++) { nativeArray[itemIndex] = secretRefs[itemIndex].ToNative(pinCollection); } var nativeList = new NativeTypes.FABRIC_SECRET_LIST(); nativeList.Count = (uint)secretRefs.Length; nativeList.Items = pinCollection.AddBlittable(nativeArray); return(pinCollection.AddBlittable(nativeList)); }