Exemple #1
0
        public async Task <ActionResult> UpdateImages(string color)
        {
            try
            {
                var generator = new IconsGenerator
                {
                    Color = (Color)ColorConverter.ConvertFromString(color)
                };

                var inputFile = GetDir("Input").GetFiles().FirstOrDefault(x => Exts.Contains(x.Extension));

                var subdir = Session["subdir"] as string;

                if (inputFile != null || subdir == "empty")
                {
                    generator.UpdateIcons();
                    await generator.CreateIcons(GetDir("Output").FullName, inputFile?.FullName);
                }
            }
            catch (Exception ex)
            {
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemple #2
0
        public void CreateIcons()
        {
            foreach (var icon in _iconsGenerator.Icons)
            {
                var elemnet = IconsGenerator.GetRendreable(icon, IconPreview.Source, _iconsGenerator.Color);
                IconsGenerator.CreateIcon(elemnet, icon.Width, icon.Height, Path.Combine(_outputDir, icon.FileName));
            }

            Process.Start(_outputDir);
        }