コード例 #1
0
        internal IntPtr ToNative(PinCollection pinCollection)
        {
            var nativeGetChaosReportDescription = new NativeTypes.FABRIC_GET_CHAOS_REPORT_DESCRIPTION();

            nativeGetChaosReportDescription.Filter            = this.Filter.ToNative(pinCollection);
            nativeGetChaosReportDescription.ContinuationToken = pinCollection.AddObject(this.ContinuationToken);
            var clientType = new NativeTypes.FABRIC_CHAOS_CLIENT_TYPE
            {
                ClientType = pinCollection.AddObject(ChaosConstants.ManagedClientTypeName)
            };

            nativeGetChaosReportDescription.Reserved = pinCollection.AddBlittable(clientType);

            return(pinCollection.AddBlittable(nativeGetChaosReportDescription));
        }
コード例 #2
0
        internal static unsafe GetChaosReportDescription CreateFromNative(IntPtr nativeRaw)
        {
            NativeTypes.FABRIC_GET_CHAOS_REPORT_DESCRIPTION native = *(NativeTypes.FABRIC_GET_CHAOS_REPORT_DESCRIPTION *)nativeRaw;

            var    filter            = ChaosReportFilter.FromNative(native.Filter);
            string continuationToken = NativeTypes.FromNativeString(native.ContinuationToken);

            var description = new GetChaosReportDescription(filter, continuationToken);

            if (native.Reserved != IntPtr.Zero)
            {
                var clientType = *((NativeTypes.FABRIC_CHAOS_CLIENT_TYPE *)native.Reserved);

                if (clientType.ClientType != IntPtr.Zero)
                {
                    description.ClientType = NativeTypes.FromNativeString(clientType.ClientType);
                }
            }

            return(description);
        }