예제 #1
0
        private void ResizeButton_Click(object sender, EventArgs e)
        {
            if (_emoteNames is null || _emoteNames.Length == 0 || OutputLink.Text == string.Empty)
            {
                return;
            }

            // Ensure the images in the folder are up-to-date
            _emoteNames = _emoteResizer.FetchEmoteNames(SourceTextBox.Text);

            // Update config object in preparation for the serialization
            _config.SourceDirectory = SourceTextBox.Text;
            _config.OutputDirectory = OutputTextBox.Text;

            try
            {
                _ = _emoteResizer.ProcessEmotes(_emoteNames, SourceTextBox.Text, OutputTextBox.Text); // Save emotes to output folder
                _uiService.SaveConfig(_config, _configPath);                                          // Save config file
                EmoteReporterLabel.Text = $"{_emoteNames.Length} images were successfully resized.";
            }
            catch (Exception ex)
            {
                new ErrorWindow($"Please, make sure the Source and Output folders exist and are not read-only. [{ex.Message}]").Show();
            }
        }
예제 #2
0
        private static void Main(string[] args)
        {
            string sourcePath = GetValidPath("Enter the source directory: ");   // Get source directory

            string[] emoteNames = CheckForImages(ref sourcePath);               // Check if there is a valid image in the source directory
            string   outputPath = GetValidPath("Enter the output directory: "); // Get output directory


            // Resize and save emotes to the output directory
            Console.WriteLine("Working..." + Environment.NewLine);
            _emoteResizer.ProcessEmotes(emoteNames, sourcePath, outputPath);
            Console.WriteLine(emoteNames.Length + " emotes were saved to " + outputPath);
        }