本文整理汇总了C#中IMedia类的典型用法代码示例。如果您正苦于以下问题:C# IMedia类的具体用法?C# IMedia怎么用?C# IMedia使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMedia类属于命名空间,在下文中一共展示了IMedia类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
示例2: ImportInfo
public ImportInfo(IMedia media, IEntity entity)
{
if (media == null)
throw new ArgumentNullException("media");
this.media = media;
this.entity = entity;
}
示例3: UploadToAzure
public void UploadToAzure(IMedia mediaItem)
{
if(!IsValidMediaItem(mediaItem))
return;
var files = GetMediaFilePaths(mediaItem);
files.ForEach(UploadToAzure);
}
示例4: CloneWithoutMediaInfo
public IMedia CloneWithoutMediaInfo(IMedia source)
{
return new Media
{
Name = source.Name,
Data = source.Data
};
}
示例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);
}
示例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?
}
示例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);
}
示例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);
}
示例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");
}
示例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();
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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);
}
}
示例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;
}