public static bool SupportsFile(InputParameters parameters) { return(GetFormat(parameters.InputFormat, parameters.InputFileName) != null); }
public bool SupportsFile(InputParameters parameters) { return(EngineInternal.SupportsFile(parameters)); }
public static FileInfo GetInfo(InputParameters parameters) { Stream inStream = null; try { using (var b = Platform.Instance.ThreadStart()) { inStream = parameters.InputStream; if (inStream == null) { inStream = File.OpenRead(parameters.InputFileName); } var inFormat = GetFormat(parameters.InputFormat, parameters.InputFileName); if (inFormat == null) { throw new PabloException(string.Format("Error: Cannot find format to use for file '{0}'", parameters.InputFileName)); } using (var sourceDoc = inFormat.Info.Create(Platform.Instance)) { sourceDoc.Info.SetOption("animation", "false"); sourceDoc.Info.SetOption("autoresize", "true"); using (var sourceHandler = sourceDoc.CreateHandler()) { var formatId = sourceDoc.Info.OptionID ?? sourceDoc.Info.ID; if (parameters.Options != null) { foreach (var option in sourceDoc.Info.Options) { var optionId = string.Format("{0}-{1}", formatId, option.ID); var val = parameters.Options.FirstOrDefault(r => string.Equals(r.Name, optionId, StringComparison.OrdinalIgnoreCase)); if (val != null) { sourceDoc.Info.SetOption(option.ID, val.Value); } } } sourceDoc.FileName = parameters.InputFileName; sourceDoc.Load(inStream, inFormat, sourceHandler); sourceHandler.Zoom = parameters.Zoom; var drawSize = sourceHandler.DrawSize; if (parameters.MaxWidth != null && drawSize.Width > parameters.MaxWidth.Value) { sourceHandler.Zoom = (float)parameters.MaxWidth.Value / (float)sourceHandler.Size.Width; } drawSize = sourceHandler.DrawSize; return(new FileInfo { ImageWidth = drawSize.Width, ImageHeight = drawSize.Height }); } } } } finally { if (inStream != null && parameters.InputStream == null) { inStream.Dispose(); } } }
public FileInfo GetInfo(InputParameters parameters) { return(EngineInternal.GetInfo(parameters)); }