Exemple #1
0
 internal static void Initialize(CryptographySection section)
 {
     _providers = new CryptographyProviderCollection();
     _provider  = ProviderUtil.InstantiateProviders <CryptographyProvider, CryptographyProviderCollection>(
         section.Providers, section.DefaultProvider, _providers);
     if (_provider == null)
     {
         throw new ConfigurationErrorsException(
                   SR.ConfigDefaultCryptoProviderNotFound,
                   section.ElementInformation.Properties["defaultProvider"].Source,
                   section.ElementInformation.Properties["defaultProvider"].LineNumber);
     }
 }
Exemple #2
0
        /// <summary>
        /// Configures the virtual world from the radiance.world configuration section.
        /// </summary>
        /// <param name="section">The WorldSection configuration section from the application configuration file.</param>
        internal void ConfigureWorld(WorldSection section)
        {
            this.Name = section.Name;
#if DEBUG
            this.ClientTimeoutMinutes = 5;
#else
            this.ClientTimeoutMinutes = section.ClientTimeoutMinutes;
#endif
            this.DefaultMaxCharacters = section.DefaultMaxCharacters;
            this.EnableMagic          = section.EnableMagic;
            this.EnablePsionics       = section.EnablePsionics;
            this.EnableCommandLogging = section.EnableCommandLogging;
            this.PowerMultiplier      = section.PowerMultiplier;
            this.RealismMultiplier    = section.RealismMultiplier;

            this.Providers = new WorldProviderCollection();
            this.Provider  = ProviderUtil.InstantiateProviders <WorldProvider, WorldProviderCollection>(
                section.Providers,
                section.DefaultProvider,
                this.Providers);
            if (this.Provider == null)
            {
                throw new ConfigurationErrorsException(
                          SR.ConfigDefaultWorldProviderNotFound,
                          section.ElementInformation.Properties["defaultProvider"].Source,
                          section.ElementInformation.Properties["defaultProvider"].LineNumber);
            }

            // Set the name of the world as dictated by the provider.
            this.Provider.WorldName = this.Name;
            this.Provider.World     = this;

            // Load any custom properties or values into the world instance.
            this.Provider.WorldLoaded();

            // Map Manager
            this.Map = Activator.CreateInstance(Type.GetType(section.MapManagerType, true, true), new object[] { this }) as MapManager;
            this.Provider.LoadMaps(this.Map);

            // Load Skills from the provider
            this.Skills = this.Provider.GetSkills();

            // Load Commands from the provider
            this.Commands = this.Provider.GetCommands();

            // Load the terrain from the provider.
            this.Terrain = this.Provider.GetTerrain();
        }