Example #1
0
        public static AmiiboKeys LoadKeys(string path)
        {
            if (!File.Exists(path))
            {
                return(null);
            }

            try
            {
                using (var reader = new BinaryReader(File.OpenRead(path)))
                {
                    var result = AmiiboKeys.Unserialize(reader);

                    if ((result.data.magicBytesSize > 16) || (result.tag.magicBytesSize > 16))
                    {
                        return(null);
                    }

                    return(result);
                }
            }
            catch
            {
                return(null);
            }
        }
Example #2
0
        /// <summary>
        /// New LoadKeys(),by ANTer 2018-01-24
        /// </summary>
        /// <param name="getKeyGen"></param>
        /// <returns></returns>
        public static AmiiboKeys LoadKeys(byte[] getKeyGen)
        {
            Stream stream = new MemoryStream(getKeyGen);

            try
            {
                using (var reader = new BinaryReader(stream))
                {
                    var result = AmiiboKeys.Unserialize(reader);

                    if ((result.data.magicBytesSize > 16) || (result.tag.magicBytesSize > 16))
                    {
                        return(null);
                    }

                    return(result);
                }
            }
            catch
            {
                return(null);
            }
        }