Ejemplo n.º 1
0
        public void Register(M3U8Attribute attribute)
        {
            IDictionary <string, M3U8Attribute> dictionary1 = this._attributes;

            while (true)
            {
                Dictionary <string, M3U8Attribute> dictionary2 = new Dictionary <string, M3U8Attribute>(dictionary1);
                dictionary2[attribute.Name] = attribute;
                IDictionary <string, M3U8Attribute> dictionary3 = Interlocked.CompareExchange <IDictionary <string, M3U8Attribute> >(ref this._attributes, (IDictionary <string, M3U8Attribute>)dictionary2, dictionary1);
                if (dictionary3 != dictionary1)
                {
                    dictionary1 = dictionary3;
                }
                else
                {
                    break;
                }
            }
        }
 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);
 }
 public static IEnumerable <M3U8AttributeInstance> Attributes(this M3U8TagInstance tagInstance, M3U8Attribute attribute)
 {
     return(Enumerable.Where <M3U8AttributeInstance>(M3U8TagInstanceExtensions.Attributes(tagInstance), (Func <M3U8AttributeInstance, bool>)(a => a.Attribute == attribute)));
 }