Ejemplo n.º 1
0
        public static bool TryParse(string seedString, out SeedOptions options)
        {
            if (seedString.Length == Seed.Length &&
                uint.TryParse(seedString.Substring(Seed.Length - Length), NumberStyles.HexNumber, NumberFormatInfo.CurrentInfo, out var parsedOptionsKey))
            {
                options = new SeedOptions(parsedOptionsKey);
                return(true);
            }

            options = None;
            return(false);
        }
Ejemplo n.º 2
0
        public static bool TryParse(string seedString, out Seed seed)
        {
            ExceptionLogger.SetSeedContext(seedString);

            if (seedString.Length == Length &&
                uint.TryParse(seedString.Substring(0, Length - SeedOptions.Length), NumberStyles.HexNumber, NumberFormatInfo.CurrentInfo, out var parsedSeedKey) &&
                SeedOptions.TryParse(seedString, out var options))
            {
                seed = new Seed(parsedSeedKey, options);
                return(true);
            }

            seed = Zero;
            return(false);
        }
Ejemplo n.º 3
0
 public static Seed GenerateRandom(SeedOptions options, Random random)
 {
     return(new Seed((uint)random.Next(), options));
 }
Ejemplo n.º 4
0
 public Seed(uint id, SeedOptions options)
 {
     Id      = id;
     Options = options;
 }