Пример #1
0
        public void Write(BinaryWriter w)
        {
            if (IsNull)
            {
                throw new HierarchyIdException("Instance cannot be Null");
            }
            if (w == null)
            {
                throw new ArgumentNullException(nameof(w));
            }
            BitWriter bw = new BitWriter(w);

            var nodes = this._imp.GetNodes();

            for (int i = 0; i < nodes.Length; i++)
            {
                var subNodes = nodes[i];
                for (int j = 0; j < subNodes.Length; j++)
                {
                    int val = subNodes[j];

                    BitPattern p = KnownPatterns.GetPatternByValue(val);

                    bool isLast = j == (subNodes.Length - 1);

                    ulong value = p.EncodeValue(val, isLast);

                    bw.Write(value, p.BitLength);
                }
            }

            bw.Finish();
        }
Пример #2
0
 public ProfilePattern(int profile_idc, BitPattern profile_iop, int profile)
 {
     ProfileIdc = profile_idc;
     ProfileIop = profile_iop;
     Profile    = profile;
 }