Example #1
0
        // Utility
        internal static bool isValid(string exeFS, string romFS, string exeheader, string path, string serial, bool Card2)
        {
            bool isSerialValid = true;

            if (serial.Length == 10)
            {
                string[] subs = serial.Split('-');
                if (subs.Length != 3)
                {
                    isSerialValid = false;
                }
                else
                {
                    if (subs[0].Length != 3 || subs[1].Length != 1 || subs[2].Length != 4)
                    {
                        isSerialValid = false;
                    }
                    else if (subs[0] != "CTR" && subs[0] != "KTR")
                    {
                        isSerialValid = false;
                    }
                    else if (subs[1] != "P" && subs[1] != "N" && subs[2] != "U")
                    {
                        isSerialValid = false;
                    }
                    else
                    {
                        foreach (char c in subs[2].Where(c => !Char.IsLetterOrDigit(c)))
                        {
                            isSerialValid = false;
                        }
                    }
                }
            }
            else
            {
                isSerialValid = false;
            }
            if (exeFS == string.Empty ||
                romFS == string.Empty ||
                exeheader == string.Empty ||
                path == string.Empty ||
                !isSerialValid)
            {
                return(false);
            }

            Exheader exh = new Exheader(exeheader);

            return(!exh.isPokemon() || Card2);
        }
Example #2
0
        // Utility
        internal static bool IsValid(string exeFS, string romFS, string exeheader, string path, string serial, bool Card2)
        {
            bool isSerialValid = true;

            if (serial.Length == 10)
            {
                string[] subs = serial.Split('-');
                if (subs.Length != 3)
                {
                    isSerialValid = false;
                }
                else
                {
                    if (subs[0].Length != 3 || subs[1].Length != 1 || subs[2].Length != 4)
                    {
                        isSerialValid = false;
                    }
                    else if (subs[0] != "CTR" && subs[0] != "KTR")
                    {
                        isSerialValid = false;
                    }
                    else if (subs[1] != "P" && subs[1] != "N" && subs[2] != "U")
                    {
                        isSerialValid = false;
                    }
                    else
                    {
                        if (subs[2].Any(c => !char.IsLetterOrDigit(c)))
                        {
                            isSerialValid = false;
                        }
                    }
                }
            }
            else
            {
                isSerialValid = false;
            }
            if (string.IsNullOrEmpty(exeFS) ||
                string.IsNullOrEmpty(romFS) ||
                string.IsNullOrEmpty(exeheader) ||
                string.IsNullOrEmpty(path) ||
                !isSerialValid)
            {
                return(false);
            }

            Exheader exh = new Exheader(exeheader);

            return(!exh.IsSupported() || Card2);
        }
Example #3
0
        private void ExtractExheader(string NCCH_PATH, string outputDirectory, RichTextBox TB_Progress = null)
        {
            string exheaderpath = Path.Combine(outputDirectory, "exheader.bin");

            updateTB(TB_Progress, "Extracting exheader.bin from CXI...");
            byte[] exheaderbytes = new byte[header.ExheaderSize * 2];

            using (FileStream fs = new FileStream(NCCH_PATH, FileMode.Open, FileAccess.Read))
            {
                fs.Seek(Convert.ToInt32(0x200), SeekOrigin.Begin);
                fs.Read(exheaderbytes, 0, exheaderbytes.Length);
            }

            File.WriteAllBytes(exheaderpath, exheaderbytes);
            exheader = new Exheader(exheaderpath);
        }