コード例 #1
0
ファイル: FeedFinder.cs プロジェクト: JoeGilkey/RadioLog
        public FeedFinder(string sourceUrl, ProcessUrlCompleteDelegate callback)
        {
            this._sourceUrl = GetCorrectedStreamURL(sourceUrl);
            this._callback  = callback;

            try
            {
                Uri tmpUri = new Uri(this._sourceUrl);
                _sourcePrefix = tmpUri.Scheme + Uri.SchemeDelimiter + tmpUri.Host;
            }
            catch
            {
                _sourcePrefix = string.Empty;
            }

            if (!string.IsNullOrWhiteSpace(sourceUrl))
            {
                if (sourceUrl.ToLower().Contains("liveatc.net"))
                {
                    _isLiveATC = true;
                }
                if (sourceUrl.ToLower().Contains("broadcastify.com/listen/feed"))
                {
                    _isBroadcastify = true;
                    try
                    {
                        Uri    tmpUri = new Uri(sourceUrl);
                        string path   = tmpUri.AbsolutePath;
                        if (path.EndsWith("/"))
                        {
                            path = path.Substring(0, path.Length - 1);
                        }
                        int indx = path.LastIndexOf('/');
                        if (indx >= 0)
                        {
                            path = path.Substring(indx + 1);
                        }
                        _broadcastifyFeedId = path;
                        _broadcastifyPrefix = tmpUri.Scheme + Uri.SchemeDelimiter + tmpUri.Host;
                    }
                    catch
                    {
                        _isBroadcastify = false;
                    }
                }
                else if (sourceUrl.ToLower().Contains("broadcastify.com/listen"))
                {
                    _isBroadcastify = true;
                    try
                    {
                        Uri tmpUri = new Uri(sourceUrl);
                        _broadcastifyPrefix = tmpUri.Scheme + Uri.SchemeDelimiter + tmpUri.Host;
                    }
                    catch
                    {
                        _isBroadcastify = false;
                    }
                }
            }
        }
コード例 #2
0
ファイル: FeedFinder.cs プロジェクト: JoeGilkey/RadioLog
        public FeedFinder(string sourceUrl, ProcessUrlCompleteDelegate callback)
        {
            this._sourceUrl = GetCorrectedStreamURL(sourceUrl);
            this._callback = callback;

            try
            {
                Uri tmpUri = new Uri(this._sourceUrl);
                _sourcePrefix = tmpUri.Scheme + Uri.SchemeDelimiter + tmpUri.Host;
            }
            catch
            {
                _sourcePrefix = string.Empty;
            }

            if (!string.IsNullOrWhiteSpace(sourceUrl))
            {
                if (sourceUrl.ToLower().Contains("liveatc.net"))
                {
                    _isLiveATC = true;
                }
                if (sourceUrl.ToLower().Contains("broadcastify.com/listen/feed"))
                {
                    _isBroadcastify = true;
                    try
                    {
                        Uri tmpUri = new Uri(sourceUrl);
                        string path = tmpUri.AbsolutePath;
                        if (path.EndsWith("/"))
                            path = path.Substring(0, path.Length - 1);
                        int indx = path.LastIndexOf('/');
                        if (indx >= 0)
                            path = path.Substring(indx + 1);
                        _broadcastifyFeedId = path;
                        _broadcastifyPrefix = tmpUri.Scheme + Uri.SchemeDelimiter + tmpUri.Host;
                    }
                    catch
                    {
                        _isBroadcastify = false;
                    }
                }
                else if (sourceUrl.ToLower().Contains("broadcastify.com/listen"))
                {
                    _isBroadcastify = true;
                    try
                    {
                        Uri tmpUri = new Uri(sourceUrl);
                        _broadcastifyPrefix = tmpUri.Scheme + Uri.SchemeDelimiter + tmpUri.Host;
                    }
                    catch
                    {
                        _isBroadcastify = false;
                    }
                }
            }
        }