/// <summary> /// The base constructor. /// Sets up the Imgix url builder base options. /// </summary> /// <param name="options"></param> /// <exception cref="ArgumentNullException"><paramref name="options"/> is null</exception> /// <exception cref="ArgumentException"><paramref name="options"/> is empty</exception> public Imgix(IImgixOptions options) { if (options == null) { throw new ArgumentNullException(nameof(options)); } if (!options.Sources.Any()) { throw new ArgumentException(nameof(options) + " You must define at least one source", nameof(options)); } _sources = options.Sources.ToDictionary(source => source.Name, source => source); }
/// <summary> /// Creates a new imgix image from a supplied options object /// </summary> /// <param name="options">The base options</param> /// <param name="path">The path to the image</param> /// <returns></returns> public static ImgixImage CreateImage(IImgixOptions options, string path) => new Imgix(options).NewImage(path);
/// <summary> /// The base constructor. /// Sets up the Imgix url builder base options. /// </summary> /// <param name="options"></param> /// <exception cref="ArgumentNullException"><paramref name="options"/> is null</exception> /// <exception cref="ArgumentException"><paramref name="options"/> is empty</exception> public Imgix(IImgixOptions options) { if (options == null) throw new ArgumentNullException(nameof(options)); if (!options.Sources.Any()) throw new ArgumentException(nameof(options)+" You must define at least one source", nameof(options)); _sources = options.Sources.ToDictionary(source => source.Name, source => source); }