/// <summary> /// 番組のクローンを返す /// </summary> /// <param name="parentHeadline">親ヘッドライン</param> /// <returns>番組のクローン</returns> public virtual IChannel Clone(IHeadline parentHeadline) { Channel channel = new Channel((Headline)parentHeadline); channel.Title = (string)(Title.Clone()); if (GetWebsiteUrl() != null) { channel.Link = new Uri(GetWebsiteUrl().ToString()); } else { channel.Link = null; } channel.Description = (string)(channel.Description.Clone()); channel.SetDate( Date.ToString("ddd, d MMM yyyy HH':'mm':'ss zzz", System.Globalization.DateTimeFormatInfo.InvariantInfo)); channel.Category = (string)(Category.Clone()); channel.Author = (string)(Author.Clone()); if (GetPlayUrl() != null) { channel.Url = new Uri(GetPlayUrl().ToString()); } else { channel.Url = null; } channel.Length = (string)(Length.Clone()); channel.Type = (string)(Type.Clone()); channel.check = false; return(channel); }
public HeadlineSite( IHeadline headline, IContainer container, string name) { Component = headline; Container = container; Name = name; }
/// <summary> /// 放送局のコンストラクタ /// </summary> /// <param name="id">放送局のID</param> /// <param name="name">放送局の名前</param> /// <param name="stationKind">放送局の種類</param> /// <param name="url">放送局のURL</param> public Station(string id, string name, StationKind stationKind, Uri url) { this.id = id; this.name = name; this.kind = stationKind; if (kind.Equals(StationKind.RssPodcast)) { globalHeadline = new PodcasCo.Stations.RssPodcast.Headline(id + "-global", this); globalHeadline.SetUrl(url); localHeadline = new PodcasCo.Stations.RssPodcast.Headline(id + "-local", this); localHeadline.SetUrl(new Uri(UserSetting.PodcastClipDirectoryPath + @"\" + localHeadline.GetId() + @"\" + PodcasCoInfo.LocalRssFile)); localHeadline.FetchHeadline(); /* * 放送局の名前を得る(URLがNotFoundや、存在してもRSSで無いっぽい場合は例外が投げられるため * 以下の設定保存は実行されない) */ FetchName(); localHeadline.SaveSetting(); globalHeadline.SaveSetting(); } else { // ここには到達しない Trace.Assert(false, "想定外の動作のため、終了します"); } }
public HeadlineSite(IHeadline headline, IContainer container) { Component = headline; Container = container; if (headline != null && container != null) { Name = $"Headline {headline.Version}"; } }
/// <summary> /// Gets the data from IANA. /// </summary> /// <returns>The amount of loaded TLDs.</returns> private static int GetDataFromIANA() { int result = 0; DateTime start = DateTime.Now; DateTime end; IRestRequest request = new RestRequest(Path, Method.GET, DataFormat.None); IRestResponse response = RestClient.Execute(request); string[] lines = null; IHeadline oldHeadline = LastAnswer; LastResponseStatus = response.ResponseStatus; if (response.ResponseStatus == ResponseStatus.Completed || response.ResponseStatus == ResponseStatus.None) { lines = response.Content.Split('\n'); } if (lines != null && lines.Length > 1) { result = lines.Length; LastAnswer = new Headline(lines[0].Trim()); if (oldHeadline != null && !LastAnswer.Version.Equals(oldHeadline.Version)) { // the whole idea with reload is nice - but if there was no // change, it isn't needes... TLDs.Clear(); for (int i = 1; i < lines.Length; i++) { TLDs.Add(lines[i].Trim()); } } else if (oldHeadline == null) { for (int i = 1; i < lines.Length; i++) { TLDs.Add(lines[i].Trim()); } } } end = DateTime.Now; LastReloadTime = end.Subtract(start); Reloads++; return(result); }
/// <summary> /// 放送局のコンストラクタ /// </summary> /// <param name="id">放送局のID</param> /// <param name="name">放送局の名前</param> /// <param name="stationKind">放送局の種類</param> public Station(string id, string name, StationKind stationKind) { this.id = id; this.name = name; this.kind = stationKind; if (kind.Equals(StationKind.RssPodcast)) { globalHeadline = new PodcasCo.Stations.RssPodcast.Headline(id + "-global", this); localHeadline = new PodcasCo.Stations.RssPodcast.Headline(id + "-local", this); localHeadline.FetchHeadline(); } else { // ここには到達しない Trace.Assert(false, "想定外の動作のため、終了します"); } }
/// <summary> /// 放送局のコンストラクタ /// </summary> /// <param name="id">放送局のID</param> /// <param name="name">放送局の名前</param> /// <param name="stationKind">放送局の種類</param> public Station(string id, string name, StationKinds stationKind) { if (id == null) { throw new ArgumentNullException("StationのIDにNullは指定できません"); } if (id == string.Empty) { throw new ArgumentException("StationのIDに空文字は指定できません"); } this.id = id; this.name = name; this.kind = stationKind; switch (kind) { case StationKinds.Netladio: headline = new PocketLadio.Stations.Netladio.Headline(id, this); break; case StationKinds.RssPodcast: headline = new PocketLadio.Stations.RssPodcast.Headline(id, this); break; case StationKinds.ShoutCast: headline = new PocketLadio.Stations.ShoutCast.Headline(id, this); break; case StationKinds.Icecast: headline = new PocketLadio.Stations.Icecast.Headline(id, this); break; default: // ここには到達しない Trace.Assert(false, "想定外の動作のため、終了します"); break; } }
public AboutController(IHeadline _repo) { this._repo = _repo; }
public HeadLineController(IHeadline _repo) { this._repo = _repo; }