示例#1
0
        public static Stream ToBoxStream(Box item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            try
            {
                return(AmoebaConverter.ToStream <Box>(0, item));
            }
            catch (Exception)
            {
                throw new FormatException();
            }
        }
示例#2
0
        public static string ToSeedString(Seed item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            try
            {
                using (var stream = AmoebaConverter.ToStream <Seed>(0, item))
                {
                    return("Seed:" + AmoebaConverter.ToBase64String(stream));
                }
            }
            catch (Exception)
            {
                throw new FormatException();
            }
        }