当前位置: 首页>>代码示例>>C#>>正文


C# ITrack.GetValueAsync方法代码示例

本文整理汇总了C#中ITrack.GetValueAsync方法的典型用法代码示例。如果您正苦于以下问题:C# ITrack.GetValueAsync方法的具体用法?C# ITrack.GetValueAsync怎么用?C# ITrack.GetValueAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITrack的用法示例。


在下文中一共展示了ITrack.GetValueAsync方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: getEncoderAsync

		private async Task<IEncoder> getEncoderAsync(ITrack track)
		{
			var encoder = await track.GetValueAsync("Encoder");
			if (String.IsNullOrWhiteSpace(encoder))
			{
				if (log.IsFatalEnabled)
				{
					log.Fatal("No valid Encoder property found quitting");
				}

				return null;
			}

			var encoderSplit = encoder.Value.Split(',');
			if (encoderSplit.Length < 2)
			{
				if (log.IsFatalEnabled)
				{
					log.FatalFormat("Encoder is in the incorrect formation it should be '<FullTypeName>, <FullAssemblyName>' instead '{0}' was received.", encoder);
				}

				return null;
			}
			ObjectHandle encoderBox = null;
			try
			{
				encoderBox = Activator.CreateInstance(encoderSplit[1], encoderSplit[0]);
			}
			catch (Exception ex)
			{
				if (log.IsFatalEnabled)
				{
					log.FatalFormat("An exception was thrown while trying to create an encoder of type '{0}'. Exception: {1}", encoder, ex);
				}
				return null;
			}

			if (encoderBox == null)
			{
				if (log.IsFatalEnabled)
				{
					log.FatalFormat("Unable to create an encoder of type '{0}'.", encoder);
				}

				return null;
			}

			IEncoder e = encoderBox.Unwrap() as IEncoder;
			if (e == null)
			{
				if (log.IsFatalEnabled)
				{
					log.FatalFormat("Type of {0} does not implement IEncoder.", encoderBox.Unwrap().GetType());
				}
				return null;
			}

			return e;
		}
开发者ID:holtsoftware,项目名称:HandBrakeRunner,代码行数:59,代码来源:Runner.cs

示例2: getMetaDataAsync

		private async Task<IMetaData> getMetaDataAsync(ITrack track)
		{
			var metaDataType = await track.GetValueAsync("MetaData");
			if (String.IsNullOrWhiteSpace(metaDataType))
			{
				if (log.IsFatalEnabled)
				{
					log.Fatal("No valid MetaData property found quitting");
				}

				return null;
			}

			var metaDataSplit = metaDataType.Value.Split(',');
			if (metaDataSplit.Length < 2)
			{
				if (log.IsFatalEnabled)
				{
					log.FatalFormat("MetaData is in the incorrect formation it should be '<FullTypeName>, <FullAssemblyName>' instead '{0}' was received.", metaDataType);
				}

				return null;
			}
			ObjectHandle metaDataBox = null;
			try
			{
				metaDataBox = Activator.CreateInstance(metaDataSplit[1], metaDataSplit[0]);
			}
			catch (Exception ex)
			{
				if (log.IsFatalEnabled)
				{
					log.FatalFormat("An exception was thrown while trying to create an IMetaData of type '{0}'. Exception: {1}", metaDataType, ex);
				}
				return null;
			}

			if (metaDataBox == null)
			{
				if (log.IsFatalEnabled)
				{
					log.FatalFormat("Unable to create an IMetaData of type '{0}'.", metaDataType);
				}

				return null;
			}

			IMetaData md = metaDataBox.Unwrap() as IMetaData;
			if (md == null)
			{
				if (log.IsFatalEnabled)
				{
					log.FatalFormat("Type of {0} does not implement IMetaData.", metaDataBox.Unwrap().GetType());
				}
				return null;
			}

			return md;
		}
开发者ID:holtsoftware,项目名称:HandBrakeRunner,代码行数:59,代码来源:Runner.cs

示例3: GetArgumentsAsync

		protected virtual async Task<String> GetArgumentsAsync(ITrack track, String sourceFile, String destinationFile)
		{
			if (track == null)
			{
				throw new ArgumentNullException("track");
			}

			if (sourceFile == null)
			{
				throw new ArgumentNullException("sourceFile");
			}

			if (destinationFile == null)
			{
				throw new ArgumentNullException("destinationFile");
			}

			StringBuilder arguments = new StringBuilder();
			arguments.AppendFormat("\"{0}\" --output \"{1}\" ", Methods.FixString(Methods.ChangeDirectorySeparator(sourceFile, '/')), Methods.FixString(Methods.ChangeDirectorySeparator(destinationFile, '/')));

			PropertyMetaData value = await track.GetValueAsync("ShowName");
			if (!String.IsNullOrWhiteSpace(value))
			{
				arguments.AppendFormat("--TVShowName \"{0}\" ", Methods.FixString(value));
			}

			value = await track.GetValueAsync("MediaKind");
			if (!String.IsNullOrWhiteSpace(value))
			{
				arguments.AppendFormat("--stik \"{0}\" ", Methods.FixString(value));
			}

			value = await track.GetValueAsync("Genre");
			if (!String.IsNullOrWhiteSpace(value))
			{
				arguments.AppendFormat("--genre \"{0}\" ", Methods.FixString(value));
			}

			value = await track.GetValueAsync("Image");
			if (!String.IsNullOrWhiteSpace(value))
			{
				String imagePath = value.Value;
				if (!Path.IsPathRooted(value.Value))
				{
					imagePath = Path.GetFullPath(Path.Combine(value.FullPath, value.Value));
				}
				arguments.AppendFormat("--artwork \"{0}\" ", Methods.FixString(Methods.ChangeDirectorySeparator(imagePath, '/')));
			}

			value = await track.GetValueAsync("Title");
			if (!String.IsNullOrWhiteSpace(value))
			{
				arguments.AppendFormat("--title \"{0}\" ", Methods.FixString(value));
			}

			value = await track.GetValueAsync("Description");
			if (!String.IsNullOrWhiteSpace(value))
			{
				if (value.Value.Length > 255)
				{
					value = value.Value.Substring(0, 252) + "...";
				}
				arguments.AppendFormat("--description \"{0}\" ", Methods.FixString(value));
			}

			value = await track.GetValueAsync("Album");
			if (!String.IsNullOrWhiteSpace(value))
			{
				arguments.AppendFormat("--album \"{0}\" ", Methods.FixString(value));
			}

			value = await track.GetValueAsync("TrackNumber");
			if (!String.IsNullOrWhiteSpace(value))
			{
				arguments.AppendFormat("--tracknum \"{0}\" ", Methods.FixString(value));
			}

			value = await track.GetValueAsync("DiskNumber");
			if (!String.IsNullOrWhiteSpace(value))
			{
				arguments.AppendFormat("--disk \"{0}\" ", Methods.FixString(value));
			}

			value = await track.GetValueAsync("EID");
			if (!String.IsNullOrWhiteSpace(value))
			{
				arguments.AppendFormat("--TVEpisode \"{0}\" ", Methods.FixString(value));
			}

			value = await track.GetValueAsync("Episode");
			if (!String.IsNullOrWhiteSpace(value))
			{
				arguments.AppendFormat("--TVEpisodeNum \"{0}\" ", Methods.FixString(value));
			}

			value = await track.GetValueAsync("Season");
			if (!String.IsNullOrWhiteSpace(value))
			{
				arguments.AppendFormat("--TVSeasonNum \"{0}\" ", Methods.FixString(value));
			}
//.........这里部分代码省略.........
开发者ID:holtsoftware,项目名称:HandBrakeRunner,代码行数:101,代码来源:AtomicParsleyMetaData.cs


注:本文中的ITrack.GetValueAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。