Exemplo n.º 1
0
        public FUnversionedHeader(BinaryReader reader)
        {
            FFragment fragment;
            int       zeroMaskNum = 0;
            uint      unmaskedNum = 0;

            do
            {
                fragment = new FFragment(reader.ReadUInt16());

                Fragments.Add(fragment);
                if (fragment.HasAnyZeroes)
                {
                    zeroMaskNum += fragment.ValueNum;
                }
                else
                {
                    unmaskedNum += fragment.ValueNum;
                }
            } while (!fragment.IsLast);

            if (zeroMaskNum > 0)
            {
                LoadZeroMaskData(reader, zeroMaskNum, out ZeroMask);
                HasNonZeroValues = unmaskedNum > 0 || ZeroMask.Contains(false);
            }
            else
            {
                ZeroMask         = new BitArray(0);
                HasNonZeroValues = unmaskedNum > 0;
            }
        }
Exemplo n.º 2
0
        public FUnversionedHeader(FArchive Ar)
        {
            var fragments = new List <FFragment>();

            FFragment fragment;
            var       zeroMaskNum = 0;
            uint      unmaskedNum = 0;

            do
            {
                fragment = new FFragment(Ar.Read <ushort>());
                fragments.Add(fragment);

                if (fragment.HasAnyZeroes)
                {
                    zeroMaskNum += fragment.ValueNum;
                }
                else
                {
                    unmaskedNum += fragment.ValueNum;
                }
            } while (!fragment.IsLast);

            if (zeroMaskNum > 0)
            {
                LoadZeroMaskData(Ar, zeroMaskNum, out ZeroMask);
                HasNonZeroValues = unmaskedNum > 0 || ZeroMask.Contains(false);
            }
            else
            {
                ZeroMask         = new BitArray(0);
                HasNonZeroValues = unmaskedNum > 0;
            }
            Fragments = fragments;
        }