private void SetRecord(int spec, int form) { bool hasRecord = Zukan7b.TryGetSizeEntryIndex(spec, form, out var index); if (!hasRecord) { return; }
private void SetRecord(int spec, int form) { bool hasRecord = Zukan7b.TryGetSizeEntryIndex(spec, form, out var index); if (!hasRecord) { return; } int get(NumericUpDown nud, CheckBox ck) => !ck.Checked ? Zukan7b.DefaultEntryValue : (int)Math.Max(0, Math.Min(255, nud.Value)); Dex.SetSizeData(DexSizeType.MinHeight, index, get(NUD_RHeightMin, CHK_RMinHeight), get(NUD_RHeightMinWeight, CHK_RMinHeight)); Dex.SetSizeData(DexSizeType.MaxHeight, index, get(NUD_RHeightMax, CHK_RMaxHeight), get(NUD_RHeightMaxWeight, CHK_RMaxHeight)); Dex.SetSizeData(DexSizeType.MinWeight, index, get(NUD_RWeightMinHeight, CHK_RMinWeight), get(NUD_RWeightMin, CHK_RMinWeight)); Dex.SetSizeData(DexSizeType.MaxWeight, index, get(NUD_RWeightMaxHeight, CHK_RMaxWeight), get(NUD_RWeightMax, CHK_RMaxWeight)); }
private void LoadRecord(int spec, int form) { bool hasRecord = Zukan7b.TryGetSizeEntryIndex(spec, form, out var index); GB_SizeRecords.Visible = hasRecord; if (!hasRecord) { return; } void set(DexSizeType type, NumericUpDown nudH, NumericUpDown nudW, CheckBox ck) { nudH.Enabled = nudW.Enabled = ck.Checked = Dex.GetSizeData(type, index, out int h, out int w); nudH.Value = h; nudW.Value = w; } set(DexSizeType.MinHeight, NUD_RHeightMin, NUD_RHeightMinWeight, CHK_RMinHeight); set(DexSizeType.MaxHeight, NUD_RHeightMax, NUD_RHeightMaxWeight, CHK_RMaxHeight); set(DexSizeType.MinWeight, NUD_RWeightMinHeight, NUD_RWeightMin, CHK_RMinWeight); set(DexSizeType.MaxWeight, NUD_RWeightMaxHeight, NUD_RWeightMax, CHK_RMaxWeight); }