using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Text;
using MindWorks.Nimbus;
using Ivi.Driver;

namespace Raytheon.GuidedElectronicsUnit
{
    public struct RxSdlcMessage
    {
        public RxSdlcMessage(List<RxSdlcData> data) { MessageData = data.ToArray(); }

        public RxSdlcData[] MessageData { get; internal set; }

        public uint[] ToDataArray
        {
            get
            {
                List<uint> data = new List<uint>();

                foreach (RxSdlcData val in MessageData)
                {
                    data.Add(val.Data);
                }

                return data.ToArray();
            }
        }

        public MessageEnumerator GetEnumerator()
        {
            return new MessageEnumerator(this);
        }

        // Declare the enumerator class:  
        public class MessageEnumerator
        {
            int nIndex;
            RxSdlcMessage message;
            public MessageEnumerator(RxSdlcMessage coll)
            {
                message = coll;
                nIndex = -1;
            }

            public bool MoveNext()
            {
                nIndex++;
                return (nIndex < message.MessageData.Length);
            }

            public RxSdlcData Current => message.MessageData[nIndex];
        }
    }
}