コード例 #1
0
        public static TValue?AttributeValue <TValue>(this M3U8TagInstance tagInstance, M3U8ValueAttribute <TValue> attribute) where TValue : struct
        {
            M3U8AttributeValueInstance <TValue> attributeValueInstance = M3U8TagInstanceExtensions.Attribute <TValue>(tagInstance, attribute);

            if (null == attributeValueInstance)
            {
                return(new TValue?());
            }
            return(new TValue?(attributeValueInstance.Value));
        }
コード例 #2
0
        public static TValue AttributeObject <TValue>(this M3U8TagInstance tagInstance, M3U8ValueAttribute <TValue> attribute) where TValue : class
        {
            M3U8AttributeValueInstance <TValue> attributeValueInstance = M3U8TagInstanceExtensions.Attribute <TValue>(tagInstance, attribute);

            if (null == attributeValueInstance)
            {
                return(default(TValue));
            }
            return(attributeValueInstance.Value);
        }
コード例 #3
0
        public static IEnumerable <M3U8AttributeInstance> Attributes(this M3U8TagInstance tagInstance)
        {
            AttributesTagInstance attributesTagInstance = tagInstance as AttributesTagInstance;

            if (null == attributesTagInstance)
            {
                return(M3U8TagInstanceExtensions.NoAttributeInstances);
            }
            return(attributesTagInstance.Attributes);
        }
コード例 #4
0
        private void HandleExt(string line)
        {
            int    length  = line.IndexOf(':');
            string tagName = line;
            string str     = (string)null;

            if (length > 3)
            {
                tagName = line.Substring(0, length);
                if (length + 1 < line.Length)
                {
                    str = line.Substring(length + 1);
                }
            }
            M3U8TagInstance tagInstance = M3U8Tags.Default.Create(tagName, str);

            if (null == tagInstance)
            {
                return;
            }
            switch (tagInstance.Tag.Scope)
            {
            case M3U8TagScope.Global:
                if (1 == this._lineNumber && tagInstance.Tag == M3U8Tags.ExtM3UMarker)
                {
                    this._hasMarker = true;
                }
                this._globalTags.Add(tagInstance);
                break;

            case M3U8TagScope.Shared:
                this.ResolveShared(tagInstance);
                break;

            case M3U8TagScope.Segment:
                this._tags.Add(tagInstance);
                break;
            }
        }
コード例 #5
0
 public static M3U8AttributeValueInstance <TValue> Attribute <TValue>(this M3U8TagInstance tagInstance, M3U8ValueAttribute <TValue> attribute, TValue value) where TValue : IEquatable <TValue>
 {
     return(Enumerable.FirstOrDefault <M3U8AttributeValueInstance <TValue> >(Enumerable.OfType <M3U8AttributeValueInstance <TValue> >((IEnumerable)M3U8TagInstanceExtensions.Attributes(tagInstance)), (Func <M3U8AttributeValueInstance <TValue>, bool>)(a => a.Attribute == (M3U8Attribute)attribute && a.Value.Equals(value))));
 }
コード例 #6
0
 public static IEnumerable <M3U8AttributeValueInstance <TValue> > Attributes <TValue>(this M3U8TagInstance tagInstance, M3U8ValueAttribute <TValue> attribute)
 {
     return(Enumerable.Where <M3U8AttributeValueInstance <TValue> >(Enumerable.OfType <M3U8AttributeValueInstance <TValue> >((IEnumerable)M3U8TagInstanceExtensions.Attributes(tagInstance)), (Func <M3U8AttributeValueInstance <TValue>, bool>)(a => a.Attribute == (M3U8Attribute)attribute)));
 }
コード例 #7
0
 public static TInstance AttributeInstance <TInstance>(this M3U8TagInstance tagInstance, M3U8Attribute attribute) where TInstance : M3U8AttributeInstance
 {
     return(Enumerable.FirstOrDefault <M3U8AttributeInstance>(M3U8TagInstanceExtensions.Attributes(tagInstance), (Func <M3U8AttributeInstance, bool>)(a => a.Attribute == attribute)) as TInstance);
 }
コード例 #8
0
 public static IEnumerable <M3U8AttributeInstance> Attributes(this M3U8TagInstance tagInstance, M3U8Attribute attribute)
 {
     return(Enumerable.Where <M3U8AttributeInstance>(M3U8TagInstanceExtensions.Attributes(tagInstance), (Func <M3U8AttributeInstance, bool>)(a => a.Attribute == attribute)));
 }
コード例 #9
0
 private void ResolveShared(M3U8TagInstance tagInstance)
 {
     this._sharedTags.Add(tagInstance);
 }