Example #1
0
        private List <List <ushort> > FindCommRegion(ushort[] tableRegion)
        {
            ESearchStateMachine eSearchSM = (int)ESearchStateMachine.FindStart;

            List <List <ushort> > listlistTable = new List <List <ushort> >();
            List <ushort>         listTable     = new List <ushort>();

            listTable.Clear();
            listlistTable.Clear();
            for (int i = 0; i < tableRegion.Length; i++)
            {
                switch (eSearchSM)
                {
                case ESearchStateMachine.FindStart:
                    if (tableRegion[i] != 0)
                    {
                        listTable.Add((ushort)i);
                        eSearchSM = ESearchStateMachine.Finded;
                    }
                    break;

                case ESearchStateMachine.Finded:
                    if (tableRegion[i] == 0)
                    {    //结束
                        eSearchSM = ESearchStateMachine.FindStart;
                        listlistTable.Add(listTable);
                        listTable = new List <ushort>();
                        listTable.Clear();
                        //comm
                    }
                    else
                    {
                        listTable.Add((ushort)i);
                    }
                    break;

                default:
                    break;
                }
            }
            if (eSearchSM == ESearchStateMachine.Finded)
            {
                listlistTable.Add(listTable);
            }
            return(listlistTable);
        }
Example #2
0
 public CT2List()
 {
     eSearchSM = ESearchStateMachine.Idle;
 }