2021-05-20 19:28:18 +00:00
|
|
|
#nullable disable
|
|
|
|
|
2020-02-06 14:20:23 +00:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
|
2019-01-06 20:50:43 +00:00
|
|
|
using System;
|
2016-02-19 06:20:18 +00:00
|
|
|
using System.Collections.Generic;
|
2016-12-07 20:03:00 +00:00
|
|
|
using System.Globalization;
|
2016-02-19 06:20:18 +00:00
|
|
|
using System.IO;
|
2020-08-31 18:08:37 +00:00
|
|
|
using System.Net.Http;
|
2016-02-21 17:22:13 +00:00
|
|
|
using System.Text.RegularExpressions;
|
2016-02-19 06:20:18 +00:00
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
2021-06-19 16:02:33 +00:00
|
|
|
using Jellyfin.Extensions;
|
2016-02-19 06:20:18 +00:00
|
|
|
using MediaBrowser.Common.Extensions;
|
|
|
|
using MediaBrowser.Common.Net;
|
|
|
|
using MediaBrowser.Controller.LiveTv;
|
2021-06-12 20:20:35 +00:00
|
|
|
using MediaBrowser.Model.IO;
|
2020-11-02 02:23:28 +00:00
|
|
|
using MediaBrowser.Model.LiveTv;
|
2019-01-13 19:22:00 +00:00
|
|
|
using Microsoft.Extensions.Logging;
|
2016-02-19 06:20:18 +00:00
|
|
|
|
2016-11-03 23:35:19 +00:00
|
|
|
namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
|
|
|
public class M3uParser
|
|
|
|
{
|
2021-05-28 12:33:54 +00:00
|
|
|
private const string ExtInfPrefix = "#EXTINF:";
|
|
|
|
|
2016-02-19 06:20:18 +00:00
|
|
|
private readonly ILogger _logger;
|
2020-08-31 18:08:37 +00:00
|
|
|
private readonly IHttpClientFactory _httpClientFactory;
|
2016-02-19 06:20:18 +00:00
|
|
|
|
2021-05-28 12:33:54 +00:00
|
|
|
public M3uParser(ILogger logger, IHttpClientFactory httpClientFactory)
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
|
|
|
_logger = logger;
|
2020-08-31 18:08:37 +00:00
|
|
|
_httpClientFactory = httpClientFactory;
|
2016-02-19 06:20:18 +00:00
|
|
|
}
|
|
|
|
|
2020-11-02 02:23:28 +00:00
|
|
|
public async Task<List<ChannelInfo>> Parse(TunerHostInfo info, string channelIdPrefix, CancellationToken cancellationToken)
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
|
|
|
// Read the file and display it line by line.
|
2020-11-02 02:23:28 +00:00
|
|
|
using (var reader = new StreamReader(await GetListingsStream(info, cancellationToken).ConfigureAwait(false)))
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
2021-01-08 22:57:27 +00:00
|
|
|
return await GetChannelsAsync(reader, channelIdPrefix, info.Id).ConfigureAwait(false);
|
2017-01-14 03:46:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-02 02:23:28 +00:00
|
|
|
public async Task<Stream> GetListingsStream(TunerHostInfo info, CancellationToken cancellationToken)
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
2021-08-05 00:19:03 +00:00
|
|
|
if (info == null)
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
2021-08-05 00:19:03 +00:00
|
|
|
throw new ArgumentNullException(nameof(info));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!info.Url.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
2021-06-12 20:20:35 +00:00
|
|
|
return AsyncFile.OpenRead(info.Url);
|
2021-08-05 00:19:03 +00:00
|
|
|
}
|
2020-11-02 02:23:28 +00:00
|
|
|
|
2021-08-05 00:19:03 +00:00
|
|
|
using var requestMessage = new HttpRequestMessage(HttpMethod.Get, info.Url);
|
|
|
|
if (!string.IsNullOrEmpty(info.UserAgent))
|
|
|
|
{
|
|
|
|
requestMessage.Headers.UserAgent.TryParseAdd(info.UserAgent);
|
2016-02-19 06:20:18 +00:00
|
|
|
}
|
2019-08-09 21:16:24 +00:00
|
|
|
|
2021-08-06 15:07:50 +00:00
|
|
|
// Set HttpCompletionOption.ResponseHeadersRead to prevent timeouts on larger files
|
2021-08-05 00:19:03 +00:00
|
|
|
var response = await _httpClientFactory.CreateClient(NamedClient.Default)
|
|
|
|
.SendAsync(requestMessage, HttpCompletionOption.ResponseHeadersRead, cancellationToken)
|
|
|
|
.ConfigureAwait(false);
|
|
|
|
response.EnsureSuccessStatusCode();
|
|
|
|
|
|
|
|
return await response.Content.ReadAsStreamAsync(cancellationToken);
|
2016-02-19 06:20:18 +00:00
|
|
|
}
|
|
|
|
|
2021-01-08 22:57:27 +00:00
|
|
|
private async Task<List<ChannelInfo>> GetChannelsAsync(TextReader reader, string channelIdPrefix, string tunerHostId)
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
2017-08-20 19:10:00 +00:00
|
|
|
var channels = new List<ChannelInfo>();
|
2019-03-25 21:25:32 +00:00
|
|
|
string extInf = string.Empty;
|
2017-02-01 20:56:41 +00:00
|
|
|
|
2021-01-08 22:57:27 +00:00
|
|
|
await foreach (var line in reader.ReadAllLinesAsync().ConfigureAwait(false))
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
2021-01-08 22:57:27 +00:00
|
|
|
var trimmedLine = line.Trim();
|
|
|
|
if (string.IsNullOrWhiteSpace(trimmedLine))
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-01-08 22:57:27 +00:00
|
|
|
if (trimmedLine.StartsWith("#EXTM3U", StringComparison.OrdinalIgnoreCase))
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2021-01-08 22:57:27 +00:00
|
|
|
if (trimmedLine.StartsWith(ExtInfPrefix, StringComparison.OrdinalIgnoreCase))
|
2016-02-19 06:20:18 +00:00
|
|
|
{
|
2021-01-08 22:57:27 +00:00
|
|
|
extInf = trimmedLine.Substring(ExtInfPrefix.Length).Trim();
|
2016-02-19 06:20:18 +00:00
|
|
|
}
|
2021-01-08 22:57:27 +00:00
|
|
|
else if (!string.IsNullOrWhiteSpace(extInf) && !trimmedLine.StartsWith('#'))
|
2016-02-24 19:06:26 +00:00
|
|
|
{
|
2021-01-08 22:57:27 +00:00
|
|
|
var channel = GetChannelnfo(extInf, tunerHostId, trimmedLine);
|
2017-07-30 18:02:25 +00:00
|
|
|
if (string.IsNullOrWhiteSpace(channel.Id))
|
2017-01-23 21:51:23 +00:00
|
|
|
{
|
2021-01-08 22:57:27 +00:00
|
|
|
channel.Id = channelIdPrefix + trimmedLine.GetMD5().ToString("N", CultureInfo.InvariantCulture);
|
2017-01-23 21:51:23 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2019-02-28 22:22:57 +00:00
|
|
|
channel.Id = channelIdPrefix + channel.Id.GetMD5().ToString("N", CultureInfo.InvariantCulture);
|
2017-01-23 21:51:23 +00:00
|
|
|
}
|
|
|
|
|
2021-01-08 22:57:27 +00:00
|
|
|
channel.Path = trimmedLine;
|
2016-02-23 00:48:30 +00:00
|
|
|
channels.Add(channel);
|
2021-08-06 13:10:28 +00:00
|
|
|
_logger.LogInformation("Parsed channel: {ChannelName}", channel.Name);
|
2019-03-25 21:25:32 +00:00
|
|
|
extInf = string.Empty;
|
2016-02-19 06:20:18 +00:00
|
|
|
}
|
|
|
|
}
|
2017-02-01 20:56:41 +00:00
|
|
|
|
2016-02-19 06:20:18 +00:00
|
|
|
return channels;
|
|
|
|
}
|
2016-11-27 20:52:24 +00:00
|
|
|
|
2017-08-20 19:10:00 +00:00
|
|
|
private ChannelInfo GetChannelnfo(string extInf, string tunerHostId, string mediaUrl)
|
2016-02-23 00:48:30 +00:00
|
|
|
{
|
2019-03-25 21:25:32 +00:00
|
|
|
var channel = new ChannelInfo()
|
|
|
|
{
|
|
|
|
TunerHostId = tunerHostId
|
|
|
|
};
|
2016-02-23 00:48:30 +00:00
|
|
|
|
2016-11-27 20:52:24 +00:00
|
|
|
extInf = extInf.Trim();
|
2016-02-23 00:48:30 +00:00
|
|
|
|
2019-01-17 17:47:41 +00:00
|
|
|
var attributes = ParseExtInf(extInf, out string remaining);
|
2016-12-07 20:03:00 +00:00
|
|
|
extInf = remaining;
|
2016-11-27 20:52:24 +00:00
|
|
|
|
2019-01-17 17:47:41 +00:00
|
|
|
if (attributes.TryGetValue("tvg-logo", out string value))
|
2016-12-07 20:03:00 +00:00
|
|
|
{
|
|
|
|
channel.ImageUrl = value;
|
|
|
|
}
|
2016-11-27 20:52:24 +00:00
|
|
|
|
2021-03-20 19:15:19 +00:00
|
|
|
if (attributes.TryGetValue("group-title", out string groupTitle))
|
|
|
|
{
|
|
|
|
channel.ChannelGroup = groupTitle;
|
|
|
|
}
|
|
|
|
|
2016-12-07 20:03:00 +00:00
|
|
|
channel.Name = GetChannelName(extInf, attributes);
|
|
|
|
channel.Number = GetChannelNumber(extInf, attributes, mediaUrl);
|
2016-11-27 20:52:24 +00:00
|
|
|
|
2019-01-17 17:47:41 +00:00
|
|
|
attributes.TryGetValue("tvg-id", out string tvgId);
|
2017-02-23 19:13:26 +00:00
|
|
|
|
2019-01-17 17:47:41 +00:00
|
|
|
attributes.TryGetValue("channel-id", out string channelId);
|
2017-02-23 19:13:26 +00:00
|
|
|
|
|
|
|
channel.TunerChannelId = string.IsNullOrWhiteSpace(tvgId) ? channelId : tvgId;
|
|
|
|
|
|
|
|
var channelIdValues = new List<string>();
|
2017-02-04 23:32:16 +00:00
|
|
|
if (!string.IsNullOrWhiteSpace(channelId))
|
2017-01-23 21:51:23 +00:00
|
|
|
{
|
2017-02-23 19:13:26 +00:00
|
|
|
channelIdValues.Add(channelId);
|
|
|
|
}
|
2019-03-25 21:25:32 +00:00
|
|
|
|
2017-02-23 19:13:26 +00:00
|
|
|
if (!string.IsNullOrWhiteSpace(tvgId))
|
|
|
|
{
|
|
|
|
channelIdValues.Add(tvgId);
|
|
|
|
}
|
2019-03-25 21:25:32 +00:00
|
|
|
|
2017-02-23 19:13:26 +00:00
|
|
|
if (channelIdValues.Count > 0)
|
|
|
|
{
|
2021-02-12 23:39:18 +00:00
|
|
|
channel.Id = string.Join('_', channelIdValues);
|
2017-01-23 21:51:23 +00:00
|
|
|
}
|
|
|
|
|
2016-11-27 20:52:24 +00:00
|
|
|
return channel;
|
|
|
|
}
|
|
|
|
|
2016-12-07 20:03:00 +00:00
|
|
|
private string GetChannelNumber(string extInf, Dictionary<string, string> attributes, string mediaUrl)
|
2016-11-27 20:52:24 +00:00
|
|
|
{
|
2020-11-14 14:54:50 +00:00
|
|
|
var nameParts = extInf.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
2020-07-22 11:34:51 +00:00
|
|
|
var nameInExtInf = nameParts.Length > 1 ? nameParts[^1].AsSpan().Trim() : ReadOnlySpan<char>.Empty;
|
2016-11-27 20:52:24 +00:00
|
|
|
|
2017-01-14 03:46:02 +00:00
|
|
|
string numberString = null;
|
2019-02-11 09:11:07 +00:00
|
|
|
string attributeValue;
|
2016-11-27 20:52:24 +00:00
|
|
|
|
2019-02-11 09:11:07 +00:00
|
|
|
if (attributes.TryGetValue("tvg-chno", out attributeValue))
|
2016-02-23 00:48:30 +00:00
|
|
|
{
|
2020-07-22 11:34:51 +00:00
|
|
|
if (double.TryParse(attributeValue, NumberStyles.Any, CultureInfo.InvariantCulture, out _))
|
2016-02-23 00:48:30 +00:00
|
|
|
{
|
2019-02-11 09:11:07 +00:00
|
|
|
numberString = attributeValue;
|
2016-02-23 00:48:30 +00:00
|
|
|
}
|
|
|
|
}
|
2016-08-30 18:17:37 +00:00
|
|
|
|
2017-02-04 23:32:16 +00:00
|
|
|
if (!IsValidChannelNumber(numberString))
|
2016-08-30 18:17:37 +00:00
|
|
|
{
|
2019-02-11 09:11:07 +00:00
|
|
|
if (attributes.TryGetValue("tvg-id", out attributeValue))
|
2016-12-07 20:03:00 +00:00
|
|
|
{
|
2020-07-22 11:34:51 +00:00
|
|
|
if (double.TryParse(attributeValue, NumberStyles.Any, CultureInfo.InvariantCulture, out _))
|
2017-01-14 03:46:02 +00:00
|
|
|
{
|
2019-02-11 09:11:07 +00:00
|
|
|
numberString = attributeValue;
|
|
|
|
}
|
|
|
|
else if (attributes.TryGetValue("channel-id", out attributeValue))
|
2017-01-14 03:46:02 +00:00
|
|
|
{
|
2020-07-22 11:34:51 +00:00
|
|
|
if (double.TryParse(attributeValue, NumberStyles.Any, CultureInfo.InvariantCulture, out _))
|
2019-02-11 09:11:07 +00:00
|
|
|
{
|
|
|
|
numberString = attributeValue;
|
|
|
|
}
|
2017-01-14 03:46:02 +00:00
|
|
|
}
|
2016-12-07 20:03:00 +00:00
|
|
|
}
|
|
|
|
|
2020-07-22 11:34:51 +00:00
|
|
|
if (string.IsNullOrWhiteSpace(numberString))
|
2016-12-07 20:03:00 +00:00
|
|
|
{
|
2019-02-11 09:11:07 +00:00
|
|
|
// Using this as a fallback now as this leads to Problems with channels like "5 USA"
|
2022-08-15 10:48:34 +00:00
|
|
|
// where 5 isn't meant to be the channel number
|
2019-02-11 09:11:07 +00:00
|
|
|
// Check for channel number with the format from SatIp
|
|
|
|
// #EXTINF:0,84. VOX Schweiz
|
|
|
|
// #EXTINF:0,84.0 - VOX Schweiz
|
2020-07-22 11:34:51 +00:00
|
|
|
if (!nameInExtInf.IsEmpty && !nameInExtInf.IsWhiteSpace())
|
2019-02-11 09:11:07 +00:00
|
|
|
{
|
|
|
|
var numberIndex = nameInExtInf.IndexOf(' ');
|
|
|
|
if (numberIndex > 0)
|
|
|
|
{
|
2020-07-22 11:34:51 +00:00
|
|
|
var numberPart = nameInExtInf.Slice(0, numberIndex).Trim(new[] { ' ', '.' });
|
2019-02-11 09:11:07 +00:00
|
|
|
|
2020-07-22 11:34:51 +00:00
|
|
|
if (double.TryParse(numberPart, NumberStyles.Any, CultureInfo.InvariantCulture, out _))
|
2019-02-11 09:11:07 +00:00
|
|
|
{
|
2020-07-22 11:34:51 +00:00
|
|
|
numberString = numberPart.ToString();
|
2019-02-11 09:11:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-12-07 20:03:00 +00:00
|
|
|
}
|
2016-08-30 18:17:37 +00:00
|
|
|
}
|
|
|
|
|
2017-02-04 23:32:16 +00:00
|
|
|
if (!IsValidChannelNumber(numberString))
|
2016-11-27 20:52:24 +00:00
|
|
|
{
|
|
|
|
numberString = null;
|
|
|
|
}
|
2016-10-18 18:23:41 +00:00
|
|
|
|
2016-12-07 20:03:00 +00:00
|
|
|
if (!string.IsNullOrWhiteSpace(numberString))
|
|
|
|
{
|
|
|
|
numberString = numberString.Trim();
|
2016-08-30 18:17:37 +00:00
|
|
|
}
|
2019-02-11 09:11:07 +00:00
|
|
|
else
|
2016-10-18 18:23:41 +00:00
|
|
|
{
|
2016-11-27 20:52:24 +00:00
|
|
|
if (string.IsNullOrWhiteSpace(mediaUrl))
|
|
|
|
{
|
|
|
|
numberString = null;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2017-06-06 06:13:49 +00:00
|
|
|
try
|
|
|
|
{
|
2021-09-19 18:53:31 +00:00
|
|
|
numberString = Path.GetFileNameWithoutExtension(mediaUrl.AsSpan().RightPart('/')).ToString();
|
2016-12-07 20:03:00 +00:00
|
|
|
|
2017-06-06 06:13:49 +00:00
|
|
|
if (!IsValidChannelNumber(numberString))
|
|
|
|
{
|
|
|
|
numberString = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch
|
2016-12-07 20:03:00 +00:00
|
|
|
{
|
2017-06-06 06:13:49 +00:00
|
|
|
// Seeing occasional argument exception here
|
2016-12-07 20:03:00 +00:00
|
|
|
numberString = null;
|
|
|
|
}
|
2016-11-27 20:52:24 +00:00
|
|
|
}
|
2016-10-18 18:23:41 +00:00
|
|
|
}
|
|
|
|
|
2016-11-27 20:52:24 +00:00
|
|
|
return numberString;
|
|
|
|
}
|
2016-10-18 18:23:41 +00:00
|
|
|
|
2019-01-06 20:50:43 +00:00
|
|
|
private static bool IsValidChannelNumber(string numberString)
|
2017-02-04 23:32:16 +00:00
|
|
|
{
|
|
|
|
if (string.IsNullOrWhiteSpace(numberString) ||
|
|
|
|
string.Equals(numberString, "-1", StringComparison.OrdinalIgnoreCase) ||
|
|
|
|
string.Equals(numberString, "0", StringComparison.OrdinalIgnoreCase))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-07-22 11:34:51 +00:00
|
|
|
if (!double.TryParse(numberString, NumberStyles.Any, CultureInfo.InvariantCulture, out _))
|
2017-02-04 23:32:16 +00:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-01-06 20:50:43 +00:00
|
|
|
private static string GetChannelName(string extInf, Dictionary<string, string> attributes)
|
2016-11-27 20:52:24 +00:00
|
|
|
{
|
2020-11-14 14:54:50 +00:00
|
|
|
var nameParts = extInf.Split(',', StringSplitOptions.RemoveEmptyEntries);
|
|
|
|
var nameInExtInf = nameParts.Length > 1 ? nameParts[^1].Trim() : null;
|
2016-11-27 20:52:24 +00:00
|
|
|
|
2017-01-14 04:31:43 +00:00
|
|
|
// Check for channel number with the format from SatIp
|
|
|
|
// #EXTINF:0,84. VOX Schweiz
|
|
|
|
// #EXTINF:0,84.0 - VOX Schweiz
|
2016-11-27 20:52:24 +00:00
|
|
|
if (!string.IsNullOrWhiteSpace(nameInExtInf))
|
2016-10-18 18:23:41 +00:00
|
|
|
{
|
2021-11-15 14:57:07 +00:00
|
|
|
var numberIndex = nameInExtInf.IndexOf(' ', StringComparison.Ordinal);
|
2016-11-27 20:52:24 +00:00
|
|
|
if (numberIndex > 0)
|
|
|
|
{
|
2017-01-14 04:31:43 +00:00
|
|
|
var numberPart = nameInExtInf.Substring(0, numberIndex).Trim(new[] { ' ', '.' });
|
|
|
|
|
2020-07-22 11:34:51 +00:00
|
|
|
if (double.TryParse(numberPart, NumberStyles.Any, CultureInfo.InvariantCulture, out _))
|
2016-11-27 20:52:24 +00:00
|
|
|
{
|
2020-06-14 09:11:11 +00:00
|
|
|
// channel.Number = number.ToString();
|
2017-01-14 04:31:43 +00:00
|
|
|
nameInExtInf = nameInExtInf.Substring(numberIndex + 1).Trim(new[] { ' ', '-' });
|
2016-11-27 20:52:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-08-31 12:12:09 +00:00
|
|
|
string name = nameInExtInf;
|
2016-12-07 20:03:00 +00:00
|
|
|
|
2016-11-27 20:52:24 +00:00
|
|
|
if (string.IsNullOrWhiteSpace(name))
|
|
|
|
{
|
2021-08-31 12:12:09 +00:00
|
|
|
attributes.TryGetValue("tvg-name", out name);
|
2016-10-18 18:23:41 +00:00
|
|
|
}
|
|
|
|
|
2016-11-27 20:52:24 +00:00
|
|
|
if (string.IsNullOrWhiteSpace(name))
|
2016-10-18 18:23:41 +00:00
|
|
|
{
|
2019-01-19 21:04:09 +00:00
|
|
|
attributes.TryGetValue("tvg-id", out name);
|
2016-10-18 18:23:41 +00:00
|
|
|
}
|
|
|
|
|
2016-11-27 20:52:24 +00:00
|
|
|
if (string.IsNullOrWhiteSpace(name))
|
|
|
|
{
|
|
|
|
name = null;
|
|
|
|
}
|
2016-02-23 00:48:30 +00:00
|
|
|
|
2016-11-27 20:52:24 +00:00
|
|
|
return name;
|
2016-02-23 00:48:30 +00:00
|
|
|
}
|
2016-11-27 20:52:24 +00:00
|
|
|
|
2019-01-06 20:50:43 +00:00
|
|
|
private static Dictionary<string, string> ParseExtInf(string line, out string remaining)
|
2016-02-21 17:22:13 +00:00
|
|
|
{
|
2016-12-07 20:03:00 +00:00
|
|
|
var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
2016-02-21 17:22:13 +00:00
|
|
|
var reg = new Regex(@"([a-z0-9\-_]+)=\""([^""]+)\""", RegexOptions.IgnoreCase);
|
2016-12-07 20:03:00 +00:00
|
|
|
var matches = reg.Matches(line);
|
2017-01-14 19:57:08 +00:00
|
|
|
|
|
|
|
remaining = line;
|
|
|
|
|
2016-02-21 17:22:13 +00:00
|
|
|
foreach (Match match in matches)
|
|
|
|
{
|
2017-01-14 19:57:08 +00:00
|
|
|
var key = match.Groups[1].Value;
|
|
|
|
var value = match.Groups[2].Value;
|
2016-12-07 20:03:00 +00:00
|
|
|
|
2017-01-14 19:57:08 +00:00
|
|
|
dict[match.Groups[1].Value] = match.Groups[2].Value;
|
|
|
|
remaining = remaining.Replace(key + "=\"" + value + "\"", string.Empty, StringComparison.OrdinalIgnoreCase);
|
2016-12-07 20:03:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return dict;
|
2016-02-21 17:22:13 +00:00
|
|
|
}
|
2016-02-19 06:20:18 +00:00
|
|
|
}
|
2018-12-13 13:18:25 +00:00
|
|
|
}
|