本文整理汇总了C#中IMediaItem类的典型用法代码示例。如果您正苦于以下问题:C# IMediaItem类的具体用法?C# IMediaItem怎么用?C# IMediaItem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMediaItem类属于命名空间,在下文中一共展示了IMediaItem类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ChangeStatus
public void ChangeStatus(IMediaItem inItem, MediaStatus inStatus)
{
var item = (TvEpisode)inItem;
item.Status = inStatus;
Cabinet.SetAsync(item).Wait();
}
开发者ID:jdbrock,项目名称:slouch,代码行数:7,代码来源:TvMediaSource.cs
示例2: PostStatusAsync
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
if (mediaItems == null)
throw new ArgumentNullException(nameof(mediaItems));
if (mediaItems.Length == 0)
throw new ArgumentException("Err:Media not specified.");
foreach (var item in mediaItems)
{
if (item == null)
throw new ArgumentException("Err:Media not specified.");
if (!item.Exists)
throw new ArgumentException("Err:Media not found.");
}
var uploadTasks = from m in mediaItems
select this.UploadMediaItem(m);
var mediaIds = await Task.WhenAll(uploadTasks)
.ConfigureAwait(false);
await this.tw.PostStatus(text, inReplyToStatusId, mediaIds)
.ConfigureAwait(false);
}
开发者ID:upsilon,项目名称:OpenTween,代码行数:26,代码来源:TwitterPhoto.cs
示例3: AbstractTranscoder
public AbstractTranscoder(IMediaItem item, uint quality, bool isDirect, uint offsetSeconds, uint lengthSeconds)
{
State = TranscodeState.None;
Item = item;
Quality = quality;
IsDirect = isDirect;
OffsetSeconds = offsetSeconds;
LengthSeconds = lengthSeconds;
}
开发者ID:einsteinx2,项目名称:WaveBox,代码行数:9,代码来源:AbstractTranscoder.cs
示例4: VideoTranscoder
public VideoTranscoder(IMediaItem item, uint quality, bool isDirect, uint? width, uint? height, bool maintainAspect, uint offsetSeconds, uint lengthSeconds)
: base(item, quality, isDirect, offsetSeconds, lengthSeconds)
{
Width = width;
Height = height;
MaintainAspect = maintainAspect;
OffsetSeconds = offsetSeconds;
LengthSeconds = lengthSeconds;
}
开发者ID:einsteinx2,项目名称:WaveBox,代码行数:9,代码来源:VideoTranscoder.cs
示例5: BuildMediaItemsTimelineMediaItemViewModel
private MediaItemViewModel BuildMediaItemsTimelineMediaItemViewModel(IMediaItem mediaItem, MediaItemsTimelineViewModel mediaItemsTimelineViewModel, TrackViewModel trackViewModel)
{
return new MediaItemViewModel
{
MediaItem = mediaItem,
MediaItemsTimelineViewModel = mediaItemsTimelineViewModel,
TrackViewModel = trackViewModel
};
}
开发者ID:AugustinasNomicas,项目名称:MultitrackPlayer,代码行数:9,代码来源:MultitrackPlayerController.cs
示例6: Compare
public override int Compare(IMediaItem x, IMediaItem y)
{
if (x == null) {
throw new ArgumentNullException("x");
}
if (y == null) {
throw new ArgumentNullException("y");
}
return comp.Compare(x.Title, y.Title);
}
开发者ID:rodionovstepan,项目名称:simpleDLNA,代码行数:10,代码来源:TitleComparer.cs
示例7: Compare
public override int Compare(IMediaItem x, IMediaItem y)
{
var xm = x as IMetaInfo;
var ym = y as IMetaInfo;
if (xm != null && ym != null) {
var rv = xm.InfoDate.CompareTo(ym.InfoDate);
if (rv != 0) {
return rv;
}
}
return base.Compare(x, y);
}
开发者ID:nmaier,项目名称:simpleDLNA,代码行数:12,代码来源:DateComparer.cs
示例8: KFile
public KFile( Kernel kernel, KDevice device, IMediaItem item )
{
Kernel = kernel;
Device = device;
Item = item;
FolderOffset = 0;
IsOpen = true;
CanWrite = !( ( item.Attributes & MediaItemAttributes.ReadOnly ) == MediaItemAttributes.ReadOnly );
CanSeek = false;
IsValid = true;
}
开发者ID:BradFuller,项目名称:pspplayer,代码行数:13,代码来源:KFile.cs
示例9: Compare
public override int Compare(IMediaItem x, IMediaItem y)
{
if (x == null && y == null) {
return 0;
throw new ArgumentNullException("x");
}
if (x == null) {
return 1;
}
if (y == null) {
return -1;
}
return comparer.Compare(x.ToComparableTitle(), y.ToComparableTitle());
}
开发者ID:modulexcite,项目名称:simpleDLNA,代码行数:14,代码来源:TitleComparer.cs
示例10: Compare
public override int Compare(IMediaItem x, IMediaItem y)
{
if (x == null) {
throw new ArgumentNullException("x");
}
if (y == null) {
throw new ArgumentNullException("y");
}
ITitleComparable tx = x as ITitleComparable, ty = y as ITitleComparable;
return comp.Compare(
tx != null ? tx.ToComparableTitle() : x.Title.StemCompareBase(),
ty != null ? ty.ToComparableTitle() : y.Title.StemCompareBase()
);
}
开发者ID:Rawrpwnzl,项目名称:simpleDLNA,代码行数:14,代码来源:TitleComparer.cs
示例11: RegisterPath
private void RegisterPath(IMediaItem item)
{
var path = item.Path;
string id;
if (!paths.ContainsKey(path)) {
while (ids.ContainsKey(id = idGen.Next(1000, int.MaxValue).ToString("X8"))) {
}
paths[path] = id;
}
else {
id = paths[path];
}
ids[id] = new WeakReference(item);
item.Id = id;
}
开发者ID:modulexcite,项目名称:simpleDLNA,代码行数:16,代码来源:Identifiers.cs
示例12: PostStatusAsync
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
if (mediaItems == null)
throw new ArgumentNullException(nameof(mediaItems));
if (mediaItems.Length == 0)
throw new ArgumentException("Err:Media not specified.");
foreach (var item in mediaItems)
{
if (item == null)
throw new ArgumentException("Err:Media not specified.");
if (!item.Exists)
throw new ArgumentException("Err:Media not found.");
}
await Task.Run(() => this.tw.PostStatusWithMultipleMedia(text, inReplyToStatusId, mediaItems))
.ConfigureAwait(false);
}
开发者ID:nezuku,项目名称:OpenTween,代码行数:20,代码来源:TwitterPhoto.cs
示例13: TryParseItem
public bool TryParseItem(XElement element, out IMediaItem item)
{
item = null;
if (element.Name != "video")
{
return false;
}
VideoItem videoItem = new VideoItem();
item = videoItem;
XItemParserMediaItem.ReadItem(videoItem, element);
var audioTracks = (from ats in element.Elements("audioTracks")
from at in ats.Elements("audioTrack")
select new AudioTrack { Title = (string)at.Attribute("title") }).ToArray();
for (int i = 0; i < audioTracks.Length; i++)
{
audioTracks[i].Index = i;
}
videoItem.AudioTracks = audioTracks;
videoItem.ItemType = "Video";
return true;
}
开发者ID:Titaye,项目名称:SLExtensions,代码行数:24,代码来源:XItemParserVideo.cs
示例14: UploadMedia
public string UploadMedia(IMediaItem item, ref long? mediaId)
{
if (MyCommon._endingFlag) return "";
if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return "";
HttpStatusCode res;
var content = "";
try
{
res = twCon.UploadMedia(item, ref content);
}
catch (Exception ex)
{
return "Err:" + ex.Message;
}
var err = this.CheckStatusCode(res, content);
if (err != null) return err;
TwitterUploadMediaResult status;
try
{
status = TwitterUploadMediaResult.ParseJson(content);
}
catch (SerializationException ex)
{
MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
return "Err:Json Parse Error(DataContractJsonSerializer)";
}
catch (Exception ex)
{
MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
return "Err:Invalid Json!";
}
mediaId = status.MediaId;
return "";
}
开发者ID:lltcggie,项目名称:OpenTween,代码行数:39,代码来源:Twitter.cs
示例15: PostStatusWithMedia
public string PostStatusWithMedia(string postStr, long? reply_to, IMediaItem item)
{
if (MyCommon._endingFlag) return "";
if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return "";
HttpStatusCode res;
var content = "";
try
{
res = twCon.UpdateStatusWithMedia(postStr, reply_to, item, ref content);
}
catch(Exception ex)
{
return "Err:" + ex.Message;
}
// 投稿に成功していても404が返ることがあるらしい: https://dev.twitter.com/discussions/1213
if (res == HttpStatusCode.NotFound) return "";
var err = this.CheckStatusCode(res, content);
if (err != null) return err;
TwitterStatus status;
try
{
status = TwitterStatus.ParseJson(content);
}
catch(SerializationException ex)
{
MyCommon.TraceOut(ex.Message + Environment.NewLine + content);
return "Err:Json Parse Error(DataContractJsonSerializer)";
}
catch(Exception ex)
{
MyCommon.TraceOut(ex, MethodBase.GetCurrentMethod().Name + " " + content);
return "Err:Invalid Json!";
}
_followersCount = status.User.FollowersCount;
_friendsCount = status.User.FriendsCount;
_statusesCount = status.User.StatusesCount;
_location = status.User.Location;
_bio = status.User.Description;
if (IsPostRestricted(status))
{
return "OK:Delaying?";
}
return "";
}
开发者ID:lltcggie,项目名称:OpenTween,代码行数:50,代码来源:Twitter.cs
示例16: PostStatusWithMultipleMedia
public string PostStatusWithMultipleMedia(string postStr, long? reply_to, IMediaItem[] mediaItems)
{
if (MyCommon._endingFlag) return "";
if (Twitter.AccountState != MyCommon.ACCOUNT_STATE.Valid) return "";
if (Twitter.DMSendTextRegex.IsMatch(postStr))
{
return SendDirectMessage(postStr);
}
var mediaIds = new List<long>();
foreach (var item in mediaItems)
{
long? mediaId = null;
var err = UploadMedia(item, ref mediaId);
if (!mediaId.HasValue || !string.IsNullOrEmpty(err)) return err;
mediaIds.Add(mediaId.Value);
}
if (mediaIds.Count == 0)
return "Err:Invalid Files!";
return PostStatus(postStr, reply_to, mediaIds);
}
开发者ID:lltcggie,项目名称:OpenTween,代码行数:26,代码来源:Twitter.cs
示例17: UploadFileAsync
public async Task<XDocument> UploadFileAsync(IMediaItem item, string title)
{
using (var content = new MultipartFormDataContent())
using (var mediaStream = item.OpenRead())
using (var mediaContent = new StreamContent(mediaStream))
using (var titleContent = new StringContent(title))
{
content.Add(mediaContent, "image", item.Name);
content.Add(titleContent, "title");
using (var request = new HttpRequestMessage(HttpMethod.Post, UploadEndpoint))
{
request.Headers.Authorization =
new AuthenticationHeaderValue("Client-ID", ApplicationSettings.ImgurClientID);
request.Content = content;
using (var response = await Networking.Http.SendAsync(request).ConfigureAwait(false))
{
response.EnsureSuccessStatusCode();
using (var stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false))
{
return XDocument.Load(stream);
}
}
}
}
}
开发者ID:nezuku,项目名称:OpenTween,代码行数:28,代码来源:Imgur.cs
示例18: PostStatusAsync
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
if (mediaItems == null)
throw new ArgumentNullException(nameof(mediaItems));
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException(nameof(mediaItems));
var item = mediaItems[0];
if (item == null)
throw new ArgumentException("Err:Media not specified.");
if (!item.Exists)
throw new ArgumentException("Err:Media not found.");
XDocument xml;
try
{
xml = await this.UploadFileAsync(item, text)
.ConfigureAwait(false);
}
catch (HttpRequestException ex)
{
throw new WebApiException("Err:" + ex.Message, ex);
}
catch (OperationCanceledException ex)
{
throw new WebApiException("Err:Timeout", ex);
}
var imageElm = xml.Element("data");
if (imageElm.Attribute("success").Value != "1")
throw new WebApiException("Err:" + imageElm.Attribute("status").Value);
var imageUrl = imageElm.Element("link").Value;
var textWithImageUrl = text + " " + imageUrl.Trim();
await Task.Run(() => this.twitter.PostStatus(textWithImageUrl, inReplyToStatusId))
.ConfigureAwait(false);
}
开发者ID:nezuku,项目名称:OpenTween,代码行数:43,代码来源:Imgur.cs
示例19: PostStatusAsync
public async Task PostStatusAsync(string text, long? inReplyToStatusId, IMediaItem[] mediaItems)
{
if (mediaItems == null)
throw new ArgumentNullException("mediaItems");
if (mediaItems.Length != 1)
throw new ArgumentOutOfRangeException("mediaItems");
var item = mediaItems[0];
if (item == null)
throw new ArgumentException("Err:Media not specified.");
if (!item.Exists)
throw new ArgumentException("Err:Media not found.");
var xml = await this.twippleApi.UploadFileAsync(item)
.ConfigureAwait(false);
var imageUrlElm = xml.XPathSelectElement("/rsp/mediaurl");
if (imageUrlElm == null)
throw new WebApiException("Invalid API response", xml.ToString());
var textWithImageUrl = text + " " + imageUrlElm.Value.Trim();
await Task.Run(() => this.twitter.PostStatus(textWithImageUrl, inReplyToStatusId))
.ConfigureAwait(false);
}
开发者ID:betarium,项目名称:OpenTweenXP,代码行数:28,代码来源:TwipplePhoto.cs
示例20: UploadFileAsync
/// <summary>
/// 画像のアップロードを行います
/// </summary>
/// <exception cref="WebApiException"/>
/// <exception cref="XmlException"/>
public async Task<XDocument> UploadFileAsync(IMediaItem item)
{
// 参照: http://p.twipple.jp/wiki/API_Upload2/ja
var param = new Dictionary<string, string>
{
{"upload_from", Application.ProductName},
};
var paramFiles = new List<KeyValuePair<string, IMediaItem>>
{
new KeyValuePair<string, IMediaItem>("media", item),
};
var response = "";
var uploadTask = Task.Run(() => this.GetContent(HttpConnection.PostMethod,
UploadEndpoint, param, paramFiles, ref response, null, null));
var ret = await uploadTask.ConfigureAwait(false);
if (ret != HttpStatusCode.OK)
throw new WebApiException("Err:" + ret, response);
return XDocument.Parse(response);
}
开发者ID:betarium,项目名称:OpenTweenXP,代码行数:29,代码来源:TwipplePhoto.cs
注:本文中的IMediaItem类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论