Пример #1
0
        /// <summary>
        /// Changes the simulated server seed which affects the outcome of bets.</summary>
        /// <param name="nextSeed">The seed to be used after the next server seed change.</param>
        /// <returns>A <see cref="SeedSet"/> object if the simulated server seed was changed successfully.</returns>
        public SeedSet ChangeSimulatedServerSeed(ServerSeed nextSeed = null)
        {
            // Throw an exception if not in simulation mode
            if (WebClient.IsAuthorized)
            {
                throw new PrimediceException("The simulated server seed can only be altered in simulation mode.");
            }

            // Generate a new server seed automatically if no next seed was specified
            if (nextSeed == null)
            {
                nextSeed = Utils.GenerateRandomServerSeed();
            }

            var nextSeedHashed = nextSeed.GetHashed();

            // Change the values of the simulated SeedSet
            SimulatedSeedSet.PreviousServerSeed       = SimulatedSeedSet.ServerSeed;
            SimulatedSeedSet.PreviousServerSeedHashed = SimulatedSeedSet.ServerSeedHashed;
            SimulatedSeedSet.ServerSeed           = SimulatedSeedSet.NextServerSeed;
            SimulatedSeedSet.ServerSeedHashed     = SimulatedSeedSet.NextServerSeedHashed;
            SimulatedSeedSet.NextServerSeed       = nextSeed;
            SimulatedSeedSet.NextServerSeedHashed = nextSeedHashed;

            return(SimulatedSeedSet);
        }
Пример #2
0
        /// <summary>
        /// Changes the simulated server seed which affects the outcome of bets.</summary>
        /// <param name="nextSeed">The seed to be used after the next server seed change.</param>
        /// <returns>A <see cref="SeedSet"/> object if the simulated server seed was changed successfully.</returns>
        public SeedSet ChangeSimulatedServerSeed(ServerSeed nextSeed = null)
        {
            // Throw an exception if not in simulation mode
            if (WebClient.IsAuthorized) {
                throw new PrimediceException("The simulated server seed can only be altered in simulation mode.");
            }

            // Generate a new server seed automatically if no next seed was specified
            if (nextSeed == null) {
                nextSeed = Utils.GenerateRandomServerSeed();
            }

            var nextSeedHashed = nextSeed.GetHashed();

            // Change the values of the simulated SeedSet
            SimulatedSeedSet.PreviousServerSeed = SimulatedSeedSet.ServerSeed;
            SimulatedSeedSet.PreviousServerSeedHashed = SimulatedSeedSet.ServerSeedHashed;
            SimulatedSeedSet.ServerSeed = SimulatedSeedSet.NextServerSeed;
            SimulatedSeedSet.ServerSeedHashed = SimulatedSeedSet.NextServerSeedHashed;
            SimulatedSeedSet.NextServerSeed = nextSeed;
            SimulatedSeedSet.NextServerSeedHashed = nextSeedHashed;

            return SimulatedSeedSet;
        }