Example #1
0
        public static Box FromBoxStream(Stream stream)
        {
            if (stream == null)
            {
                throw new ArgumentNullException(nameof(stream));
            }

            try
            {
                return(AmoebaConverter.FromStream <Box>(0, stream));
            }
            catch (Exception)
            {
                throw new FormatException();
            }
        }
Example #2
0
        public static Seed FromSeedString(string item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }
            if (!item.StartsWith("Seed:"))
            {
                throw new ArgumentException("item");
            }

            try
            {
                using (var stream = AmoebaConverter.FromBase64String(item.Remove(0, "Seed:".Length)))
                {
                    return(AmoebaConverter.FromStream <Seed>(0, stream));
                }
            }
            catch (Exception)
            {
                throw new FormatException();
            }
        }