PKHeX.Core Nullable cleanup (#2401)
* Handle some nullable cases
Refactor MysteryGift into a second abstract class (backed by a byte array, or fake data)
Make some classes have explicit constructors instead of { } initialization
* Handle bits more obviously without null
* Make SaveFile.BAK explicitly readonly again
* merge constructor methods to have readonly fields
* Inline some properties
* More nullable handling
* Rearrange box actions
define straightforward classes to not have any null properties
* Make extrabyte reference array immutable
* Move tooltip creation to designer
* Rearrange some logic to reduce nesting
* Cache generated fonts
* Split mystery gift album purpose
* Handle more tooltips
* Disallow null setters
* Don't capture RNG object, only type enum
* Unify learnset objects
Now have readonly properties which are never null
don't new() empty learnsets (>800 Learnset objects no longer created,
total of 2400 objects since we also new() a move & level array)
optimize g1/2 reader for early abort case
* Access rewrite
Initialize blocks in a separate object, and get via that object
removes a couple hundred "might be null" warnings since blocks are now readonly getters
some block references have been relocated, but interfaces should expose all that's needed
put HoF6 controls in a groupbox, and disable
* Readonly personal data
* IVs non nullable for mystery gift
* Explicitly initialize forced encounter moves
* Make shadow objects readonly & non-null
Put murkrow fix in binary data resource, instead of on startup
* Assign dex form fetch on constructor
Fixes legality parsing edge cases
also handle cxd parse for valid; exit before exception is thrown in FrameGenerator
* Remove unnecessary null checks
* Keep empty value until init
SetPouch sets the value to an actual one during load, but whatever
* Readonly team lock data
* Readonly locks
Put locked encounters at bottom (favor unlocked)
* Mail readonly data / offset
Rearrange some call flow and pass defaults
Add fake classes for SaveDataEditor mocking
Always party size, no need to check twice in stat editor
use a fake save file as initial data for savedata editor, and for
gamedata (wow i found a usage)
constrain eventwork editor to struct variable types (uint, int, etc),
thus preventing null assignment errors
2019-10-17 01:47:31 +00:00
|
|
|
|
using System.ComponentModel;
|
2017-01-12 01:55:42 +00:00
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.WinForms
|
2015-02-25 04:10:47 +00:00
|
|
|
|
{
|
|
|
|
|
partial class QR
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Required designer variable.
|
|
|
|
|
/// </summary>
|
2017-01-12 01:55:42 +00:00
|
|
|
|
private IContainer components = null;
|
2015-02-25 04:10:47 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Clean up any resources being used.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
|
|
|
protected override void Dispose(bool disposing)
|
|
|
|
|
{
|
|
|
|
|
if (disposing && (components != null))
|
|
|
|
|
{
|
|
|
|
|
components.Dispose();
|
|
|
|
|
}
|
|
|
|
|
base.Dispose(disposing);
|
2020-04-12 20:20:40 +00:00
|
|
|
|
qr.Dispose();
|
2015-02-25 04:10:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region Windows Form Designer generated code
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Required method for Designer support - do not modify
|
|
|
|
|
/// the contents of this method with the code editor.
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void InitializeComponent()
|
|
|
|
|
{
|
2023-04-22 03:47:04 +00:00
|
|
|
|
PB_QR = new PictureBox();
|
|
|
|
|
NUD_Box = new NumericUpDown();
|
|
|
|
|
label1 = new Label();
|
|
|
|
|
label2 = new Label();
|
|
|
|
|
NUD_Slot = new NumericUpDown();
|
|
|
|
|
label3 = new Label();
|
|
|
|
|
NUD_Copies = new NumericUpDown();
|
|
|
|
|
B_Refresh = new Button();
|
|
|
|
|
splitContainer1 = new SplitContainer();
|
|
|
|
|
((ISupportInitialize)PB_QR).BeginInit();
|
|
|
|
|
((ISupportInitialize)NUD_Box).BeginInit();
|
|
|
|
|
((ISupportInitialize)NUD_Slot).BeginInit();
|
|
|
|
|
((ISupportInitialize)NUD_Copies).BeginInit();
|
|
|
|
|
((ISupportInitialize)splitContainer1).BeginInit();
|
|
|
|
|
splitContainer1.Panel1.SuspendLayout();
|
|
|
|
|
splitContainer1.Panel2.SuspendLayout();
|
|
|
|
|
splitContainer1.SuspendLayout();
|
|
|
|
|
SuspendLayout();
|
2015-02-25 04:10:47 +00:00
|
|
|
|
//
|
|
|
|
|
// PB_QR
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
PB_QR.BackgroundImageLayout = ImageLayout.None;
|
|
|
|
|
PB_QR.Dock = DockStyle.Fill;
|
|
|
|
|
PB_QR.Location = new System.Drawing.Point(0, 0);
|
|
|
|
|
PB_QR.Margin = new Padding(4, 3, 4, 3);
|
|
|
|
|
PB_QR.Name = "PB_QR";
|
|
|
|
|
PB_QR.Size = new System.Drawing.Size(331, 203);
|
|
|
|
|
PB_QR.SizeMode = PictureBoxSizeMode.AutoSize;
|
|
|
|
|
PB_QR.TabIndex = 0;
|
|
|
|
|
PB_QR.TabStop = false;
|
|
|
|
|
PB_QR.Click += PB_QR_Click;
|
2015-02-25 07:19:00 +00:00
|
|
|
|
//
|
2016-11-17 03:47:41 +00:00
|
|
|
|
// NUD_Box
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
NUD_Box.Location = new System.Drawing.Point(43, 10);
|
|
|
|
|
NUD_Box.Margin = new Padding(4, 3, 4, 3);
|
|
|
|
|
NUD_Box.Maximum = new decimal(new int[] { 32, 0, 0, 0 });
|
|
|
|
|
NUD_Box.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
|
|
|
|
NUD_Box.Name = "NUD_Box";
|
|
|
|
|
NUD_Box.Size = new System.Drawing.Size(71, 23);
|
|
|
|
|
NUD_Box.TabIndex = 2;
|
|
|
|
|
NUD_Box.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
2016-11-17 03:47:41 +00:00
|
|
|
|
//
|
|
|
|
|
// label1
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
label1.AutoSize = true;
|
|
|
|
|
label1.Location = new System.Drawing.Point(4, 13);
|
|
|
|
|
label1.Margin = new Padding(4, 0, 4, 0);
|
|
|
|
|
label1.Name = "label1";
|
|
|
|
|
label1.Size = new System.Drawing.Size(30, 15);
|
|
|
|
|
label1.TabIndex = 3;
|
|
|
|
|
label1.Text = "Box:";
|
2016-11-17 03:47:41 +00:00
|
|
|
|
//
|
|
|
|
|
// label2
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
label2.AutoSize = true;
|
|
|
|
|
label2.Location = new System.Drawing.Point(121, 13);
|
|
|
|
|
label2.Margin = new Padding(4, 0, 4, 0);
|
|
|
|
|
label2.Name = "label2";
|
|
|
|
|
label2.Size = new System.Drawing.Size(30, 15);
|
|
|
|
|
label2.TabIndex = 5;
|
|
|
|
|
label2.Text = "Slot:";
|
2016-11-17 03:47:41 +00:00
|
|
|
|
//
|
|
|
|
|
// NUD_Slot
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
NUD_Slot.Location = new System.Drawing.Point(161, 10);
|
|
|
|
|
NUD_Slot.Margin = new Padding(4, 3, 4, 3);
|
|
|
|
|
NUD_Slot.Maximum = new decimal(new int[] { 30, 0, 0, 0 });
|
|
|
|
|
NUD_Slot.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
|
|
|
|
NUD_Slot.Name = "NUD_Slot";
|
|
|
|
|
NUD_Slot.Size = new System.Drawing.Size(71, 23);
|
|
|
|
|
NUD_Slot.TabIndex = 4;
|
|
|
|
|
NUD_Slot.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
2016-11-17 03:47:41 +00:00
|
|
|
|
//
|
|
|
|
|
// label3
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
label3.AutoSize = true;
|
|
|
|
|
label3.Location = new System.Drawing.Point(245, 13);
|
|
|
|
|
label3.Margin = new Padding(4, 0, 4, 0);
|
|
|
|
|
label3.Name = "label3";
|
|
|
|
|
label3.Size = new System.Drawing.Size(46, 15);
|
|
|
|
|
label3.TabIndex = 7;
|
|
|
|
|
label3.Text = "Copies:";
|
2016-11-17 03:47:41 +00:00
|
|
|
|
//
|
|
|
|
|
// NUD_Copies
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
NUD_Copies.Location = new System.Drawing.Point(301, 10);
|
|
|
|
|
NUD_Copies.Margin = new Padding(4, 3, 4, 3);
|
|
|
|
|
NUD_Copies.Maximum = new decimal(new int[] { 960, 0, 0, 0 });
|
|
|
|
|
NUD_Copies.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
|
|
|
|
|
NUD_Copies.Name = "NUD_Copies";
|
|
|
|
|
NUD_Copies.Size = new System.Drawing.Size(61, 23);
|
|
|
|
|
NUD_Copies.TabIndex = 6;
|
|
|
|
|
NUD_Copies.Value = new decimal(new int[] { 1, 0, 0, 0 });
|
2016-11-17 03:47:41 +00:00
|
|
|
|
//
|
|
|
|
|
// B_Refresh
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
B_Refresh.Location = new System.Drawing.Point(369, 9);
|
|
|
|
|
B_Refresh.Margin = new Padding(4, 3, 4, 3);
|
|
|
|
|
B_Refresh.Name = "B_Refresh";
|
|
|
|
|
B_Refresh.Size = new System.Drawing.Size(93, 27);
|
|
|
|
|
B_Refresh.TabIndex = 8;
|
|
|
|
|
B_Refresh.Text = "Refresh";
|
|
|
|
|
B_Refresh.UseVisualStyleBackColor = true;
|
|
|
|
|
B_Refresh.Click += UpdateBoxSlotCopies;
|
2016-11-17 03:47:41 +00:00
|
|
|
|
//
|
2019-12-24 04:16:34 +00:00
|
|
|
|
// splitContainer1
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
splitContainer1.IsSplitterFixed = true;
|
|
|
|
|
splitContainer1.Location = new System.Drawing.Point(0, 0);
|
|
|
|
|
splitContainer1.Margin = new Padding(4, 3, 4, 3);
|
|
|
|
|
splitContainer1.Name = "splitContainer1";
|
|
|
|
|
splitContainer1.Orientation = Orientation.Horizontal;
|
2019-12-24 04:16:34 +00:00
|
|
|
|
//
|
|
|
|
|
// splitContainer1.Panel1
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
splitContainer1.Panel1.Controls.Add(NUD_Box);
|
|
|
|
|
splitContainer1.Panel1.Controls.Add(B_Refresh);
|
|
|
|
|
splitContainer1.Panel1.Controls.Add(label1);
|
|
|
|
|
splitContainer1.Panel1.Controls.Add(label3);
|
|
|
|
|
splitContainer1.Panel1.Controls.Add(NUD_Slot);
|
|
|
|
|
splitContainer1.Panel1.Controls.Add(NUD_Copies);
|
|
|
|
|
splitContainer1.Panel1.Controls.Add(label2);
|
|
|
|
|
splitContainer1.Panel1MinSize = 34;
|
2019-12-24 04:16:34 +00:00
|
|
|
|
//
|
|
|
|
|
// splitContainer1.Panel2
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
splitContainer1.Panel2.Controls.Add(PB_QR);
|
|
|
|
|
splitContainer1.Size = new System.Drawing.Size(331, 243);
|
|
|
|
|
splitContainer1.SplitterDistance = 39;
|
|
|
|
|
splitContainer1.SplitterWidth = 1;
|
|
|
|
|
splitContainer1.TabIndex = 9;
|
2019-12-24 04:16:34 +00:00
|
|
|
|
//
|
2015-02-25 04:10:47 +00:00
|
|
|
|
// QR
|
|
|
|
|
//
|
2023-04-22 03:47:04 +00:00
|
|
|
|
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
|
|
|
|
AutoScaleMode = AutoScaleMode.Font;
|
|
|
|
|
AutoSize = true;
|
|
|
|
|
ClientSize = new System.Drawing.Size(331, 243);
|
|
|
|
|
Controls.Add(splitContainer1);
|
|
|
|
|
FormBorderStyle = FormBorderStyle.FixedSingle;
|
|
|
|
|
Icon = Properties.Resources.Icon;
|
|
|
|
|
Margin = new Padding(4, 3, 4, 3);
|
|
|
|
|
MaximizeBox = false;
|
|
|
|
|
MinimizeBox = false;
|
|
|
|
|
Name = "QR";
|
|
|
|
|
StartPosition = FormStartPosition.CenterParent;
|
|
|
|
|
Text = "PKHeX QR Code (Click QR to Copy Image)";
|
|
|
|
|
((ISupportInitialize)PB_QR).EndInit();
|
|
|
|
|
((ISupportInitialize)NUD_Box).EndInit();
|
|
|
|
|
((ISupportInitialize)NUD_Slot).EndInit();
|
|
|
|
|
((ISupportInitialize)NUD_Copies).EndInit();
|
|
|
|
|
splitContainer1.Panel1.ResumeLayout(false);
|
|
|
|
|
splitContainer1.Panel1.PerformLayout();
|
|
|
|
|
splitContainer1.Panel2.ResumeLayout(false);
|
|
|
|
|
splitContainer1.Panel2.PerformLayout();
|
|
|
|
|
((ISupportInitialize)splitContainer1).EndInit();
|
|
|
|
|
splitContainer1.ResumeLayout(false);
|
|
|
|
|
ResumeLayout(false);
|
2015-02-25 04:10:47 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
2017-01-12 01:55:42 +00:00
|
|
|
|
private PictureBox PB_QR;
|
|
|
|
|
private NumericUpDown NUD_Box;
|
|
|
|
|
private Label label1;
|
|
|
|
|
private Label label2;
|
|
|
|
|
private NumericUpDown NUD_Slot;
|
|
|
|
|
private Label label3;
|
|
|
|
|
private NumericUpDown NUD_Copies;
|
|
|
|
|
private Button B_Refresh;
|
2019-12-24 04:16:34 +00:00
|
|
|
|
private SplitContainer splitContainer1;
|
2015-02-25 04:10:47 +00:00
|
|
|
|
}
|
2022-06-18 18:04:24 +00:00
|
|
|
|
}
|