Ejemplo n.º 1
0
        public BitArray(IEnumerable <byte> inputByteList, int byteLength)
        {
            intraBitArray = new List <bool>();
            Func <byte, List <bool> > transformByteToListBools = new Func <byte, List <bool> >((element) => {
                List <bool> tempList = new List <bool>();
                for (int i = 0; i < byteLength; i++)
                {
                    tempList.Add(false);
                }
                for (int i = 0; i < byteLength; i++)
                {
                    tempList[i] = FirstSectionOfOperations.getIbit(element, i) == 1 ? true : false;
                }
                tempList.Reverse();
                return(tempList);
            });

            inputByteList = inputByteList.Reverse().ToList();
            intraBitArray = (from element in inputByteList.AsParallel() select transformByteToListBools(element)).SelectMany(x => x).ToList();
            IsReadOnly    = false;
        }
Ejemplo n.º 2
0
        public void getBitArrayFromByteArr(List <byte> inputArray)
        {
            intraBitArray = new List <bool>();
            Func <byte, List <bool> > transformByteToListBools = new Func <byte, List <bool> >((element) =>
            {
                var tempList = new List <bool>()
                {
                    false, false, false, false, false, false, false, false
                };
                for (int i = 0; i < 8; i++)
                {
                    tempList[i] = FirstSectionOfOperations.getIbit(element, i) == 1 ? true : false;
                }
                tempList.Reverse();
                return(tempList);
            });

            inputArray.Reverse();
            intraBitArray = (from element in inputArray.AsParallel() select transformByteToListBools(element)).SelectMany(x => x).ToList();

            IsReadOnly = false;
        }