public void SetDefaults()
        {
            var korgFileReader = new KorgFileReader();

            _pcgMemory = (PcgMemory)korgFileReader.Read(PcgFileName);

            _generator = new ListGeneratorCombiContentList
            {
                PcgMemory                        = _pcgMemory,
                IgnoreFirstProgram               = false,
                IgnoreMutedOffTimbres            = true,
                IgnoreMutedOffFirstProgramTimbre = true,
                IgnoreInitCombis                 = true,
                SelectedProgramBanks             = new ObservableBankCollection <IProgramBank>(),
                SelectedCombiBanks               = new ObservableBankCollection <ICombiBank>(),
                ListOutputFormat                 = ListGenerator.OutputFormat.Text,
                OutputFileName                   = $"{Path.GetFileNameWithoutExtension(_pcgMemory.FileName)}_output.txt"
            };

            if (_pcgMemory != null)
            {
                foreach (var item in _pcgMemory.ProgramBanks.BankCollection)
                {
                    _generator.SelectedProgramBanks.Add((IProgramBank)item);
                }

                foreach (var item in _pcgMemory.CombiBanks.BankCollection)
                {
                    _generator.SelectedCombiBanks.Add((ICombiBank)item);
                }
            }

            _lines = null;
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        private void ParseParameters()
        {
            // Check there are exactly 4 parameters.
            if (_parameters.Count != 4)
            {
                throw new CommandLineArgumentException(Strings.FourParametersNeededError);
            }

            PcgFileName = _parameters[0];

            // Create generator.
            switch (GetMatch(new List <string> {
                "PATCH_LIST", "PROGRAM_USAGE_LIST", "COMBI_CONTENT_LIST", "DIFFERENCES_LIST",
                "FILE_CONTENT_LIST"
            }, _parameters[1]))
            {
            case "PATCH_LIST":
                ListGenerator = new ListGeneratorPatchList();
                break;

            case "PROGRAM_USAGE_LIST":
                ListGenerator = new ListGeneratorProgramUsageList();
                break;

            case "COMBI_CONTENT_LIST":
                ListGenerator = new ListGeneratorCombiContentList();
                break;

            case "DIFFERENCES_LIST":
                ListGenerator = new ListGeneratorDifferencesList();
                break;

            case "FILE_CONTENT_LIST":
                ListGenerator = new ListGeneratorFileContentList();
                break;

            default:
                throw new CommandLineArgumentException(string.Format(Strings.IllegalListType, _parameters[1]));
            } // Default not needed (exception thrown)

            switch (GetMatch(new List <string> {
                "COMPACT", "SHORT", "DEFAULT"
            }, _parameters[2]))
            {
            case "COMPACT":
                ListGenerator.ListSubType = PcgTools.ListGenerator.ListGenerator.SubType.Compact;
                break;

            case "SHORT":
                ListGenerator.ListSubType = PcgTools.ListGenerator.ListGenerator.SubType.Short;
                break;

            case "DEFAULT":
                // Do nothing
                break;

            default:
                throw new CommandLineArgumentException(string.Format(Strings.IllegalSubType, _parameters[2]));
            }

            ListGenerator.OutputFileName = _parameters[3];
        }