예제 #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
        public string[] ReportSearchResult(TextBox textBox, Label emoteReporterLabel)
        {
            var emoteNames = _emoteResizer.FetchEmoteNames(textBox.Text);

            emoteReporterLabel.Text = $"{((emoteNames.Length == 0) ? "No" : emoteNames.Length)} valid images were found.";

            return(emoteNames);
        }
예제 #3
0
        private static string[] CheckForImages(ref string folderPath)
        {
            while (true)
            {
                var emoteNames = _emoteResizer.FetchEmoteNames(folderPath);

                if (emoteNames.Length == 0)
                {
                    Console.WriteLine("No valid images were found." + Environment.NewLine);
                    folderPath = GetValidPath("Enter the source directory: ");
                }
                else
                {
                    Console.WriteLine(emoteNames.Length + " valid images were found." + Environment.NewLine);
                    return(emoteNames);
                }
            }
        }