本文整理汇总了C#中IMedia类的典型用法代码示例。如果您正苦于以下问题:C# IMedia类的具体用法?C# IMedia怎么用?C# IMedia使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMedia类属于命名空间,在下文中一共展示了IMedia类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Play
public void Play(string filename)
{
if (InvokeRequired)
Invoke(new PlayDelegate(Play), filename);
else
{
_needsSize = _filename != filename;
_filename = filename;
_mMedia = _mFactory.CreateMedia<IMedia>(filename);
_mMedia.Events.DurationChanged += EventsDurationChanged;
_mMedia.Events.StateChanged += EventsStateChanged;
_mMedia.Events.ParsedChanged += Events_ParsedChanged;
_mPlayer.Open(_mMedia);
_mMedia.Parse(true);
_mPlayer.Play();
string[] parts = filename.Split('\\');
string fn = parts[parts.Length - 1];
FilesFile ff =
((MainForm) Owner).GetCameraWindow(ObjectID).FileList.FirstOrDefault(p => p.Filename.EndsWith(fn));
if (ff!=null)
vNav.Render(ff);
}
}
开发者ID:vmail,项目名称:main,代码行数:25,代码来源:PlayerForm.cs
示例2: ImportInfo
public ImportInfo(IMedia media, IEntity entity)
{
if (media == null)
throw new ArgumentNullException("media");
this.media = media;
this.entity = entity;
}
开发者ID:bossaia,项目名称:alexandrialibrary,代码行数:8,代码来源:ImportInfo.cs
示例3: UploadToAzure
public void UploadToAzure(IMedia mediaItem)
{
if(!IsValidMediaItem(mediaItem))
return;
var files = GetMediaFilePaths(mediaItem);
files.ForEach(UploadToAzure);
}
开发者ID:franhoey,项目名称:Umbraco.AzureMediaFtpSync,代码行数:8,代码来源:Uploader.cs
示例4: CloneWithoutMediaInfo
public IMedia CloneWithoutMediaInfo(IMedia source)
{
return new Media
{
Name = source.Name,
Data = source.Data
};
}
开发者ID:Murtaza-libs,项目名称:tweetinvi,代码行数:8,代码来源:Media.cs
示例5: Organise
public void Organise(IMedia media, DirectoryInfoBase outputDirectory, OrganiserConversionOptions conversionOption, bool strictSeason)
{
// Create working directory.
WorkingDirectory = _fileSystem.DirectoryInfo.FromDirectoryName(_fileSystem.Path.Combine(_fileSystem.Path.GetTempPath(), "WorkingArea"));
// Create working directory if it does not exist.
if(!WorkingDirectory.Exists)
{
WorkingDirectory.Create();
}
// Copy to working area.
CopyMediaToWorkingArea(media);
// Convert if required.
if(conversionOption == OrganiserConversionOptions.Force)
{
Logger.Log("Organiser").StdOut.WriteLine("Conversion set to \"force\". Will convert. {0}", media.MediaFile.FullName);
ConvertMedia(media);
}
else if(media.RequiresConversion)
{
if(conversionOption == OrganiserConversionOptions.Skip)
{
Logger.Log("Organiser").StdOut.WriteLine("Media requires conversion. Conversion set to \"skip\", skipping conversion. {0}", media.MediaFile.FullName);
}
else
{
Logger.Log("Organiser").StdOut.WriteLine("Media requires conversion. Will convert. {0}", media.MediaFile.FullName);
ConvertMedia(media);
}
}
// Extract media details exhaustivly.
ExtractExhaustiveMediaDetails(media, strictSeason);
// Save media meta data.
var saveResponse = SaveMediaMetaData(media);
if(!saveResponse)
{
if(conversionOption == OrganiserConversionOptions.Skip)
{
Logger.Log("Organiser").StdOut.WriteLine("Unable to save metadata. Conversion set to \"skip\", skipping conversion. {0}", media.MediaFile.FullName);
}
else
{
Logger.Log("Organiser").StdOut.WriteLine("Unable to save metadata. Will convert. {0}", media.MediaFile.FullName);
ConvertMedia(media);
SaveMediaMetaData(media);
}
}
// Rename media.
RenameMediaToCleanFileName(media);
// If output directory not provided, delete file. Otherwise move to output directory.
MoveMediaToOutputDirectory(media, outputDirectory);
}
开发者ID:dipeshc,项目名称:MediaOrganiser,代码行数:58,代码来源:Organiser.cs
示例6: Prepare
//Creates directories
public virtual void Prepare(IMedia stream)
{
if (!System.IO.Directory.Exists(BaseDirectory + '/' + stream.Id))
{
System.IO.Directory.CreateDirectory(BaseDirectory + '/' + stream.Id);
}
//Create Toc file?
}
开发者ID:qinpengit,项目名称:net7mma-111212,代码行数:10,代码来源:RtspStreamArchiver.cs
示例7: BreakDownTest
public override ElectricStatus BreakDownTest(IMedia media, ElectricStatus elecStatus, WireStatus status, double voltage, out double current)
{
if (media.GetId() == _id)
{
switch (elecStatus)
{
case ElectricStatus.Resistence:
current = Defines.Clamp(voltage, 1e4);
return elecStatus;
default:
break;
}
}
else if (media.GetId() == MediaId.M_AIR)
{
voltage *= 0.01;
switch (elecStatus)
{
case ElectricStatus.Resistence:
current = Defines.Clamp(voltage, 0.01);
if (Math.Abs(voltage) > 200)
{
return ElectricStatus.Ionization;
}
else
{
return elecStatus;
}
case ElectricStatus.Ionization:
if (Math.Abs(voltage) > 500)
{
current = Defines.Clamp(voltage, 1e6);
return ElectricStatus.Conduction;
}
if (Math.Abs(voltage) > 200)
{
current = Defines.Clamp(voltage, 1e4);
return ElectricStatus.Ionization;
}
break;
case ElectricStatus.Conduction:
if (Math.Abs(voltage) > 60)
{
current = Defines.Clamp(voltage, 1e6);
return ElectricStatus.Conduction;
}
else
{
current = Defines.Clamp(voltage, 1e6);
return ElectricStatus.Ionization;
}
default:
break;
}
}
return base.BreakDownTest(media, elecStatus, status, voltage, out current);
}
开发者ID:bajdcc,项目名称:SimuCircult,代码行数:57,代码来源:GroundMedia.cs
示例8: SaveMediaFile
public static bool SaveMediaFile(string path, IMedia media, XElement element)
{
LogHelper.Debug<FileHelper>("SaveMedia File {0} {1}", () => path, () => media.Name);
string filename = string.Format("{0}.media", CleanFileName(media.Name));
string fullpath = Path.Combine(string.Format("{0}{1}", _mappedMediaRoot, path), filename);
return SaveContentBaseFile(fullpath, element);
}
开发者ID:pbevis,项目名称:jumoo.usync,代码行数:10,代码来源:FileHelper.cs
示例9: SetInfo
public void SetInfo(IMedia media)
{
int value;
media.Path = _path;
media.Filename = _mediaInfo.Get(0, 0, "FileName");
media.Title = media.Filename;
media.FileSize = (Int32.TryParse(_mediaInfo.Get(0, 0, "FileSize"), out value)) ? value : 0;
media.Extension = _mediaInfo.Get(0, 0, "FileExtension");
}
开发者ID:Pamilator,项目名称:mywindowmediaplayer-epitech2013,代码行数:10,代码来源:InfoMedia.cs
示例10: afficheDetails
/// <summary>
/// Affichage du détail d'un média
/// </summary>
/// <param name="media"></param>
/// <param name="format"></param>
/// <returns></returns>
protected string afficheDetails(IMedia media, IFormatProvider format)
{
AbstractMediaDetailDisplay mycontrol = null;
TextWriter txt = new StringWriter();
HtmlTextWriter html = new HtmlTextWriter(txt);
mycontrol = LoadControl(string.Format("~/Controls/Display/{0}WUC.ascx", media.GetType().Name)) as AbstractMediaDetailDisplay;
mycontrol.afficheMedia(media);
mycontrol.RenderControl(html);
return txt.ToString();
}
开发者ID:zorky,项目名称:mymedias,代码行数:18,代码来源:ListeMediaWUC.ascx.cs
示例11: Export
public void Export(string path, IMedia item, IMediaService _mediaService)
{
LogHelper.Info<MediaExporter>("Exporting {0}", () => FileHelper.CleanFileName(item.Name));
SaveMedia(item, path);
path = String.Format("{0}\\{1}", path, FileHelper.CleanFileName(item.Name));
foreach (var childItem in _mediaService.GetChildren(item.Id))
{
Export(path, childItem, _mediaService);
}
}
开发者ID:KevinJump,项目名称:jumoo.usync,代码行数:13,代码来源:MediaExporter.cs
示例12: CheckForRefresh
bool CheckForRefresh(IMedia sender, CancellableEventArgs e)
{
// As of Umbraco 6.2.4 if you try to access e.Cancel for an event that isn't cancellable you'll get an exception
if (sender.Name.Equals(PPC_2010.Data.Constants.RefreshIndicatorTitle, StringComparison.CurrentCultureIgnoreCase))
{
ServiceLocator.Instance.Locate<ISermonRepository>().RefreshSermons();
if (e.CanCancel)
e.Cancel = true;
return true;
}
return false;
}
开发者ID:shferguson,项目名称:ppc2010,代码行数:13,代码来源:SermonEvents.cs
示例13: Stop
//Stop recoding a stream
public virtual void Stop(IMedia stream)
{
if (stream is RtpSource)
{
RtpTools.RtpDump.Program program;
if (!Attached.TryGetValue(stream, out program)) return;
program.Dispose();
Attached.Remove(stream);
(stream as RtpSource).RtpClient.RtpPacketReceieved -= RtpClientPacketReceieved;
(stream as RtpSource).RtpClient.RtcpPacketReceieved -= RtpClientPacketReceieved;
}
}
开发者ID:qinpengit,项目名称:net7mma-111212,代码行数:15,代码来源:RtspStreamArchiver.cs
示例14: button1_Click
private void button1_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == true)
{
textBlock1.Text = ofd.FileName;
m_media = m_factory.CreateMedia<IMediaFromFile>(ofd.FileName);
m_media.Events.DurationChanged += new EventHandler<MediaDurationChange>(Events_DurationChanged);
m_media.Events.StateChanged += new EventHandler<MediaStateChange>(Events_StateChanged);
m_player.Open(m_media);
m_media.Parse(true);
}
}
开发者ID:GoshaDE,项目名称:nVLC,代码行数:14,代码来源:MainWindow.xaml.cs
示例15: GenerateMultipartElement
private IMultipartElement GenerateMultipartElement(IMedia media, string contentId, IMultipartRequestConfiguration configuration)
{
var additionalParameters = new Dictionary<string, string>();
var element = new MultipartElement
{
Boundary = configuration.Boundary,
ContentId = contentId,
ContentDispositionType = "form-data",
ContentType = "application/octet-stream",
AdditionalParameters = additionalParameters,
Data = configuration.EncodingAlgorithm.GetString(media.Data, 0, media.Data.Length),
};
return element;
}
开发者ID:Murtaza-libs,项目名称:tweetinvi,代码行数:16,代码来源:TwitterRequestGenerator.cs
示例16: AfterMap
private static void AfterMap(IMedia media, MediaItemDisplay display)
{
//map the tree node url
if (HttpContext.Current != null)
{
var urlHelper = new UrlHelper(new RequestContext(new HttpContextWrapper(HttpContext.Current), new RouteData()));
var url = urlHelper.GetUmbracoApiService<MediaTreeController>(controller => controller.GetTreeNode(display.Id.ToString(), null));
display.TreeNodeUrl = url;
}
if (media.ContentType.IsContainer)
{
TabsAndPropertiesResolver.AddContainerView(display, "media");
}
TabsAndPropertiesResolver.MapGenericProperties(media, display);
}
开发者ID:phaniarveti,项目名称:Experiments,代码行数:17,代码来源:MediaModelMapper.cs
示例17: GetParentPath
private string GetParentPath(IMediaService sender, IMedia mediaItem)
{
string result = string.Empty;
IMedia current = mediaItem;
IMedia parent = null;
do
{
parent = sender.GetParent(current);
if (parent != null)
result = "\\" + parent.Name + result;
current = parent;
} while (parent != null);
return result.TrimStart('\\');
}
开发者ID:nzaugg,项目名称:UmbracoSimpleMediaUrl,代码行数:17,代码来源:SimpleUrlMediaService.cs
示例18: SaveMedia
public void SaveMedia(IMedia media, string path)
{
XElement itemXml = ExportMedia(media);
if (itemXml != null)
{
if (FileHelper.SaveMediaFile(path, media, itemXml))
{
_count++;
SourceInfo.Add(media.Key, media.Name, media.ParentId);
}
}
else
{
LogHelper.Info<MediaExporter>("Media xml came back as null");
}
}
开发者ID:KevinJump,项目名称:jumoo.usync,代码行数:17,代码来源:MediaExporter.cs
示例19: CreateMedia
/// <summary>
/// Creates an <see cref="IMedia"/> object using the alias of the <see cref="IMediaType"/>
/// that this Media should based on.
/// </summary>
/// <remarks>
/// Note that using this method will simply return a new IMedia without any identity
/// as it has not yet been persisted. It is intended as a shortcut to creating new media objects
/// that does not invoke a save operation against the database.
/// </remarks>
/// <param name="name">Name of the Media object</param>
/// <param name="parent">Parent <see cref="IMedia"/> for the new Media item</param>
/// <param name="mediaTypeAlias">Alias of the <see cref="IMediaType"/></param>
/// <param name="userId">Optional id of the user creating the media item</param>
/// <returns><see cref="IMedia"/></returns>
public IMedia CreateMedia(string name, IMedia parent, string mediaTypeAlias, int userId = 0)
{
var mediaType = FindMediaTypeByAlias(mediaTypeAlias);
var media = new Models.Media(name, parent, mediaType);
if (Creating.IsRaisedEventCancelled(new NewEventArgs<IMedia>(media, mediaTypeAlias, parent), this))
{
media.WasCancelled = true;
return media;
}
media.CreatorId = userId;
Created.RaiseEvent(new NewEventArgs<IMedia>(media, false, mediaTypeAlias, parent), this);
Audit.Add(AuditTypes.New, "", media.CreatorId, media.Id);
return media;
}
开发者ID:Jeavon,项目名称:Umbraco-CMS,代码行数:32,代码来源:MediaService.cs
示例20: Start
public virtual void Start(IMedia stream, RtpTools.FileFormat format = RtpTools.FileFormat.Binary)
{
if (stream is RtpSource)
{
RtpTools.RtpDump.Program program;
if (Attached.TryGetValue(stream, out program)) return;
Prepare(stream);
program = new RtpTools.RtpDump.Program(); //.DumpWriter(BaseDirectory + '/' + stream.Id + '/' + DateTime.UtcNow.ToFileTime(), format, new System.Net.IPEndPoint(System.Net.IPAddress.Any, 0));
Attached.Add(stream, program);
(stream as RtpSource).RtpClient.RtpPacketReceieved += RtpClientPacketReceieved;
(stream as RtpSource).RtpClient.RtcpPacketReceieved += RtpClientPacketReceieved;
}
}
开发者ID:qinpengit,项目名称:net7mma-111212,代码行数:18,代码来源:RtspStreamArchiver.cs
注:本文中的IMedia类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论