<commit_before>﻿using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Management.Automation;

namespace GrafGenerator.ResxPopulate
{
    [Cmdlet(VerbsCommon.Copy, "Resx", DefaultParameterSetName = "DefaultParameterSet")]
    public class CopyResxCommand: PSCmdlet
    {
        private string _path;
        private string[] _cultures;

        #region Parameters

        [Parameter(Position = 0, ParameterSetName = "DefaultParameterSet", Mandatory = true)]
        [ValidateNotNullOrEmpty]
        public string Path
        {
            get { return _path; }
            set { _path = value; }
        }


        [Parameter(Position = 1, ParameterSetName = "DefaultParameterSet", Mandatory = true)]
        [ValidateNotNullOrEmpty]
        public string[] Cultures
        {
            get { return _cultures; }
            set { _cultures = value; }
        }

        #endregion


        #region Overrides

        protected override void BeginProcessing()
        {
            if (!File.Exists(_path))
            {
                ThrowTerminatingError(new ErrorRecord(new FileNotFoundException("Input RESX file not found.", _path),
                    "FileNotFound", ErrorCategory.InvalidArgument, _path));
            }

            _cultures = _cultures
                .Select(c =>
                {
                    try
                    {
                        return CultureInfo.CreateSpecificCulture(c).Name;
                    }<commit_msg>made cultures optional parameter<commit_after>﻿using System;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Management.Automation;

namespace GrafGenerator.ResxPopulate
{
    [Cmdlet(VerbsCommon.Copy, "Resx", DefaultParameterSetName = "DefaultParameterSet")]
    public class CopyResxCommand: PSCmdlet
    {
        private string _path;
        private string[] _cultures;

        #region Parameters

        [Parameter(Position = 0, ParameterSetName = "DefaultParameterSet", Mandatory = true)]
        [ValidateNotNullOrEmpty]
        public string Path
        {
            get { return _path; }
            set { _path = value; }
        }


        [Parameter(Position = 1, ParameterSetName = "DefaultParameterSet", Mandatory = false)]
        public string[] Cultures
        {
            get { return _cultures; }
            set { _cultures = value; }
        }

        #endregion


        #region Overrides

        protected override void BeginProcessing()
        {
            if (!File.Exists(_path))
            {
                ThrowTerminatingError(new ErrorRecord(new FileNotFoundException("Input RESX file not found.", _path),
                    "FileNotFound", ErrorCategory.InvalidArgument, _path));
            }

            if (_cultures == null || _cultures.Length == 0)
            {
                // init defaults
                _cultures = new[] {"ar-AE", "cs-CZ", "el-GR", "es-CL", "kk-KZ", "ky-KG", "ru-RU", "uk-UA"};
            }

            _cultures = _cultures
                .Select(c =>
                {
                    try
                    {
                        return CultureInfo.CreateSpecificCulture(c).Name;
                    }
{'fraction_non_alphanumeric': 0.09161250386877128, 'fraction_numerical': 0.0015475085112968121, 'mean_word_length': 1.7647562018819505, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6808762', 'n_tokens_mistral': 858, 'n_tokens_neox': 805, 'n_words': 191}