本文整理汇总了C#中IProvider.ReplaceSchemeHost方法的典型用法代码示例。如果您正苦于以下问题:C# IProvider.ReplaceSchemeHost方法的具体用法?C# IProvider.ReplaceSchemeHost怎么用?C# IProvider.ReplaceSchemeHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProvider
的用法示例。
在下文中一共展示了IProvider.ReplaceSchemeHost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFromEpisode
private MediaContainer GetFromEpisode(IProvider prov, int userid, string Id, BreadCrumbs info)
{
int id;
if (!int.TryParse(Id, out id))
return new MediaContainer() { ErrorString = "Invalid Episode Id" };
BaseObject ret =
new BaseObject(prov.NewMediaContainer(MediaContainerTypes.Episode, "Episode", true, true, info));
using (var session = DatabaseFactory.SessionFactory.OpenSession())
{
List<Video> dirs = new List<Video>();
ISessionWrapper sessionWrapper = session.Wrap();
AnimeEpisode e = RepoFactory.AnimeEpisode.GetByID(id);
if (e == null)
return new MediaContainer() { ErrorString = "Invalid Episode Id" };
KeyValuePair<AnimeEpisode, Contract_AnimeEpisode> ep =
new KeyValuePair<AnimeEpisode, Contract_AnimeEpisode>(e,
e.GetUserContract(userid));
if (ep.Value != null && ep.Value.LocalFileCount == 0)
return new MediaContainer() { ErrorString = "Episode do not have videolocals" };
AniDB_Episode aep = ep.Key.AniDB_Episode;
if (aep == null)
return new MediaContainer() { ErrorString = "Invalid Episode AniDB link not found" };
AnimeSeries ser = RepoFactory.AnimeSeries.GetByID(ep.Key.AnimeSeriesID);
if (ser == null)
return new MediaContainer() { ErrorString = "Invalid Serie" };
AniDB_Anime anime = ser.GetAnime();
Contract_AnimeSeries con = ser.GetUserContract(userid);
if (con == null)
return new MediaContainer() { ErrorString = "Invalid Serie, Contract not found" };
try
{
Video v = Helper.VideoFromAnimeEpisode(prov, con.CrossRefAniDBTvDBV2, ep, userid);
if (v != null)
{
Video nv = ser.GetPlexContract(userid);
Helper.AddInformationFromMasterSeries(v, con, ser.GetPlexContract(userid), prov is KodiProvider);
if (v.Medias != null && v.Medias.Count > 0)
{
v.Type = "episode";
dirs.EppAdd(prov, v, info, true);
PlexDeviceInfo dinfo = prov.GetPlexClient();
if (prov.ConstructFakeIosParent && dinfo != null && dinfo.Client == PlexClient.IOS)
v.GrandparentKey =
prov.Proxyfy(prov.ConstructFakeIosThumb(userid, v.ParentThumb,
v.Art ?? v.ParentArt ?? v.GrandparentArt));
v.ParentKey = null;
}
if (prov.UseBreadCrumbs)
v.Key = prov.ShortUrl(ret.MediaContainer.Key);
ret.MediaContainer.Art = prov.ReplaceSchemeHost(nv.Art ?? nv.ParentArt ?? nv.GrandparentArt);
}
ret.MediaContainer.Childrens = dirs;
return ret.GetStream(prov);
}
catch (Exception ex)
{
//Fast fix if file do not exist, and still is in db. (Xml Serialization of video info will fail on null)
}
}
return new MediaContainer() { ErrorString = "Episode Not Found" };
}
示例2: FakeParentForIOSThumbnail
private MediaContainer FakeParentForIOSThumbnail(IProvider prov, string base64)
{
BaseObject ret = new BaseObject(prov.NewMediaContainer(MediaContainerTypes.None, null, false, true, null));
if (!ret.Init(prov))
return new MediaContainer();
string[] urls = Helper.Base64DecodeUrl(base64).Split('|');
string thumb = prov.ReplaceSchemeHost(urls[0]);
string art = prov.ReplaceSchemeHost(urls[1]);
Directory v = new Directory()
{
Thumb = thumb,
ParentThumb = thumb,
GrandparentThumb = thumb,
Art = art,
ParentArt = art,
GrandparentArt = art
};
ret.MediaContainer.Thumb = ret.MediaContainer.ParentThumb = ret.MediaContainer.GrandparentThumb = thumb;
ret.MediaContainer.Art = ret.MediaContainer.ParentArt = ret.MediaContainer.GrandparentArt = art;
List<Video> vids = new List<Video>();
vids.Add(v);
ret.Childrens = vids;
return ret.GetStream(prov);
}