public void GetFlagUrlByCountryNameReturnsUSFlagUrl() { var flagLoader = new FlagLoader(); var result = flagLoader.GetFlagUrlByCountryName("USA"); Assert.AreEqual("https://www.countryflags.io/us/flat/64.png", result); }
//This program complies with the NO_COLOR standard as it uses the Pastel library. static void Main(string[] args) { Parser parser = new Parser(config => config.HelpWriter = null); ParserResult <Options> parseResult = parser.ParseArguments <Options>(args); parseResult.WithNotParsed(err => DisplayHelp(parseResult)); parseResult.WithParsed(o => { FlagLoader loader = new FlagLoader(); Dictionary <string, PrideFlag> flagDict = loader.LoadFlags("Flag JSONs"); if (!flagDict.TryGetValue(o.FlagType, out PrideFlag flagPath)) { LogError($"{o.FlagType} isn't a valid flag type!\n"); Console.WriteLine("---Flag Types---".Pastel(Color.CornflowerBlue)); foreach (KeyValuePair <string, PrideFlag> pair in flagDict) { WriteHeaders(pair.Value, false, true); } Environment.Exit(1); } WriteHeaders(flagPath); Console.WriteLine("\nMaking image...".Pastel(Color.LightGreen)); ImageProcessing processing = new ImageProcessing(); Bitmap imageFile = null; Bitmap flag = null; try { imageFile = processing.LoadAndResizeBmp(o.ImageFile, o.Size, o.Size); flag = processing.LoadAndResizeBmp("Flags/" + flagPath.FlagFile, o.Size, o.Size); } catch (Exception ex) { LogError(ex.StackTrace, true); } Bitmap croppedBmp = processing.CropPicture(ref imageFile, o.Size, false); Bitmap flagBmp = processing.CropFlag(ref flag, o.PixelMargin); Bitmap finalBmp = processing.StitchTogether(ref flagBmp, ref croppedBmp, o.InnerSize); try { finalBmp.Save(o.Output, ImageFormat.Png); } catch (Exception ex) { LogError(ex.StackTrace, true); } Console.WriteLine($"Success! Saved image \"{o.Output}\"".Pastel(Color.SpringGreen)); Console.WriteLine($"FlagPFP, by Aesthetical#9203, 2021.".Pastel(Color.PaleTurquoise)); Environment.Exit(0); }); }