/// <summary> /// Instantiates media input using wpecified type and source. /// </summary> /// <param name="type">Type of media stream.</param> /// <param name="source">String which identifies source of media resource.</param> /// <exception cref="ArgumentOutOfRangeException">Invalid type of media input.</exception> /// <exception cref="ArgumentNullException">Source string is null.</exception> /// <exception cref="ArgumentException">Source string is empty.</exception> /// <exception cref="FileNotFoundException">If media type is <code>MediaInputType.File</code> and source file does not exists.</exception> public MediaInput(MediaInputType type, string source) { if (type < MediaInputType.File || type > MediaInputType.UnparsedMrl) { throw new ArgumentOutOfRangeException("type"); } if (source == null) { throw new ArgumentNullException("source"); } if (source.Length == 0) { throw new ArgumentException("Source string cannot be empty.", "source"); } // if (type == MediaInputType.File) { if (!File.Exists(source)) { throw new FileNotFoundException("Source file not found.", source); } } // this.type = type; this.source = source; }
/// <summary> /// Instantiates media input using wpecified type and source. /// </summary> /// <param name="type">Type of media stream.</param> /// <param name="source">String which identifies source of media resource.</param> /// <exception cref="ArgumentOutOfRangeException">Invalid type of media input.</exception> /// <exception cref="ArgumentNullException">Source string is null.</exception> /// <exception cref="ArgumentException">Source string is empty.</exception> /// <exception cref="FileNotFoundException">If media type is <code>MediaInputType.File</code> and source file does not exists.</exception> public MediaInput(MediaInputType type, string source) { if (type < MediaInputType.File || type > MediaInputType.Device) { throw new ArgumentOutOfRangeException("type"); } if (source == null) { throw new ArgumentNullException("source"); } if (source.Length == 0) { throw new ArgumentException("Source string cannot be empty.", "source"); } // if (type == MediaInputType.File) { if (!File.Exists(source)) { throw new FileNotFoundException("Source file not found.", source); } } // this.type = type; this.source = source; }