Ejemplo n.º 1
0
        /// <summary>
        /// Tries to get an <see cref="IEnumerable{T}"/> object from the input parameters.
        /// </summary>
        /// <param name="data">Binary data</param>
        /// <param name="pkms">Output result</param>
        /// <param name="sav">Reference savefile used for PC Binary compatibility checks.</param>
        /// <returns>True if file object reference is valid, false if none found.</returns>
        public static bool TryGetPCBoxBin(byte[] data, out IEnumerable <byte[]> pkms, SaveFile?sav)
        {
            if (sav == null)
            {
                pkms = Array.Empty <byte[]>();
                return(false);
            }
            var length = data.Length;

            if (PKX.IsPKM(length / sav.SlotCount) || PKX.IsPKM(length / sav.BoxSlotCount))
            {
                pkms = ArrayUtil.EnumerateSplit(data, length);
                return(true);
            }
            pkms = Array.Empty <byte[]>();
            return(false);
        }
Ejemplo n.º 2
0
 private static HashSet <WC8> GetWC8DB(byte[] wc8bin) =>
 new HashSet <WC8>(ArrayUtil.EnumerateSplit(wc8bin, WC8.Size).Select(d => new WC8(d)));
Ejemplo n.º 3
0
 private static HashSet <WB7> GetWB7DB(byte[] wc7full) => new HashSet <WB7>(ArrayUtil.EnumerateSplit(wc7full, WB7.SizeFull).Select(d => new WB7(d)));
Ejemplo n.º 4
0
 private static HashSet <WC7> GetWC7DB(byte[] wc7bin, byte[] wc7full) => new HashSet <WC7>(
     ArrayUtil.EnumerateSplit(wc7full, WC7Full.Size).Select(d => new WC7Full(d).Gift)
     .Concat(ArrayUtil.EnumerateSplit(wc7bin, WC7.Size).Select(d => new WC7(d))));
Ejemplo n.º 5
0
 private static HashSet <WC6> GetWC6DB(byte[] wc6bin, byte[] wc6full) => new HashSet <WC6>(
     ArrayUtil.EnumerateSplit(wc6full, WC6Full.Size).Select(d => new WC6Full(d).Gift)
     .Concat(ArrayUtil.EnumerateSplit(wc6bin, WC6.Size).Select(d => new WC6(d))));
Ejemplo n.º 6
0
 private static HashSet <PGF> GetPGFDB(byte[] bin) => new HashSet <PGF>(ArrayUtil.EnumerateSplit(bin, PGF.Size).Select(d => new PGF(d)));
Ejemplo n.º 7
0
 private static HashSet <PCD> GetPCDDB(byte[] bin) => new HashSet <PCD>(ArrayUtil.EnumerateSplit(bin, PCD.Size).Select(d => new PCD(d)));