/// <summary> /// Tries to get an <see cref="SAV3GCMemoryCard"/> object from the input parameters. /// </summary> /// <param name="data">Binary data</param> /// <param name="memcard">Output result</param> /// <returns>True if file object reference is valid, false if none found.</returns> public static bool TryGetMemoryCard(byte[] data, out SAV3GCMemoryCard?memcard) { if (!SAV3GCMemoryCard.IsMemoryCardSize(data)) { memcard = null; return(false); } memcard = new SAV3GCMemoryCard(data); return(true); }
/// <summary> /// Checks if the length is too big to be a detectable file. /// </summary> /// <param name="length">File size</param> public static bool IsFileTooBig(long length) { if (length <= 0x100000) { return(false); } if (length == SaveUtil.SIZE_G4BR) { return(false); } if (SAV3GCMemoryCard.IsMemoryCardSize(length)) { return(false); // pbr/GC have size > 1MB } return(true); }
/// <summary> /// Checks if the length is too big to be a detectable file. /// </summary> /// <param name="length">File size</param> public static bool IsFileTooBig(long length) { if (length <= 0x10_0000) // 1 MB { return(false); } if (length > int.MaxValue) { return(true); } if (SaveUtil.IsSizeValid((int)length)) { return(false); } if (SAV3GCMemoryCard.IsMemoryCardSize(length)) { return(false); // pbr/GC have size > 1MB } return(true); }