mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-22 20:13:06 +00:00
pk2pk & Import Code
This commit is contained in:
parent
d37838c4d5
commit
691ad75730
8 changed files with 6850 additions and 313 deletions
93
CodeImportPKM.Designer.cs
generated
Normal file
93
CodeImportPKM.Designer.cs
generated
Normal file
|
@ -0,0 +1,93 @@
|
|||
namespace PKHeX
|
||||
{
|
||||
partial class CodeImportPKM
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <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);
|
||||
}
|
||||
|
||||
#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()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CodeImportPKM));
|
||||
this.RTB_Code = new System.Windows.Forms.RichTextBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.B_Paste = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// RTB_Code
|
||||
//
|
||||
this.RTB_Code.Location = new System.Drawing.Point(8, 38);
|
||||
this.RTB_Code.Name = "RTB_Code";
|
||||
this.RTB_Code.ReadOnly = true;
|
||||
this.RTB_Code.Size = new System.Drawing.Size(149, 168);
|
||||
this.RTB_Code.TabIndex = 0;
|
||||
this.RTB_Code.Text = "";
|
||||
this.RTB_Code.WordWrap = false;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Location = new System.Drawing.Point(87, 7);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(70, 25);
|
||||
this.button1.TabIndex = 1;
|
||||
this.button1.Text = "Import";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.B_Import_Click);
|
||||
//
|
||||
// B_Paste
|
||||
//
|
||||
this.B_Paste.Location = new System.Drawing.Point(8, 7);
|
||||
this.B_Paste.Name = "B_Paste";
|
||||
this.B_Paste.Size = new System.Drawing.Size(70, 25);
|
||||
this.B_Paste.TabIndex = 2;
|
||||
this.B_Paste.Text = "Paste";
|
||||
this.B_Paste.UseVisualStyleBackColor = true;
|
||||
this.B_Paste.Click += new System.EventHandler(this.B_Paste_Click);
|
||||
//
|
||||
// CodeImportPKM
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(164, 212);
|
||||
this.Controls.Add(this.B_Paste);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.RTB_Code);
|
||||
this.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "CodeImportPKM";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Code Import";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.RichTextBox RTB_Code;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button B_Paste;
|
||||
}
|
||||
}
|
76
CodeImportPKM.cs
Normal file
76
CodeImportPKM.cs
Normal file
|
@ -0,0 +1,76 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Globalization;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace PKHeX
|
||||
{
|
||||
public partial class CodeImportPKM : Form
|
||||
{
|
||||
public CodeImportPKM()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.returnArray = null;
|
||||
}
|
||||
public byte[] returnArray { get; set; }
|
||||
private void B_Paste_Click(object sender, EventArgs e)
|
||||
{
|
||||
RTB_Code.Text = Clipboard.GetText();
|
||||
}
|
||||
|
||||
private void B_Import_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Gotta read in the textbox.
|
||||
if (RTB_Code.Text.Length < 1) return;
|
||||
byte[] data = new Byte[0];
|
||||
// Get Actual Lines
|
||||
for (int i = 0; i < RTB_Code.Lines.Count(); i++)
|
||||
{
|
||||
if (RTB_Code.Lines[i].Length > 0)
|
||||
{
|
||||
if (RTB_Code.Lines[i].Length <= 2 * 8 && RTB_Code.Lines[i].Length > 2 * 8 + 2)
|
||||
{
|
||||
MessageBox.Show("Invalid code pasted (Type)", "Error"); return;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
// Grab Line Data
|
||||
string line = RTB_Code.Lines[i];
|
||||
string[] rip = Regex.Split(line, " ");
|
||||
Array.Resize(ref data, data.Length + 4);
|
||||
Array.Copy(BitConverter.GetBytes(UInt32.Parse(rip[1], NumberStyles.HexNumber)), 0, data, data.Length - 4, 4);
|
||||
}
|
||||
catch
|
||||
{
|
||||
MessageBox.Show("Invalid code pasted (Content)", "Error"); return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Go over the data
|
||||
if ((data.Length == 232 - 4) || (data.Length == 260 - 4))
|
||||
{
|
||||
Array.Resize(ref data, data.Length + 4);
|
||||
Array.Copy(data, 0, data, 4, data.Length);
|
||||
data[0] = data[1] = data[2] = data[3] = 0;
|
||||
}
|
||||
if ((data.Length == 232) || (data.Length == 260))
|
||||
{
|
||||
this.returnArray = data;
|
||||
this.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Invalid code pasted (Length)", "Error"); return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
216
CodeImportPKM.resx
Normal file
216
CodeImportPKM.resx
Normal file
|
@ -0,0 +1,216 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
AAABAAIAEBAAAAEAIABoBAAAJgA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p8gsLKfILCynyCwsp8gsLKfILCynyCwsp8gsLKfILCynyCwsp8gsLKfILCynyDExqcU2NpenLi54Shsb
|
||||
ewMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
||||
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//////////8AAAD+AAAAfAAAADwAAAA8AAAAPAAAADwAAAA8AA
|
||||
AAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AAAAPAAAADwAAAA8AA
|
||||
AAPAAAADwAAAA8AAAAPAAAAD4AAAB/gAAB//////
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
10
PKHeX.csproj
10
PKHeX.csproj
|
@ -77,6 +77,12 @@
|
|||
<Compile Include="CodeGenerator.Designer.cs">
|
||||
<DependentUpon>CodeGenerator.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="CodeImportPKM.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="CodeImportPKM.Designer.cs">
|
||||
<DependentUpon>CodeImportPKM.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="f1-Main.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
|
@ -101,6 +107,7 @@
|
|||
<Compile Include="frmReport.Designer.cs">
|
||||
<DependentUpon>frmReport.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="pk2pk.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
|
@ -183,6 +190,9 @@
|
|||
<EmbeddedResource Include="CodeGenerator.resx">
|
||||
<DependentUpon>CodeGenerator.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="CodeImportPKM.resx">
|
||||
<DependentUpon>CodeImportPKM.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="f1-Main.resx">
|
||||
<DependentUpon>f1-Main.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
25
f1-Main.Designer.cs
generated
25
f1-Main.Designer.cs
generated
|
@ -323,6 +323,7 @@
|
|||
this.GB_SAVtools = new System.Windows.Forms.GroupBox();
|
||||
this.L_SAVINDEX = new System.Windows.Forms.Label();
|
||||
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
|
||||
this.B_ImportCode = new System.Windows.Forms.Button();
|
||||
this.tabMain.SuspendLayout();
|
||||
this.Tab_Main.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.Label_IsShiny)).BeginInit();
|
||||
|
@ -3517,6 +3518,7 @@
|
|||
//
|
||||
// Tab_Tools
|
||||
//
|
||||
this.Tab_Tools.Controls.Add(this.B_ImportCode);
|
||||
this.Tab_Tools.Controls.Add(this.B_BoxIO);
|
||||
this.Tab_Tools.Controls.Add(this.B_JPEG);
|
||||
this.Tab_Tools.Controls.Add(this.B_OUTHallofFame);
|
||||
|
@ -3532,7 +3534,7 @@
|
|||
//
|
||||
// B_BoxIO
|
||||
//
|
||||
this.B_BoxIO.Location = new System.Drawing.Point(9, 12);
|
||||
this.B_BoxIO.Location = new System.Drawing.Point(3, 3);
|
||||
this.B_BoxIO.Name = "B_BoxIO";
|
||||
this.B_BoxIO.Size = new System.Drawing.Size(75, 46);
|
||||
this.B_BoxIO.TabIndex = 6;
|
||||
|
@ -3543,7 +3545,7 @@
|
|||
// B_JPEG
|
||||
//
|
||||
this.B_JPEG.Enabled = false;
|
||||
this.B_JPEG.Location = new System.Drawing.Point(91, 12);
|
||||
this.B_JPEG.Location = new System.Drawing.Point(89, 3);
|
||||
this.B_JPEG.Name = "B_JPEG";
|
||||
this.B_JPEG.Size = new System.Drawing.Size(75, 46);
|
||||
this.B_JPEG.TabIndex = 5;
|
||||
|
@ -3554,7 +3556,7 @@
|
|||
// B_OUTHallofFame
|
||||
//
|
||||
this.B_OUTHallofFame.Enabled = false;
|
||||
this.B_OUTHallofFame.Location = new System.Drawing.Point(173, 12);
|
||||
this.B_OUTHallofFame.Location = new System.Drawing.Point(173, 3);
|
||||
this.B_OUTHallofFame.Name = "B_OUTHallofFame";
|
||||
this.B_OUTHallofFame.Size = new System.Drawing.Size(75, 23);
|
||||
this.B_OUTHallofFame.TabIndex = 4;
|
||||
|
@ -3565,10 +3567,10 @@
|
|||
// RTB_T
|
||||
//
|
||||
this.RTB_T.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.RTB_T.Location = new System.Drawing.Point(1, 68);
|
||||
this.RTB_T.Location = new System.Drawing.Point(1, 78);
|
||||
this.RTB_T.Name = "RTB_T";
|
||||
this.RTB_T.ReadOnly = true;
|
||||
this.RTB_T.Size = new System.Drawing.Size(255, 130);
|
||||
this.RTB_T.Size = new System.Drawing.Size(255, 120);
|
||||
this.RTB_T.TabIndex = 1;
|
||||
this.RTB_T.Text = "";
|
||||
this.RTB_T.WordWrap = false;
|
||||
|
@ -3576,7 +3578,7 @@
|
|||
// B_OUTPasserby
|
||||
//
|
||||
this.B_OUTPasserby.Enabled = false;
|
||||
this.B_OUTPasserby.Location = new System.Drawing.Point(173, 35);
|
||||
this.B_OUTPasserby.Location = new System.Drawing.Point(173, 26);
|
||||
this.B_OUTPasserby.Name = "B_OUTPasserby";
|
||||
this.B_OUTPasserby.Size = new System.Drawing.Size(75, 23);
|
||||
this.B_OUTPasserby.TabIndex = 0;
|
||||
|
@ -3795,6 +3797,16 @@
|
|||
this.notifyIcon1.Text = "notifyIcon1";
|
||||
this.notifyIcon1.Visible = true;
|
||||
//
|
||||
// B_ImportCode
|
||||
//
|
||||
this.B_ImportCode.Location = new System.Drawing.Point(3, 51);
|
||||
this.B_ImportCode.Name = "B_ImportCode";
|
||||
this.B_ImportCode.Size = new System.Drawing.Size(161, 23);
|
||||
this.B_ImportCode.TabIndex = 7;
|
||||
this.B_ImportCode.Text = "Import PK6 from Code";
|
||||
this.B_ImportCode.UseVisualStyleBackColor = true;
|
||||
this.B_ImportCode.Click += new System.EventHandler(this.B_ImportCode_Click);
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
@ -4214,6 +4226,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem codeGeneratorToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem reportToolStripMenuItem;
|
||||
private System.Windows.Forms.NotifyIcon notifyIcon1;
|
||||
private System.Windows.Forms.Button B_ImportCode;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
378
f1-Main.cs
378
f1-Main.cs
|
@ -4014,7 +4014,16 @@ namespace PKHeX
|
|||
|
||||
// Setup Forms
|
||||
getForms(species);
|
||||
try
|
||||
{
|
||||
CB_Form.SelectedIndex = altforms;
|
||||
}
|
||||
catch
|
||||
{
|
||||
if (CB_Form.Items.Count > 1)
|
||||
CB_Form.SelectedIndex = CB_Form.Items.Count-1;
|
||||
else CB_Form.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
// Load Extrabyte Value
|
||||
TB_ExtraByte.Text = buff[Convert.ToInt32(CB_ExtraBytes.Text, 16)].ToString();
|
||||
|
@ -6033,7 +6042,7 @@ namespace PKHeX
|
|||
// Main Menu Subfunctions //
|
||||
private void openfile(byte[] input, string path, string ext)
|
||||
{
|
||||
// Trade Packets
|
||||
#region Trade Packets
|
||||
if ((input.Length == 363) && (input[0x6B] == 0) && (input[0x6C] == 00))
|
||||
{
|
||||
// EAD Packet of 363 length
|
||||
|
@ -6048,6 +6057,8 @@ namespace PKHeX
|
|||
Array.Copy(input, 0x93, c, 0, 260);
|
||||
input = c;
|
||||
}
|
||||
#endregion
|
||||
#region Saves
|
||||
else if ((input.Length == 0x65600) && BitConverter.ToUInt32(input,0x65410) == 0x42454546)
|
||||
{
|
||||
// Load CyberGadget
|
||||
|
@ -6084,8 +6095,7 @@ namespace PKHeX
|
|||
return;
|
||||
}
|
||||
// Verify the Data Input Size is Proper
|
||||
#region SAVE FILE LOADING
|
||||
if (input.Length == 0x100000)
|
||||
else if (input.Length == 0x100000)
|
||||
{
|
||||
B_ExportSAV.Enabled = false;
|
||||
B_SwitchSAV.Enabled = false;
|
||||
|
@ -6141,13 +6151,14 @@ namespace PKHeX
|
|||
B_OUTPasserby.Enabled = B_OUTHallofFame.Enabled = B_JPEG.Enabled = true;
|
||||
}
|
||||
#endregion
|
||||
#region PK6/EK6
|
||||
else if ((input.Length == 260) || (input.Length == 232))
|
||||
{
|
||||
// Check if Input is PKX
|
||||
if ((ext == ".pk6") || (ext == ".ek6") || (ext == ".pkx") || (ext == ".ekx") || (ext == ".bin") || (ext == ""))
|
||||
{
|
||||
// Check if either is encrypted from another program.
|
||||
if ((input[0xC8] == 0) && (input[0xC9] == 0) && (input[0x58] == 0) && (input[0x59] == 0))
|
||||
if (BitConverter.ToUInt16(input,0xC8) == 0 && BitConverter.ToUInt16(input,0x58) == 0)
|
||||
{ // File isn't encrypted.
|
||||
buff = input;
|
||||
populatefields(buff);
|
||||
|
@ -6159,51 +6170,44 @@ namespace PKHeX
|
|||
populatefields(buff);
|
||||
}
|
||||
}
|
||||
else // to convert g5pkm
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
buff = convertPK5toPK6(input);
|
||||
populatefields(buff);
|
||||
string message = "Loaded previous generation PKM. Conversion attempted.";
|
||||
string caption = "Alert";
|
||||
MessageBox.Show(message, caption);
|
||||
}
|
||||
catch
|
||||
{
|
||||
string message = "Foreign File Extension.\nOnly .pk* .ek* .bin supported.";
|
||||
string message = "Foreign File.\nOnly valid .pk* .ek* .bin supported.";
|
||||
string caption = "Error Detected in Input";
|
||||
MessageBox.Show(message, caption);
|
||||
}
|
||||
}
|
||||
// End Work
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((input.Length == 136) || (input.Length == 220)) // to convert g5pkm
|
||||
#endregion
|
||||
#region PK3/PK4/PK5
|
||||
else if ((input.Length == 136) || (input.Length == 220) || (input.Length == 236) || (input.Length == 100) || (input.Length == 80)) // to convert g5pkm
|
||||
{
|
||||
var Converter = new PKHeX.pk2pk();
|
||||
if (!Converter.verifychk(input)) MessageBox.Show("Invalid File (Checksum Error)", "Error");
|
||||
try // to convert g5pkm
|
||||
{
|
||||
buff = convertPK5toPK6(input);
|
||||
byte[] data = Converter.ConvertPKM(input,savefile, savindex);
|
||||
Array.Copy(data, buff, 232);
|
||||
populatefields(buff);
|
||||
string message = "Loaded previous generation PKM. Conversion attempted.";
|
||||
string caption = "Alert";
|
||||
MessageBox.Show(message, caption);
|
||||
// string message = "Loaded previous generation PKM. Conversion attempted.";
|
||||
// string caption = "Alert";
|
||||
// MessageBox.Show(message, caption);
|
||||
}
|
||||
catch
|
||||
{
|
||||
string message = "Loaded previous generation PKM. Conversion failed.";
|
||||
Array.Copy(new Byte[232], buff, 232);
|
||||
populatefields(buff);
|
||||
string message = "Attempted to load previous generation PKM.\n\nConversion failed.";
|
||||
string caption = "Alert";
|
||||
MessageBox.Show(message, caption);
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
else
|
||||
{
|
||||
string message = "Attempted to load an unsupported file type/size.";
|
||||
string caption = "Error";
|
||||
MessageBox.Show(message, caption);
|
||||
}
|
||||
}
|
||||
GC.Collect();
|
||||
}
|
||||
private void opensave(byte[] input, string path, string ext)
|
||||
|
@ -6252,28 +6256,6 @@ namespace PKHeX
|
|||
Array.Copy(savefile, 0x5400 + 0x7F000 * savindex, cyberSAV, 0, cyberSAV.Length);
|
||||
cybergadget = false;
|
||||
}
|
||||
private void openg5pkm()
|
||||
{
|
||||
OpenFileDialog openg5pkm = new OpenFileDialog();
|
||||
openg5pkm.Filter = "PK5 File|*.pkm;*.pk5";
|
||||
if (openg5pkm.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string path = openg5pkm.FileName;
|
||||
string ext = Path.GetExtension(path);
|
||||
byte[] pkm = File.ReadAllBytes(path);
|
||||
if (((pkm.Length == 136) || (pkm.Length == 220)) && ((ext == ".pkm") || (ext == ".pk5")))
|
||||
{
|
||||
buff = convertPK5toPK6(pkm);
|
||||
populatefields(buff);
|
||||
}
|
||||
else
|
||||
{
|
||||
string message = "Did not select a valid PKX";
|
||||
string caption = "Input Error";
|
||||
MessageBox.Show(message, caption);
|
||||
}
|
||||
}
|
||||
}
|
||||
// PID Rerolling Functions //
|
||||
private uint getRandomPID(int gt, int cg)
|
||||
{
|
||||
|
@ -6425,231 +6407,6 @@ namespace PKHeX
|
|||
// Done
|
||||
return ekxdata;
|
||||
}
|
||||
private byte[] convertPK5toPK6(byte[] pkm)
|
||||
{
|
||||
// To transfer, we will go down the pkm offset list and fill it into the PKX list.
|
||||
byte[] pkx = new Byte[232]; // Setup new array to store the new PKX
|
||||
|
||||
// Upon transfer, the PID is also set as the Encryption Key.
|
||||
// Copy intro data, it's the same (Encrypt Key -> EXP)
|
||||
for (int i = 0; i < 0x14; i++) { pkx[i] = pkm[i]; }
|
||||
pkx[0xA] = 0; pkx[0xB] = 0; // Get rid of the item, those aren't transferred.
|
||||
// Set the PID in its new location as well...
|
||||
for (int i = 0; i < 0x4; i++) { pkx[0x18 + i] = pkm[i]; }
|
||||
pkx[0xCA] = pkm[0x14]; // Friendship
|
||||
pkx[0x14] = pkm[0x15]; // Ability
|
||||
// Get Ability Number from the PID (the actual valid one)
|
||||
if ((pkm[0x42] & 1) == 1) // Hidden Ability Flag
|
||||
pkx[0x15] = 4;
|
||||
else if (pkm[0x5F] < 0x10) // Gen 3-4 Origin Method
|
||||
pkx[0x15] = (byte)(pkx[0x0] & 1); // Old Ability Correlation
|
||||
else
|
||||
pkx[0x15] = (byte)(pkx[0x2] & 1); // Gen5 Correlation
|
||||
pkx[0x2A] = pkm[0x16]; // Markings
|
||||
pkx[0xE3] = pkm[0x17]; // OT Language
|
||||
|
||||
// Copy EVs and Contest Stats
|
||||
for (int i = 0; i < 12; i++)
|
||||
pkx[0x1E + i] = pkm[0x18 + i];
|
||||
// Fix EVs (<=252)
|
||||
for (int i = 0; i < 6; i++)
|
||||
if (pkx[0x1E + i] > 252)
|
||||
pkx[0x1E + i] = 252;
|
||||
|
||||
// Copy Moves
|
||||
for (int i = 0; i < 16; i++)
|
||||
pkx[0x5A + i] = pkm[0x28 + i];
|
||||
// Fix PP; some moves have different PP in Gen 6.
|
||||
pkx[0x62] = (byte)(getMovePP(BitConverter.ToInt16(pkx, 0x5A)) * (5 + pkx[0x66]) / 5);
|
||||
pkx[0x63] = (byte)(getMovePP(BitConverter.ToInt16(pkx, 0x5C)) * (5 + pkx[0x67]) / 5);
|
||||
pkx[0x64] = (byte)(getMovePP(BitConverter.ToInt16(pkx, 0x5E)) * (5 + pkx[0x68]) / 5);
|
||||
pkx[0x65] = (byte)(getMovePP(BitConverter.ToInt16(pkx, 0x60)) * (5 + pkx[0x69]) / 5);
|
||||
|
||||
// Copy 32bit IV value.
|
||||
for (int i = 0; i < 4; i++)
|
||||
pkx[0x74 + i] = pkm[0x38 + i];
|
||||
|
||||
pkx[0x1D] = pkm[0x40]; // Copy FE & Gender Flags
|
||||
pkx[0x1C] = pkm[0x41]; // Copy Nature
|
||||
|
||||
// Copy Nickname
|
||||
string nicknamestr = "";
|
||||
for (int i = 0; i < 24; i += 2)
|
||||
{
|
||||
if ((pkm[0x48 + i] == 0xFF) && pkm[0x48 + i + 1] == 0xFF)
|
||||
{ // If given character is a terminator, stop copying. There are no trash bytes or terminators in Gen 6!
|
||||
break;
|
||||
}
|
||||
nicknamestr += (char)(pkm[0x48 + i] + pkm[0x49 + i] * 0x100);
|
||||
}
|
||||
// Decapitalize Logic
|
||||
if ((nicknamestr.Length > 0) && (pkx[0x77] >> 7 == 0))
|
||||
nicknamestr = char.ToUpper(nicknamestr[0]) + nicknamestr.Substring(1).ToLower();
|
||||
byte[] nkb = Encoding.Unicode.GetBytes(nicknamestr);
|
||||
Array.Resize(ref nkb, 24);
|
||||
Array.Copy(nkb, 0, pkx, 0x40, nkb.Length);
|
||||
|
||||
pkx[0xDF] = pkm[0x5F]; // Copy Origin Game
|
||||
|
||||
// Copy OT
|
||||
for (int i = 0; i < 24; i += 2)
|
||||
{
|
||||
if ((pkm[0x68 + i] == 0xFF) && pkm[0x68 + i + 1] == 0xFF)
|
||||
{ // If terminated, stop
|
||||
break;
|
||||
}
|
||||
pkx[0xB0 + i] = pkm[0x68 + i];
|
||||
pkx[0xB0 + i + 1] = pkm[0x68 + i + 1];
|
||||
}
|
||||
// Copy Met Info
|
||||
for (int i = 0; i < 0x6; i++)
|
||||
{ // Dates are kept upon transfer
|
||||
pkx[0xD1 + i] = pkm[0x78 + i];
|
||||
}
|
||||
// pkx[0xD7] has a gap.
|
||||
for (int i = 0; i < 0x4; i++)
|
||||
{ // Locations are kept upon transfer
|
||||
pkx[0xD8 + i] = pkm[0x7E + i];
|
||||
}
|
||||
pkx[0x2B] = pkm[0x82]; // Pokerus
|
||||
pkx[0xDC] = pkm[0x83]; // Ball
|
||||
|
||||
// Get the current level of the specimen to be transferred
|
||||
int species = BitConverter.ToInt16(pkx, 0x08);
|
||||
int exp = BitConverter.ToInt32(pkx, 0x10);
|
||||
int currentlevel = getLevel((species), (exp));
|
||||
|
||||
pkx[0xDD] = (byte)(((pkm[0x84]) & 0x80) + currentlevel); // OT Gender & Encounter Level
|
||||
pkx[0xDE] = pkm[0x85]; // Encounter Type
|
||||
|
||||
// Ribbon Decomposer (Contest & Battle)
|
||||
byte contestribbons = 0;
|
||||
byte battleribbons = 0;
|
||||
|
||||
// Contest Ribbon Counter
|
||||
for (int i = 0; i < 8; i++) // Sinnoh 3, Hoenn 1
|
||||
{
|
||||
if (((pkm[0x60] >> i) & 1) == 1)
|
||||
contestribbons++;
|
||||
if (((pkm[0x61] >> i) & 1) == 1)
|
||||
contestribbons++;
|
||||
if (((pkm[0x3C] >> i) & 1) == 1)
|
||||
contestribbons++;
|
||||
if (((pkm[0x3D] >> i) & 1) == 1)
|
||||
contestribbons++;
|
||||
}
|
||||
for (int i = 0; i < 4; i++) // Sinnoh 4, Hoenn 2
|
||||
{
|
||||
if (((pkm[0x62] >> i) & 1) == 1)
|
||||
contestribbons++;
|
||||
if (((pkm[0x3E] >> i) & 1) == 1)
|
||||
contestribbons++;
|
||||
}
|
||||
|
||||
// Battle Ribbon Counter
|
||||
if ((pkm[0x3E] & 0x20) >> 5 == 1) // Winning Ribbon
|
||||
battleribbons++;
|
||||
if ((pkm[0x3E] & 0x40) >> 6 == 1) // Victory Ribbon
|
||||
battleribbons++;
|
||||
for (int i = 1; i < 7; i++) // Sinnoh Battle Ribbons
|
||||
{
|
||||
if (((pkm[0x24] >> i) & 1) == 1)
|
||||
battleribbons++;
|
||||
}
|
||||
// Fill the Ribbon Counter Bytes
|
||||
pkx[0x38] = contestribbons;
|
||||
pkx[0x39] = battleribbons;
|
||||
|
||||
// Copy Ribbons to their new locations.
|
||||
int bx30 = 0;
|
||||
// bx30 += 0; // //Kalos Champ - New Ribbon
|
||||
bx30 += (((pkm[0x3E] & 0x10) >> 4) << 1); // Hoenn Champion
|
||||
bx30 += (((pkm[0x24] & 0x01) >> 0) << 2); // Sinnoh Champ
|
||||
// bx30 += 0; // //Best Friend - New Ribbon
|
||||
// bx30 += 0; // //Training - New Ribbon
|
||||
// bx30 += 0; // //Skillful - New Ribbon
|
||||
// bx30 += 0; // //Expert - New Ribbon
|
||||
bx30 += (((pkm[0x3F] & 0x01) >> 0) << 7); // Effort Ribbon
|
||||
pkx[0x30] = (byte)bx30;
|
||||
|
||||
int bx31 = 0;
|
||||
bx31 += (((pkm[0x24] & 0x80) >> 7) << 0); // Alert
|
||||
bx31 += (((pkm[0x25] & 0x01) >> 0) << 1); // Shock
|
||||
bx31 += (((pkm[0x25] & 0x02) >> 1) << 2); // Downcast
|
||||
bx31 += (((pkm[0x25] & 0x04) >> 2) << 3); // Careless
|
||||
bx31 += (((pkm[0x25] & 0x08) >> 3) << 4); // Relax
|
||||
bx31 += (((pkm[0x25] & 0x10) >> 4) << 5); // Snooze
|
||||
bx31 += (((pkm[0x25] & 0x20) >> 5) << 6); // Smile
|
||||
bx31 += (((pkm[0x25] & 0x40) >> 6) << 7); // Gorgeous
|
||||
pkx[0x31] = (byte)bx31;
|
||||
|
||||
int bx32 = 0;
|
||||
bx32 += (((pkm[0x25] & 0x80) >> 7) << 0); // Royal
|
||||
bx32 += (((pkm[0x26] & 0x01) >> 0) << 1); // Gorgeous Royal
|
||||
bx32 += (((pkm[0x3E] & 0x80) >> 7) << 2); // Artist
|
||||
bx32 += (((pkm[0x26] & 0x02) >> 1) << 3); // Footprint
|
||||
bx32 += (((pkm[0x26] & 0x04) >> 2) << 4); // Record
|
||||
bx32 += (((pkm[0x26] & 0x10) >> 4) << 5); // Legend
|
||||
bx32 += (((pkm[0x3F] & 0x10) >> 4) << 6); // Country
|
||||
bx32 += (((pkm[0x3F] & 0x20) >> 5) << 7); // National
|
||||
pkx[0x32] = (byte)bx32;
|
||||
|
||||
int bx33 = 0;
|
||||
bx33 += (((pkm[0x3F] & 0x40) >> 6) << 0); // Earth
|
||||
bx33 += (((pkm[0x3F] & 0x80) >> 7) << 1); // World
|
||||
bx33 += (((pkm[0x27] & 0x04) >> 2) << 2); // Classic
|
||||
bx33 += (((pkm[0x27] & 0x08) >> 3) << 3); // Premier
|
||||
bx33 += (((pkm[0x26] & 0x08) >> 3) << 4); // Event
|
||||
bx33 += (((pkm[0x26] & 0x40) >> 6) << 5); // Birthday
|
||||
bx33 += (((pkm[0x26] & 0x80) >> 7) << 6); // Special
|
||||
bx33 += (((pkm[0x27] & 0x01) >> 0) << 7); // Souvenir
|
||||
pkx[0x33] = (byte)bx33;
|
||||
|
||||
int bx34 = 0;
|
||||
bx34 += (((pkm[0x27] & 0x02) >> 1) << 0); // Wishing Ribbon
|
||||
bx34 += (((pkm[0x3F] & 0x02) >> 1) << 1); // Battle Champion
|
||||
bx34 += (((pkm[0x3F] & 0x04) >> 2) << 2); // Regional Champion
|
||||
bx34 += (((pkm[0x3F] & 0x08) >> 3) << 3); // National Champion
|
||||
bx34 += (((pkm[0x26] & 0x20) >> 5) << 4); // World Champion
|
||||
pkx[0x34] = (byte)bx34;
|
||||
|
||||
//
|
||||
// Extra Modifications:
|
||||
// Write the Memories, Friendship, and Origin!
|
||||
//
|
||||
|
||||
// Write latest notOT handler as PKHeX
|
||||
byte[] newOT = Encoding.Unicode.GetBytes("PKHeX");
|
||||
Array.Resize(ref newOT, 24);
|
||||
Array.Copy(newOT, 0, pkx, 0x78, newOT.Length);
|
||||
|
||||
// Write Memories as if it was Transferred: USA|California
|
||||
// 01 - Not handled by OT
|
||||
// 07 - CA
|
||||
// 31 - USA
|
||||
byte[] x90x = new byte[] { 0x00, 0x00, 0x00, 0x01, 0x07, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, (byte)getBaseFriendship(species), 0x00, 0x01, 0x04, (byte)(rnd32() % 10), 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||
Array.Copy(x90x, 0, pkx, 0x90, x90x.Length);
|
||||
|
||||
// When transferred, friendship gets reset.
|
||||
pkx[0xCA] = (byte)getBaseFriendship(species);
|
||||
|
||||
// Write Origin (USA California) - location is dependent on 3DS system that transfers.
|
||||
pkx[0xE0] = 0x31; // USA
|
||||
pkx[0xE1] = 0x07; // CA
|
||||
pkx[0xE2] = 0x01; // ENG
|
||||
|
||||
// Fix Checksum
|
||||
uint chk = 0;
|
||||
for (int i = 8; i < 232; i += 2) // Loop through the entire PKX
|
||||
{
|
||||
chk += (uint)(pkx[i] + pkx[i + 1] * 0x100);
|
||||
}
|
||||
|
||||
// Apply New Checksum
|
||||
Array.Copy(BitConverter.GetBytes(chk), 0, pkx, 06, 2);
|
||||
|
||||
return pkx; // Done!
|
||||
}
|
||||
public bool verifiedpkx()
|
||||
{
|
||||
// Make sure the PKX Fields are filled out properly (color check)
|
||||
|
@ -8512,6 +8269,29 @@ namespace PKHeX
|
|||
SAV_HallOfFame halloffame = new PKHeX.SAV_HallOfFame(this);
|
||||
halloffame.ShowDialog();
|
||||
}
|
||||
private void B_ImportCode_Click(object sender, EventArgs e)
|
||||
{
|
||||
// Open Import Code Menu
|
||||
CodeImportPKM textcode = new PKHeX.CodeImportPKM();
|
||||
textcode.ShowDialog();
|
||||
byte[] data = textcode.returnArray;
|
||||
if (data != null)
|
||||
{
|
||||
byte[] decdata = decryptArray(data);
|
||||
Array.Copy(decdata, buff, 232);
|
||||
try
|
||||
{
|
||||
populatefields(buff);
|
||||
}
|
||||
catch
|
||||
{
|
||||
Array.Copy(new Byte[232], buff, 232);
|
||||
populatefields(buff);
|
||||
MessageBox.Show("Imported code did not decrypt properly. Verify that what you imported was correct.", "Error");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void B_SwitchSAV_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult switchsav = MessageBox.Show("Current Savefile is Save" + ((savindex + 1)).ToString() + ". Would you like to switch to Save" + ((savindex + 1) % 2 + 1).ToString() + "?", "Prompt", MessageBoxButtons.YesNo);
|
||||
|
@ -8675,9 +8455,53 @@ namespace PKHeX
|
|||
ReportForm.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// pk2pk Transfer Tool
|
||||
private int getg3species(int g3index)
|
||||
{
|
||||
int[] newindex = new int[]
|
||||
{
|
||||
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
|
||||
31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,
|
||||
59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,77,79,80,81,82,83,84,85,86,
|
||||
87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,
|
||||
111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,
|
||||
132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,
|
||||
153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,
|
||||
174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,
|
||||
195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
|
||||
216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,
|
||||
237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,
|
||||
258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,290,291,292,
|
||||
276,277,285,286,327,278,279,283,284,320,321,300,301,352,343,344,299,324,302,339,340,
|
||||
370,341,342,349,350,318,319,328,329,330,296,297,309,310,322,323,363,364,365,331,332,
|
||||
361,362,337,338,298,325,326,311,312,303,307,308,333,334,360,355,356,315,287,288,289,
|
||||
316,317,357,293,294,295,366,367,368,359,353,354,336,335,369,304,305,306,351,313,314,
|
||||
345,346,347,348,280,281,282,371,372,373,374,375,376,377,378,379,382,383,384,380,381,
|
||||
385,386,358,
|
||||
};
|
||||
int[] oldindex = new int[]
|
||||
{
|
||||
0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,
|
||||
31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,
|
||||
59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,
|
||||
87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,
|
||||
111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,
|
||||
132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,
|
||||
153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,
|
||||
174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,
|
||||
195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,
|
||||
216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,
|
||||
237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,277,278,279,280,281,282,
|
||||
283,284,285,286,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,
|
||||
304,305,306,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,
|
||||
325,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,
|
||||
346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,
|
||||
367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,
|
||||
388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,
|
||||
409,410,411,
|
||||
};
|
||||
return newindex[Array.IndexOf(oldindex, g3index)];
|
||||
}
|
||||
}
|
||||
#region Structs & Classes
|
||||
public class cbItem
|
||||
|
|
12
f1-Main.resx
12
f1-Main.resx
|
@ -741,21 +741,9 @@
|
|||
<metadata name="L_ReadOnlyOther.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="B_BoxIO.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="B_JPEG.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="B_OUTHallofFame.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="RTB_T.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="B_OUTPasserby.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
<metadata name="Tab_SAV.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</metadata>
|
||||
|
|
Loading…
Reference in a new issue