コード例 #1
0
 internal EbmlGeneric FindRecursive(ulong id, List <EbmlGeneric> list)
 {
     foreach (EbmlGeneric m in list)
     {
         if (m.Id == id)
         {
             return(m);
         }
         if (m is EbmlMaster)
         {
             EbmlGeneric res = FindRecursive(id, ((EbmlMaster)m).Value);
             if (res != null)
             {
                 return(res);
             }
         }
     }
     return(null);
 }
コード例 #2
0
        public override void Read(BinaryReader reader, ulong baselength = 0)
        {
            InputOffset = (ulong)reader.BaseStream.Position - (ulong)MatroskaExtensions.IdSize(Id);
            ulong length;

            if (baselength == 0)
            {
                reader.Ebml_Read_Length(out length);
            }
            else
            {
                length = baselength;
            }
            InputValueOffset = (ulong)reader.BaseStream.Position;
            while (length > 0)
            {
                ulong coffset = (ulong)reader.BaseStream.Position;
                ulong head;
                reader.Ebml_Read_Id(4, out head);
                bool found            = false;
                List <EbmlGeneric> ls = new List <EbmlGeneric>();
                ls.AddRange(Available);
                ls.AddRange(Container.General);
                foreach (EbmlGeneric k in ls)
                {
                    if (k.Id == head)
                    {
                        EbmlGeneric c = k.New();
                        Value.Add(c);
                        c.Read(reader);
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    throw new IOException(string.Format("Unknown header {0:X}", head));
                }
                length -= (ulong)reader.BaseStream.Position - coffset;
            }
            Value.Sort();
        }
コード例 #3
0
        public virtual int CompareTo(object obj)
        {
            EbmlGeneric m   = (EbmlGeneric)obj;
            int         res = Weight.CompareTo(m.Weight);

            if (res != 0)
            {
                return(res);
            }
            if (Weight == -1)
            {
                return(InputOffset.CompareTo(m.InputOffset));
            }
            res = Id.CompareTo(m.Id);
            if (res != 0)
            {
                return(res);
            }
            return(InputOffset.CompareTo(m.InputOffset));
        }