Пример #1
0
        public void LoadArgument(IFormArgument f, int species, int form, int generation)
        {
            FieldsLoaded = false;
            var max = FormConverter.GetFormArgumentMax(species, form, generation);

            if (max == 0)
            {
                CurrentSpecies      = species;
                CurrentForm         = form;
                CurrentGeneration   = generation;
                NUD_FormArg.Value   = CB_FormArg.SelectedIndex = 0;
                CB_FormArg.Visible  = false;
                NUD_FormArg.Visible = false;
                FieldsLoaded        = true;
                return;
            }

            bool named = FormConverter.GetFormArgumentIsNamedIndex(species);

            if (named)
            {
                if (CurrentSpecies == species && CurrentForm == form && CurrentGeneration == generation)
                {
                    CurrentValue = f.FormArgument;
                    FieldsLoaded = true;
                    return;
                }
                IsRawMode = false;

                NUD_FormArg.Visible = false;
                CB_FormArg.Items.Clear();
                var args = FormConverter.GetFormArgumentStrings(species);
                CB_FormArg.Items.AddRange(args);
                CB_FormArg.SelectedIndex = 0;
                CB_FormArg.Visible       = true;
            }
            else
            {
                IsRawMode = true;

                CB_FormArg.Visible  = false;
                NUD_FormArg.Maximum = max;
                NUD_FormArg.Visible = true;
            }
            CurrentSpecies    = species;
            CurrentForm       = form;
            CurrentGeneration = generation;

            if (FormConverter.IsFormArgumentTypeDatePair(species, form))
            {
                CurrentValue = f.FormArgument & 0xFF;
            }
            else
            {
                CurrentValue = f.FormArgument;
            }

            FieldsLoaded = true;
        }