public RelayRequest(IEnumerable<string> requests)
{
this.Uri = null;
this.PCPVersion = null;
this.StreamPos = null;
this.UserAgent = null;
foreach (var req in requests) {
Match match = null;
if ((match = Regex.Match(req, @"^GET (\S+) HTTP/1.\d$")).Success) {
Uri uri;
if (Uri.TryCreate(new Uri("http://localhost/"), match.Groups[1].Value, out uri)) {
this.Uri = uri;
}
else {
this.Uri = null;
}
}
else if ((match = Regex.Match(req, @"^x-peercast-pcp:\s*(\d+)\s*$", RegexOptions.IgnoreCase)).Success) {
this.PCPVersion = Int32.Parse(match.Groups[1].Value);
}
else if ((match = Regex.Match(req, @"^x-peercast-pos:\s*(\d+)\s*$", RegexOptions.IgnoreCase)).Success) {
this.StreamPos = Int64.Parse(match.Groups[1].Value);
}
else if ((match = Regex.Match(req, @"^User-Agent:\s*(.*)\s*$", RegexOptions.IgnoreCase)).Success) {
this.UserAgent = match.Groups[1].Value;
}
}
}
}