internal static M3U8TagInstance Create(M3U8Tag tag, string value)
        {
            DateTimeOffset result;

            if (DateTimeOffset.TryParse(value, (IFormatProvider)CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out result))
            {
                return((M3U8TagInstance) new DateTimeTagInstance(tag, result));
            }
            Debug.WriteLine("*** unable to parse date/time: " + value);
            return((M3U8TagInstance)null);
        }
        internal static M3U8TagInstance Create(M3U8Tag tag, string value)
        {
            int length1 = value.IndexOf('@');

            if (length1 < 0 || length1 + 1 >= value.Length)
            {
                return((M3U8TagInstance) new ByterangeTagInstance(tag, long.Parse(value, (IFormatProvider)CultureInfo.InvariantCulture), new long?()));
            }
            long length2 = long.Parse(value.Substring(0, length1), (IFormatProvider)CultureInfo.InvariantCulture);
            long num     = long.Parse(value.Substring(length1 + 1), (IFormatProvider)CultureInfo.InvariantCulture);

            return((M3U8TagInstance) new ByterangeTagInstance(tag, length2, new long?(num)));
        }
示例#3
0
        internal static M3U8TagInstance Create(M3U8Tag tag, string value)
        {
            DateTimeOffset dateTimeOffset;

            if (!DateTimeOffset.TryParse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal, out dateTimeOffset))
            {
                Debug.WriteLine("*** unable to parse date/time: " + value);

                return null;
            }

            return new DateTimeTagInstance(tag, dateTimeOffset);
        }
示例#4
0
        internal static M3U8TagInstance Create(M3U8Tag tag, string value)
        {
            // TODO: Consolidate code between ByterangeAttributeInstance and ByterangeTagInstance

            var index = value.IndexOf('@');

            if (index < 0 || index + 1 >= value.Length)
                return new ByterangeTagInstance(tag, long.Parse(value, CultureInfo.InvariantCulture), null);

            var length = long.Parse(value.Substring(0, index), CultureInfo.InvariantCulture);
            var offset = long.Parse(value.Substring(index + 1), CultureInfo.InvariantCulture);

            return new ByterangeTagInstance(tag, length, offset);
        }
        internal static ExtinfTagInstance Create(M3U8Tag tag, string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                Debug.WriteLine("*** Invalid empty #EXTINF tag");
                return(new ExtinfTagInstance(tag, new Decimal(0), (string)null));
            }
            int length = value.IndexOf(',');

            if (length < 0)
            {
                return(new ExtinfTagInstance(tag, ExtinfTagInstance.ParseDuration(value), (string)null));
            }
            Decimal duration = ExtinfTagInstance.ParseDuration(value.Substring(0, length));
            string  title    = string.Empty;

            if (length + 1 < value.Length)
            {
                title = value.Substring(length + 1).Trim();
            }
            return(new ExtinfTagInstance(tag, duration, title));
        }
示例#6
0
 public static ExtKeyTagInstance Create(M3U8Tag tag, string value)
 {
     return new ExtKeyTagInstance(tag, ParseAttributes(value, ExtKeySupport.Attributes));
 }
示例#7
0
 internal ExtKeyTagInstance(M3U8Tag tag, IEnumerable<M3U8AttributeInstance> attributes)
     : base(tag, attributes)
 { }
 public M3U8TagInstance(M3U8Tag tag)
 {
     this.Tag = tag;
 }
示例#9
0
 public ByterangeTagInstance(M3U8Tag tag, long length, long? offset)
     : base(tag)
 {
     Length = length;
     Offset = offset;
 }
示例#10
0
 ValueTagInstance(M3U8Tag tag, object value)
     : base(tag)
 {
     Value = value;
 }
示例#11
0
 public static ExtStreamInfTagInstance Create(M3U8Tag tag, string value)
 {
     return(new ExtStreamInfTagInstance(tag, AttributesTagInstance.ParseAttributes(value, ExtStreamInfSupport.Attributes)));
 }
示例#12
0
 internal static ValueTagInstance CreateLong(M3U8Tag tag, string value)
 {
     return(ValueTagInstance.Create(tag, value, (Func <string, object>)(v => (object)long.Parse(v, (IFormatProvider)CultureInfo.InvariantCulture))));
 }
示例#13
0
 internal static M3U8TagInstance Create(M3U8Tag tag, string value)
 {
     return((M3U8TagInstance) new MapTagInstance(tag));
 }
示例#14
0
 private MapTagInstance(M3U8Tag tag)
     : base(tag)
 {
 }
 public ExtinfTagInstance(M3U8Tag tag, Decimal duration, string title = null)
     : base(tag)
 {
     this.Duration = duration;
     this.Title    = title ?? string.Empty;
 }
 private static M3U8TagInstance Create(M3U8Tag tag, string value, Func <string, IEnumerable <M3U8AttributeInstance> > attributeParser)
 {
     return((M3U8TagInstance) new AttributesTagInstance(tag, AttributesTagInstance.ParseAttributes(value, attributeParser)));
 }
 public static M3U8TagInstance Create(M3U8Tag tag, string value, IDictionary <string, M3U8Attribute> attributes)
 {
     return(AttributesTagInstance.Create(tag, value, (Func <string, IEnumerable <M3U8AttributeInstance> >)(v => M3U8AttributeParserSupport.ParseAttributes(v, attributes))));
 }
 internal AttributesTagInstance(M3U8Tag tag, IEnumerable <M3U8AttributeInstance> attributes)
     : base(tag)
 {
     this.Attributes = attributes;
 }
示例#19
0
 private ValueTagInstance(M3U8Tag tag, object value)
     : base(tag)
 {
     this.Value = value;
 }
 public DateTimeTagInstance(M3U8Tag tag, DateTimeOffset dateTime)
     : base(tag)
 {
     this.DateTime = dateTime;
 }
示例#21
0
 internal static ValueTagInstance Create(M3U8Tag tag, string value, Func <string, object> valueParser)
 {
     return(new ValueTagInstance(tag, valueParser(value)));
 }
示例#22
0
 internal static ValueTagInstance Create(M3U8Tag tag, string value, Func<string, object> valueParser)
 {
     return new ValueTagInstance(tag, valueParser(value));
 }
示例#23
0
 internal ExtStreamInfTagInstance(M3U8Tag tag, IEnumerable <M3U8AttributeInstance> attributes)
     : base(tag, attributes)
 {
 }
示例#24
0
 public DateTimeTagInstance(M3U8Tag tag, DateTimeOffset dateTime)
     : base(tag)
 {
     DateTime = dateTime;
 }
 public ByterangeTagInstance(M3U8Tag tag, long length, long?offset)
     : base(tag)
 {
     this.Length = length;
     this.Offset = offset;
 }
示例#26
0
 public static M3U8TagInstance CreateInstance(M3U8Tag tag, string value)
 {
     return(new M3U8TagInstance(tag));
 }
示例#27
0
 public M3U8TagInstance(M3U8Tag tag)
 {
     Tag = tag;
 }
示例#28
0
 internal static M3U8TagInstance Create(M3U8Tag tag, string value)
 {
     return new MapTagInstance(tag);
 }
示例#29
0
 internal AttributesTagInstance(M3U8Tag tag, IEnumerable<M3U8AttributeInstance> attributes)
     : base(tag)
 {
     Attributes = attributes;
 }
示例#30
0
 internal static ValueTagInstance CreateLong(M3U8Tag tag, string value)
 {
     return Create(tag, value, v => long.Parse(v, CultureInfo.InvariantCulture));
 }
示例#31
0
 public static M3U8TagInstance Create(M3U8Tag tag, string value, IDictionary<string, M3U8Attribute> attributes)
 {
     return Create(tag, value, v => M3U8AttributeParserSupport.ParseAttributes(v, attributes));
 }
示例#32
0
 static M3U8TagInstance Create(M3U8Tag tag, string value, Func<string, IEnumerable<M3U8AttributeInstance>> attributeParser)
 {
     return new AttributesTagInstance(tag, ParseAttributes(value, attributeParser));
 }
示例#33
0
 public static M3U8TagInstance CreateInstance(M3U8Tag tag, string value)
 {
     return new M3U8TagInstance(tag);
 }
示例#34
0
 MapTagInstance(M3U8Tag tag)
     : base(tag)
 { }