private static int Run(CommandLineOptions opts) { var files = FileGlobExpander.Expand(opts.Inputs, Reporter); if (files == null) { return(2); } foreach (var file in files) { Reporter.VerboseLine($"Loading file: [{file.FullName}]"); var context = new ParseContext { DisplayedPath = file.Name, FullPath = file.FullName, GeneratedFrames = new List <IcoFrame>(), Reporter = Reporter, }; ExceptionWrapper.Try(() => DoPrintFileInfo(context, opts), context, Reporter); } Reporter.PrintHelpUrls(); return(0); }
private static int Run(CommandLineOptions opts) { CommandContext.SetVerbose(opts.Verbose); var files = FileGlobExpander.Expand(opts.Inputs, Reporter); if (files == null) { return(2); } foreach (var file in files) { Reporter.VerboseLine($"Loading file: [{file.FullName}]"); var context = new ParseContext { DisplayedPath = file.Name, FullPath = file.FullName, GeneratedFrames = new List <IcoFrame>(), Reporter = Reporter, PngEncoder = new SixLabors.ImageSharp.Formats.Png.PngEncoder { CompressionLevel = 9, ColorType = SixLabors.ImageSharp.Formats.Png.PngColorType.RgbWithAlpha, }, }; ExceptionWrapper.Try(() => DoExtractFile(context, opts), context, Reporter); } return(0); }
private static int Run(CommandLineOptions opts) { CommandContext.SetVerbose(opts.Verbose); foreach (var warning in opts.DisabledWarnings) { var munged = warning; if (munged.StartsWith("ico", StringComparison.InvariantCultureIgnoreCase)) { munged = warning.Substring(3); } int code; if (!int.TryParse(munged, out code) || null == Enum.GetName(typeof(IcoErrorCode), code)) { Reporter.ErrorLine(IcoErrorCode.NoError, $"Unknown warning number \"{warning}\""); return(1); } Reporter.WarningsToIgnore.Add((IcoErrorCode)code); } var files = FileGlobExpander.Expand(opts.Inputs, Reporter); if (files == null) { return(2); } foreach (var file in files) { Reporter.VerboseLine($"Loading file: [{file.FullName}]"); var context = new ParseContext { DisplayedPath = file.Name, FullPath = file.FullName, GeneratedFrames = new List <IcoFrame>(), Reporter = Reporter, }; ExceptionWrapper.Try(() => DoLintFile(context, opts), context, Reporter); } Reporter.PrintHelpUrls(); if (Reporter.NumberOfWarningsOrErrors > 0) { return(3); } return(0); }
private static int Run(CommandLineOptions opts) { var context = new ParseContext { PngEncoder = new SixLabors.ImageSharp.Formats.Png.PngEncoder { CompressionLevel = 9, ColorType = SixLabors.ImageSharp.Formats.Png.PngColorType.RgbWithAlpha, }, MaskedImagePixelEmitOptions = opts.MaskedImagePixelEmitOptions, AllowPaletteTruncation = opts.AllowPaletteTruncation, Reporter = Reporter, }; var files = FileGlobExpander.Expand(opts.Inputs, Reporter); if (files == null) { return(2); } foreach (var file in files) { if (file.FullName.EndsWith(".crushed.ico")) { continue; } System.Console.WriteLine($"File: [{file.FullName}]"); context.FullPath = file.FullName; context.DisplayedPath = file.Name; context.GeneratedFrames = new List <IcoFrame>(); DoFile(context, opts); } Reporter.PrintHelpUrls(); return(0); }