Exemple #1
0
        internal static unsafe DeployedApplicationHealthStateChunkList CreateFromNativeList(IntPtr nativeListPtr)
        {
            var retval = new DeployedApplicationHealthStateChunkList();

            if (nativeListPtr != null)
            {
                var nativeList = (NativeTypes.FABRIC_DEPLOYED_APPLICATION_HEALTH_STATE_CHUNK_LIST *)nativeListPtr;

                var nativeItemArray = (NativeTypes.FABRIC_DEPLOYED_APPLICATION_HEALTH_STATE_CHUNK *)nativeList->Items;
                for (int i = 0; i < nativeList->Count; ++i)
                {
                    var nativeItem = *(nativeItemArray + i);
                    retval.Add(DeployedApplicationHealthStateChunk.FromNative(nativeItem));
                }

                retval.TotalCount = (long)nativeList->TotalCount;
            }

            return(retval);
        }
        internal static unsafe ApplicationHealthStateChunk FromNative(NativeTypes.FABRIC_APPLICATION_HEALTH_STATE_CHUNK nativeApplicationHealthStateChunk)
        {
            var managedApplicationHealthStateChunk = new ApplicationHealthStateChunk();

            managedApplicationHealthStateChunk.ApplicationName                      = NativeTypes.FromNativeUri(nativeApplicationHealthStateChunk.ApplicationName);
            managedApplicationHealthStateChunk.HealthState                          = (HealthState)nativeApplicationHealthStateChunk.HealthState;
            managedApplicationHealthStateChunk.ServiceHealthStateChunks             = ServiceHealthStateChunkList.CreateFromNativeList(nativeApplicationHealthStateChunk.ServiceHealthStateChunks);
            managedApplicationHealthStateChunk.DeployedApplicationHealthStateChunks = DeployedApplicationHealthStateChunkList.CreateFromNativeList(nativeApplicationHealthStateChunk.DeployedApplicationHealthStateChunks);

            if (nativeApplicationHealthStateChunk.Reserved != IntPtr.Zero)
            {
                var ex1 = (NativeTypes.FABRIC_APPLICATION_HEALTH_STATE_CHUNK_EX1 *)nativeApplicationHealthStateChunk.Reserved;
                managedApplicationHealthStateChunk.ApplicationTypeName = NativeTypes.FromNativeString(ex1->ApplicationTypeName);
            }

            return(managedApplicationHealthStateChunk);
        }