internal static unsafe NodeDeactivationResult CreateFromNative(
            NativeTypes.FABRIC_NODE_DEACTIVATION_QUERY_RESULT_ITEM nativeResult)
        {
            IList <NodeDeactivationTask> tasks = new List <NodeDeactivationTask>();
            IList <SafetyCheck>          pendingSafetyChecks = new List <SafetyCheck>();

            var nativeTasks     = (NativeTypes.FABRIC_NODE_DEACTIVATION_TASK_LIST *)nativeResult.Tasks;
            var nativeItemArray = (NativeTypes.FABRIC_NODE_DEACTIVATION_TASK *)nativeTasks->Items;

            for (int i = 0; i < nativeTasks->Count; ++i)
            {
                var nativeItem = *(nativeItemArray + i);
                tasks.Add(NodeDeactivationTask.CreateFromNative(nativeItem));
            }

            if (nativeResult.Reserved != IntPtr.Zero)
            {
                var ex1 = (NativeTypes.FABRIC_NODE_DEACTIVATION_QUERY_RESULT_ITEM_EX1 *)nativeResult.Reserved;
                pendingSafetyChecks = SafetyCheck.FromNativeList(
                    (NativeTypes.FABRIC_SAFETY_CHECK_LIST *)ex1->PendingSafetyChecks);
            }

            var nodeDeactivationResult = new NodeDeactivationResult(
                (NodeDeactivationIntent)nativeResult.EffectiveIntent,
                (NodeDeactivationStatus)nativeResult.Status,
                tasks,
                pendingSafetyChecks);

            return(nodeDeactivationResult);
        }
Exemplo n.º 2
0
        internal static unsafe NodeDeactivationTask CreateFromNative(
            NativeTypes.FABRIC_NODE_DEACTIVATION_TASK nativeResult)
        {
            var task = new NodeDeactivationTask(
                NodeDeactivationTaskId.CreateFromNative(*(NativeTypes.FABRIC_NODE_DEACTIVATION_TASK_ID *)nativeResult.TaskId),
                (NodeDeactivationIntent)nativeResult.Intent);

            return(task);
        }