<commit_before>﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using ModAnalyzer.Domain;
using ModAnalyzer.Messages;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Windows.Input;

namespace ModAnalyzer.ViewModels {
    public class ClassifyArchivesViewModel : ViewModelBase {
        public ObservableCollection<ModOption> ArchiveModOptions { get; set; }
        public ICommand AnalyzeCommand { get; set; }

        public ClassifyArchivesViewModel() {
            ArchiveModOptions = new ObservableCollection<ModOption>();
            AnalyzeCommand = new RelayCommand(() => MessengerInstance.Send(new ArchiveModOptionsSelectedMessage(ArchiveModOptions.ToList())));

            MessengerInstance.Register<FilesSelectedMessage>(this, OnFilesSelected);
        }

        private void OnFilesSelected(FilesSelectedMessage message) {
            ArchiveModOptions.Clear();

            foreach (string file in message.FilePaths)
                ArchiveModOptions.Add(new ModOption(Path.GetFileName(file), false, false) { SourceFilePath = file });

            if (message.FilePaths.Count == 1) {
                ArchiveModOptions.First().Default = true;
                MessengerInstance.Send(new ArchiveModOptionsSelectedMessage(ArchiveModOptions.ToList()));
            }
        }
    }
}<commit_msg>fix to ensure at least 1 archive is marked 'Default'<commit_after>﻿using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using ModAnalyzer.Domain;
using ModAnalyzer.Messages;
using System.Collections.ObjectModel;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Input;

namespace ModAnalyzer.ViewModels {
    public class ClassifyArchivesViewModel : ViewModelBase {
        public ObservableCollection<ModOption> ArchiveModOptions { get; set; }
        public ICommand AnalyzeCommand { get; set; }

        public ClassifyArchivesViewModel() {
            ArchiveModOptions = new ObservableCollection<ModOption>();
            AnalyzeCommand = new RelayCommand(AnalyzeMod);

            MessengerInstance.Register<FilesSelectedMessage>(this, OnFilesSelected);
        }
                
        private void OnFilesSelected(FilesSelectedMessage message) {
            ArchiveModOptions.Clear();
            
            foreach (string file in message.FilePaths)
                ArchiveModOptions.Add(new ModOption(Path.GetFileName(file), false, false) { SourceFilePath = file });

            if (message.FilePaths.Count == 1) {
                ArchiveModOptions.First().Default = true;
                MessengerInstance.Send(new ArchiveModOptionsSelectedMessage(ArchiveModOptions.ToList()));
            }
        }

        private void AnalyzeMod() {
            if (ArchiveModOptions.Any(modOption => modOption.Default)) {
                MessengerInstance.Send(new ArchiveModOptionsSelectedMessage(ArchiveModOptions.ToList()));
            } else {
                MessageBox.Show("Please specify at least 1 default archive.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
    }
}
{'fraction_non_alphanumeric': 0.08691468890314304, 'fraction_numerical': 0.0012828736369467607, 'mean_word_length': 3.0453955901426717, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5894763', 'n_tokens_mistral': 812, 'n_tokens_neox': 762, 'n_words': 162}