Exemplo n.º 1
0
        public virtual string Execute(string command)
        {
            m_WhenInteracted = App.TimeSource.UTCNow;

            if (command == null)
            {
                return(string.Empty);
            }

            command = command.Trim();

            if (command.IsNullOrWhiteSpace())
            {
                return(string.Empty);
            }

            if (!command.EndsWith("}") && command.Contains(HELP_ARGS))
            {
                return(getHelp(command.Replace(HELP_ARGS, "").Trim()));
            }

            if (!command.EndsWith("}"))
            {
                command += "{}";
            }

            var cmd    = Sky.TerminalUtils.ParseCommand(command, m_Vars);
            var result = new MemoryConfiguration();

            result.EnvironmentVarResolver = cmd.EnvironmentVarResolver;
            m_ScriptRunner.Execute(cmd, result);

            return(DoExecute(result.Root));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Provides access to ServiceClientHub singleton instance of the app context
        /// </summary>
        public static ServiceClientHub GetServiceClientHub(this IApplication app)
        => app.NonNull(nameof(app))
        .Singletons
        .GetOrCreate(() =>
        {
            string tpn = typeof(ServiceClientHub).FullName;
            try
            {
                var mbNode  = app.AsSky().Metabase.ServiceClientHubConfNode as ConfigSectionNode;
                var appNode = app.ConfigRoot[SysConsts.APPLICATION_CONFIG_ROOT_SECTION]
                              [ServiceClientHub.CONFIG_SERVICE_CLIENT_HUB_SECTION] as ConfigSectionNode;

                var effectiveConf = new MemoryConfiguration();
                effectiveConf.CreateFromMerge(mbNode, appNode);
                var effective = effectiveConf.Root;

                tpn = effective.AttrByName(FactoryUtils.CONFIG_TYPE_ATTR).ValueAsString(typeof(ServiceClientHub).FullName);

                return(FactoryUtils.MakeComponent <ServiceClientHub>(app, effective, typeof(ServiceClientHub), new object[] { effective }));
            }
            catch (Exception error)
            {
                throw new Clients.SkyClientException(StringConsts.SKY_SVC_CLIENT_HUB_SINGLETON_CTOR_ERROR
                                                     .Args(tpn, error.ToMessageWithType()), error);
            }
        }).instance;
Exemplo n.º 3
0
        /// <summary>
        /// Returns information about current session. The ACL/Rights is redacted to not disclose non-public information.
        /// Takes optional functor to obtain `EntityId` for the user principal object
        /// </summary>
        public static SessionInfo ForSession(ISession session, Func <User, EntityId> fUserId = null)
        {
            if (session == null)
            {
                session = NOPSession.Instance;
            }

            var result = new SessionInfo()
            {
                Utc           = Ambient.UTCNow,
                LastLoginUtc  = session.LastLoginUTC,
                LastLoginType = session.LastLoginType,
                LanguageIso   = session.LanguageISOCode,

                UserId          = fUserId?.Invoke(session.User),
                UserName        = session.User.Name,
                UserDescription = session.User.Description,
                UserStatus      = session.User.Status
            };

            var cfg = new MemoryConfiguration();

            cfg.CreateFromNode(session.User.Rights.Root);

            redactAclLevel(cfg.Root, false);
            cfg.Root.ResetModified();

            result.UserRights = cfg.Root;
            return(result);
        }
Exemplo n.º 4
0
        private IMemoryConfiguration BuildProdEnvDefaultValueConfiguration()
        {
            var defaultValueConfiguration = new MemoryConfiguration();

            // defaultValueConfiguration["] = "http://ant.soa.com/XXXX-service/";
            return(defaultValueConfiguration);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Generates packaging manifest for the specified directory. Optionally may specify root node name
        /// </summary>
        /// <param name="directory">Source directory to generate manifest for</param>
        /// <param name="rootNodeName">Name of root manifest node, if omitted then 'package' is defaulted</param>
        /// <param name="packageName">Optional 'name' attribute value under root node</param>
        /// <param name="packageLocalPath">Optional 'local-path' attribute value under root node</param>
        public static ConfigSectionNode GeneratePackagingManifest(this FileSystemDirectory directory,
                                                                  string rootNodeName     = null,
                                                                  string packageName      = null,
                                                                  string packageLocalPath = null)
        {
            if (directory == null)
            {
                throw new NFXIOException(StringConsts.ARGUMENT_ERROR + "GeneratePackagingManifest(directory==null)");
            }

            var conf = new MemoryConfiguration();

            conf.Create(rootNodeName.IsNullOrWhiteSpace()?CONFIG_PACKAGE_SECTION : rootNodeName);
            var root = conf.Root;

            if (packageName.IsNotNullOrWhiteSpace())
            {
                root.AddAttributeNode(CONFIG_NAME_ATTR, packageName);
            }

            if (packageLocalPath.IsNotNullOrWhiteSpace())
            {
                root.AddAttributeNode(CONFIG_LOCAL_PATH_ATTR, packageLocalPath);
            }

            buildDirLevel(root, directory);

            root.ResetModified();

            return(root);
        }
Exemplo n.º 6
0
        public RavenConfiguration()
        {
            _configBuilder = new ConfigurationBuilder();
            AddEnvironmentVariables(_configBuilder);
            AddJsonConfigurationVariables();

            Settings = _configBuilder.Build();
            Core     = new CoreConfiguration();

            Replication    = new ReplicationConfiguration();
            SqlReplication = new SqlReplicationConfiguration();
            Storage        = new StorageConfiguration();
            Encryption     = new EncryptionConfiguration();
            Indexing       = new IndexingConfiguration(() => DatabaseName, () => Core.RunInMemory, () => Core.DataDirectory);
            WebSockets     = new WebSocketsConfiguration();
            Monitoring     = new MonitoringConfiguration();
            Queries        = new QueryConfiguration();
            Patching       = new PatchingConfiguration();
            DebugLog       = new DebugLoggingConfiguration();
            BulkInsert     = new BulkInsertConfiguration();
            Server         = new ServerConfiguration();
            Memory         = new MemoryConfiguration(this);
            Expiration     = new ExpirationBundleConfiguration();
            Studio         = new StudioConfiguration();
            Databases      = new DatabaseConfiguration();
            Licensing      = new LicenseConfiguration();
            Quotas         = new QuotasBundleConfiguration();
            Tombstones     = new TombstoneConfiguration();
        }
Exemplo n.º 7
0
        public RavenConfiguration(string resourceName, ResourceType resourceType, string customConfigPath = null)
        {
            ResourceName = resourceName;
            ResourceType = resourceType;

            _configBuilder = new ConfigurationBuilder();
            AddEnvironmentVariables();
            AddJsonConfigurationVariables(customConfigPath);

            Settings = _configBuilder.Build();

            Core = new CoreConfiguration();

            Http             = new HttpConfiguration();
            Replication      = new ReplicationConfiguration();
            Cluster          = new ClusterConfiguration();
            Etl              = new EtlConfiguration();
            Storage          = new StorageConfiguration();
            Security         = new SecurityConfiguration();
            PerformanceHints = new PerformanceHintsConfiguration();
            Indexing         = new IndexingConfiguration(this);
            Monitoring       = new MonitoringConfiguration();
            Queries          = new QueryConfiguration();
            Patching         = new PatchingConfiguration();
            Logs             = new LogsConfiguration();
            Server           = new ServerConfiguration();
            Testing          = new TestingConfiguration();
            Databases        = new DatabaseConfiguration();
            Memory           = new MemoryConfiguration();
            Studio           = new StudioConfiguration();
            Licensing        = new LicenseConfiguration();
            Tombstones       = new TombstoneConfiguration();
            Subscriptions    = new SubscriptionConfiguration();
        }
Exemplo n.º 8
0
        /// <summary>
        /// Gets application configuration processing all includes (if required).
        /// The default implementation takes a file co-located with entry point in any of the supported formats
        /// </summary>
        protected virtual Configuration GetConfiguration()
        {
            //try to read from  /config file
            var configFile = m_CommandArgs[CONFIG_SWITCH].AttrByIndex(0).Value;

            if (string.IsNullOrEmpty(configFile))
            {
                configFile = GetDefaultConfigFileName();
            }


            Configuration conf;

            if (File.Exists(configFile))
            {
                conf = Configuration.ProviderLoadFromFile(configFile);
            }
            else
            {
                conf = new MemoryConfiguration();
            }

            conf.Application = this;

            //20190416 DKh added support for root config pragma includes
            var includePragma = conf.Root.AttrByName(CONFIG_PROCESS_INCLUDES).Value;

            if (includePragma.IsNotNullOrWhiteSpace())
            {
                conf.Root.ProcessAllExistingIncludes(GetType().FullName, includePragma);
            }

            return(conf);
        }
Exemplo n.º 9
0
        protected NOPApplication()
        {
            m_Configuration = new MemoryConfiguration();
            m_Configuration.Create();

            m_StartTime = DateTime.Now;
        }
Exemplo n.º 10
0
        private IMemoryConfiguration BuildProdEnvDefaultValueConfiguration()
        {
            var defaultValueConfiguration = new MemoryConfiguration();

            defaultValueConfiguration[ServiceMetadata.SERVICE_REGISTRY_ENV_KEY] = "prod";
            return(defaultValueConfiguration);
        }
Exemplo n.º 11
0
        public MemoryContext(MemoryParameters parameters, MemoryDependencies dependencies, MemoryConfiguration configuration, MemoryHooks hooks)
        {
            this.parameters    = parameters;
            this.dependencies  = dependencies;
            this.configuration = configuration;
            this.hooks         = hooks;

            collection = new MemoryCollection(this);
        }
Exemplo n.º 12
0
        protected NOPApplication()
        {
            ApplicationModel.ExecutionContext.__SetApplicationLevelContext(this, null, null, NOPSession.Instance);

            m_Configuration = new MemoryConfiguration();
            m_Configuration.Create();

            m_StartTime = DateTime.Now;
        }
Exemplo n.º 13
0
        /// <summary>
        ///  Evaluates variables in a context of optional variable resolver and macro runner
        /// </summary>
        public static string EvaluateVars(this string line, IEnvironmentVariableResolver envResolver = null, IMacroRunner macroRunner = null)
        {
            var config = new MemoryConfiguration();

            config.Create();
            config.EnvironmentVarResolver = envResolver;
            config.MacroRunner            = macroRunner;
            return(EvaluateVarsInConfigScope(line, config));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Create client accepter with given configuration.
        /// <remarks>Accepter uses buffer provider, for creating client buffers</remarks>
        /// </summary>
        /// <param name="configuration">Configuration of network</param>
        /// <param name="bufferProvider">Buffer provider for client communication</param>
        /// <param name="clientAcceptedHandler">Handler called on every accepted client. Is called synchronously</param>
        internal Accepter(NetworkConfiguration configuration, MemoryConfiguration memoryConfiguration, BufferProvider bufferProvider, OnClientAccepted clientAcceptedHandler)
        {
            _configuration  = configuration;
            _bufferProvider = bufferProvider;

            _bufferSize = memoryConfiguration.ClientBufferSize;

            _listener         = new TcpListener(configuration.ListenAddress, configuration.ListenPort);
            _onClientAccepted = clientAcceptedHandler;
        }
Exemplo n.º 15
0
        public static void Initialize(Source source = Source.Memory)
        {
            if (source == Source.File)
            {
                FileConfiguration.Load("log4net.config");
                return;
            }

            MemoryConfiguration.Load();
        }
Exemplo n.º 16
0
        /// <summary>
        ///  Evaluates variables in a context of optional configuration supplied as config object
        /// </summary>
        public static string EvaluateVarsInConfigScope(this string line, Configuration scopeConfig = null)
        {
            if (scopeConfig == null)
            {
                scopeConfig = new MemoryConfiguration();
                scopeConfig.Create();
            }

            return(scopeConfig.Root.EvaluateValueVariables(line));
        }
Exemplo n.º 17
0
        protected NOPApplication()
        {
            m_Configuration = new MemoryConfiguration();
            m_Configuration.Create();

            m_CommandArgsConfiguration = new MemoryConfiguration();
            m_CommandArgsConfiguration.Create();

            m_StartTime = DateTime.Now;
            m_Realm     = new ApplicationRealmBase();
        }
Exemplo n.º 18
0
        public void PropertyOnChangeEventTest()
        {
            string key1   = "key1";
            string key2   = "key2";
            string key3   = "key3";
            string value1 = "Hello World 1";
            string value2 = "Hello World 2";
            string value3 = "100";

            Dictionary <string, string> data = new Dictionary <string, string>();

            data[key1] = value1;
            data[key2] = value2;
            data[key3] = value3;
            MemoryConfiguration         configuration       = new MemoryConfiguration(data);
            IDynamicConfigurationSource configurationSource = ObjectFactory.CreateDefaultDynamicConfigurationSource(0, "test", configuration);
            IConfigurationManager       manager             = ObjectFactory.CreateDefaultConfigurationManager(configurationSource);
            int managerEventExecuted = 0;

            manager.OnPropertyChange += (s, e) => managerEventExecuted++;

            int       event1Executed = 0, event2Executed = 0, event3Executed = 0;
            IProperty property1 = manager.GetProperty(key1);

            property1.OnChange += (s, e) => event1Executed++;
            IProperty property2 = manager.GetProperty(key2);

            property2.OnChange += (s, e) => event2Executed++;
            IProperty <double> property3 = manager.GetProperty(key3, 0.0);

            property3.OnChange += (s, e) => event3Executed++;

            managerEventExecuted = event1Executed = event2Executed = event3Executed = 0;
            configuration[key1]  = "test value";
            Assert.AreEqual(1, event1Executed);
            Assert.AreEqual(0, event2Executed);
            Assert.AreEqual(0, event3Executed);
            Assert.AreEqual(1, managerEventExecuted);

            managerEventExecuted = event1Executed = event2Executed = event3Executed = 0;
            configuration[key2]  = "test value";
            Assert.AreEqual(0, event1Executed);
            Assert.AreEqual(1, event2Executed);
            Assert.AreEqual(0, event3Executed);
            Assert.AreEqual(1, managerEventExecuted);

            managerEventExecuted = event1Executed = event2Executed = event3Executed = 0;
            configuration[key3]  = "100.0";
            Assert.AreEqual(0, event1Executed);
            Assert.AreEqual(0, event2Executed);
            Assert.AreEqual(0, event3Executed);
            Assert.AreEqual(1, managerEventExecuted);
        }
Exemplo n.º 19
0
 public static MemoryArrange ToKernelMemoryArrange(this MemoryConfiguration configuration)
 {
     return(configuration switch
     {
         MemoryConfiguration.MemoryConfiguration4GB => MemoryArrange.MemoryArrange4GB,
         MemoryConfiguration.MemoryConfiguration4GBAppletDev => MemoryArrange.MemoryArrange4GBAppletDev,
         MemoryConfiguration.MemoryConfiguration4GBSystemDev => MemoryArrange.MemoryArrange4GBSystemDev,
         MemoryConfiguration.MemoryConfiguration6GB => MemoryArrange.MemoryArrange6GB,
         MemoryConfiguration.MemoryConfiguration6GBAppletDev => MemoryArrange.MemoryArrange6GBAppletDev,
         MemoryConfiguration.MemoryConfiguration8GB => MemoryArrange.MemoryArrange8GB,
         _ => throw new AggregateException($"Invalid memory configuration \"{configuration}\".")
     });
Exemplo n.º 20
0
        public void Configure(IConfigSectionNode node)
        {
            var appRoot = node.NavigateSection("/" + ErlConsts.ERLANG_CONFIG_SECTION);

            if (appRoot == null)
            {
                throw new ErlException(
                          StringConsts.CONFIGURATION_NAVIGATION_SECTION_REQUIRED_ERROR,
                          ErlConsts.ERLANG_CONFIG_SECTION);
            }

            // Configure global node variables

            ErlAbstractNode.s_DefaultCookie = new ErlAtom(
                appRoot.AttrByName(ErlConsts.ERLANG_COOKIE_ATTR)
                .ValueAsString(ErlAbstractNode.s_DefaultCookie.Value));

            ErlAbstractNode.s_UseShortNames =
                appRoot.AttrByName(ErlConsts.ERLANG_SHORT_NAME_ATTR)
                .ValueAsBool(ErlAbstractNode.s_UseShortNames);

            ErlAbstractConnection.ConnectTimeout =
                appRoot.AttrByName(ErlConsts.ERLANG_CONN_TIMEOUT_ATTR)
                .ValueAsInt(ErlAbstractConnection.ConnectTimeout);

            // Configure local node and remote connections

            var cfg = new MemoryConfiguration();

            cfg.CreateFromNode(appRoot);

            var root  = cfg.Root;
            var nodes = root.Children
                        .Where(n => n.Name.EqualsIgnoreCase(ErlConsts.ERLANG_NODE_SECTION));

            var localNodes = nodes.Where(n => n.AttrByName(ErlConsts.CONFIG_IS_LOCAL_ATTR).ValueAsBool()).ToArray();

            if (localNodes.Length != 1)
            {
                throw new ErlException(StringConsts.ERL_CONFIG_SINGLE_NODE_ERROR, localNodes.Length);
            }

            var localNode = localNodes[0];

            // Create and configure local node

            s_Node = new ErlLocalNode(localNode.Value, localNode);

            // Configure connections to all remote nodes

            //m_AllNodes = nodes.Where(n => !n.AttrByName(ErlConsts.CONFIG_IS_LOCAL_ATTR).ValueAsBool());
            m_AllNodes = root;
        }
Exemplo n.º 21
0
        /// <summary>
        /// Converts dictionary into configuration where every original node gets represented as an attribute of config's root
        /// </summary>
        public static Configuration ToConfigAttributes(this IDictionary <string, object> dict)
        {
            var result = new MemoryConfiguration();

            result.Create();
            foreach (var pair in dict)
            {
                result.Root.AddAttributeNode(pair.Key, pair.Value);
            }

            return(result);
        }
Exemplo n.º 22
0
        public void CorrectDefaultValue()
        {
            string sizeKey      = "age";
            int    sizeMaxValue = 100;
            int    defaultValue = 101;
            MemoryConfiguration         memoryConfiguration = new MemoryConfiguration();
            IDynamicConfigurationSource dynamicSource       = ObjectFactory.CreateDefaultDynamicConfigurationSource(0, "dynamic", memoryConfiguration);
            IConfigurationManager       manager             = ObjectFactory.CreateDefaultConfigurationManager(dynamicSource);

            IProperty <int> ageProperty = manager.GetProperty <int>(sizeKey, defaultValue, new UpperBoundCorrector <int>(sizeMaxValue));

            Assert.AreEqual(sizeMaxValue, ageProperty.Value);
        }
Exemplo n.º 23
0
        public void CorrectDefaultNullableValue()
        {
            string ageKey       = "age";
            int?   ageMinValue  = 0;
            int?   defaultValue = -1;
            MemoryConfiguration         memoryConfiguration = new MemoryConfiguration();
            IDynamicConfigurationSource dynamicSource       = ObjectFactory.CreateDefaultDynamicConfigurationSource(0, "dynamic", memoryConfiguration);
            IConfigurationManager       manager             = ObjectFactory.CreateDefaultConfigurationManager(dynamicSource);

            IProperty <int?> ageProperty = manager.GetProperty <int?>(ageKey, defaultValue, new NullableLowerBoundCorrector <int>(ageMinValue));

            Assert.AreEqual(ageMinValue, ageProperty.Value);
        }
Exemplo n.º 24
0
        public void CorrectDefaultNullableValue()
        {
            string portKey      = "port";
            int?   portMinValue = 1;
            int?   portMaxValue = 65535;
            int?   defaultValue = 0;
            MemoryConfiguration         memoryConfiguration = new MemoryConfiguration();
            IDynamicConfigurationSource dynamicSource       = ObjectFactory.CreateDefaultDynamicConfigurationSource(0, "dynamic", memoryConfiguration);
            IConfigurationManager       manager             = ObjectFactory.CreateDefaultConfigurationManager(dynamicSource);

            IProperty <int?> ageProperty = manager.GetProperty <int?>(portKey, defaultValue, new NullableRangeCorrector <int>(portMinValue, portMaxValue));

            Assert.AreEqual(portMinValue, ageProperty.Value);
        }
Exemplo n.º 25
0
        public IConfigSectionNode GetUserLogArchiveDimensions(IIdentityDescriptor identity)
        {
            if (identity == null)
            {
                return(null);
            }

            var cfg = new MemoryConfiguration();

            cfg.Create("ad");
            cfg.Root.AddAttributeNode("un", identity.IdentityDescriptorName);

            return(cfg.Root);
        }
Exemplo n.º 26
0
 public HLEConfiguration(VirtualFileSystem virtualFileSystem,
                         LibHacHorizonManager libHacHorizonManager,
                         ContentManager contentManager,
                         AccountManager accountManager,
                         UserChannelPersistence userChannelPersistence,
                         IRenderer gpuRenderer,
                         IHardwareDeviceDriver audioDeviceDriver,
                         MemoryConfiguration memoryConfiguration,
                         IHostUiHandler hostUiHandler,
                         SystemLanguage systemLanguage,
                         RegionCode region,
                         bool enableVsync,
                         bool enableDockedMode,
                         bool enablePtc,
                         bool enableInternetAccess,
                         IntegrityCheckLevel fsIntegrityCheckLevel,
                         int fsGlobalAccessLogMode,
                         long systemTimeOffset,
                         string timeZone,
                         MemoryManagerMode memoryManagerMode,
                         bool ignoreMissingServices,
                         AspectRatio aspectRatio,
                         float audioVolume)
 {
     VirtualFileSystem      = virtualFileSystem;
     LibHacHorizonManager   = libHacHorizonManager;
     AccountManager         = accountManager;
     ContentManager         = contentManager;
     UserChannelPersistence = userChannelPersistence;
     GpuRenderer            = gpuRenderer;
     AudioDeviceDriver      = audioDeviceDriver;
     MemoryConfiguration    = memoryConfiguration;
     HostUiHandler          = hostUiHandler;
     SystemLanguage         = systemLanguage;
     Region                = region;
     EnableVsync           = enableVsync;
     EnableDockedMode      = enableDockedMode;
     EnablePtc             = enablePtc;
     EnableInternetAccess  = enableInternetAccess;
     FsIntegrityCheckLevel = fsIntegrityCheckLevel;
     FsGlobalAccessLogMode = fsGlobalAccessLogMode;
     SystemTimeOffset      = systemTimeOffset;
     TimeZone              = timeZone;
     MemoryManagerMode     = memoryManagerMode;
     IgnoreMissingServices = ignoreMissingServices;
     AspectRatio           = aspectRatio;
     AudioVolume           = audioVolume;
 }
Exemplo n.º 27
0
        public void CorrectInvalidValue()
        {
            string ageKey       = "age";
            int    ageValue     = -1;
            int    ageMinValue  = 0;
            int    defaultValue = 18;
            MemoryConfiguration memoryConfiguration = new MemoryConfiguration();

            memoryConfiguration[ageKey] = ageValue.ToString();
            IDynamicConfigurationSource dynamicSource = ObjectFactory.CreateDefaultDynamicConfigurationSource(0, "dynamic", memoryConfiguration);
            IConfigurationManager       manager       = ObjectFactory.CreateDefaultConfigurationManager(dynamicSource);

            IProperty <int> ageProperty = manager.GetProperty <int>(ageKey, defaultValue, new LowerBoundCorrector <int>(ageMinValue));

            Assert.AreEqual(ageMinValue, ageProperty.Value);
        }
Exemplo n.º 28
0
        public IConfigSectionNode GetUserLogArchiveDimensions(User user)
        {
            if (user == null)
            {
                return(null);
            }
            if (user.Status == UserStatus.Invalid)
            {
                return(null);
            }
            var cfg = new MemoryConfiguration();

            cfg.Create("ad");
            cfg.Root.AddAttributeNode("un", user.Name);
            return(cfg.Root);
        }
Exemplo n.º 29
0
        public void CorrectInvalidNullableValue()
        {
            string sizeKey      = "age";
            int?   sizeValue    = 101;
            int?   sizeMaxValue = 100;
            int?   defaultValue = 0;
            MemoryConfiguration memoryConfiguration = new MemoryConfiguration();

            memoryConfiguration[sizeKey] = sizeValue.ToString();
            IDynamicConfigurationSource dynamicSource = ObjectFactory.CreateDefaultDynamicConfigurationSource(0, "dynamic", memoryConfiguration);
            IConfigurationManager       manager       = ObjectFactory.CreateDefaultConfigurationManager(dynamicSource);

            IProperty <int?> ageProperty = manager.GetProperty <int?>(sizeKey, defaultValue, new NullableUpperBoundCorrector <int>(sizeMaxValue));

            Assert.AreEqual(sizeMaxValue, ageProperty.Value);
        }
Exemplo n.º 30
0
        private RavenConfiguration(string resourceName, ResourceType resourceType, string customConfigPath = null, bool skipEnvironmentVariables = false)
        {
            _logger = LoggingSource.Instance.GetLogger <RavenConfiguration>(resourceName);

            ResourceName      = resourceName;
            ResourceType      = resourceType;
            _customConfigPath = customConfigPath;
            PathSettingBase <string> .ValidatePath(_customConfigPath);

            _configBuilder = new ConfigurationBuilder();
            if (skipEnvironmentVariables == false)
            {
                AddEnvironmentVariables();
            }
            AddJsonConfigurationVariables(customConfigPath);

            Settings = _configBuilder.Build();

            Core = new CoreConfiguration();

            Http             = new HttpConfiguration();
            Replication      = new ReplicationConfiguration();
            Cluster          = new ClusterConfiguration();
            Etl              = new EtlConfiguration();
            Storage          = new StorageConfiguration();
            Security         = new SecurityConfiguration();
            Backup           = new BackupConfiguration();
            PerformanceHints = new PerformanceHintsConfiguration();
            Indexing         = new IndexingConfiguration(this);
            Monitoring       = new MonitoringConfiguration();
            Queries          = new QueryConfiguration();
            Patching         = new PatchingConfiguration();
            Logs             = new LogsConfiguration();
            Server           = new ServerConfiguration();
            Embedded         = new EmbeddedConfiguration();
            Databases        = new DatabaseConfiguration(Storage.ForceUsing32BitsPager);
            Memory           = new MemoryConfiguration();
            Studio           = new StudioConfiguration();
            Licensing        = new LicenseConfiguration();
            Tombstones       = new TombstoneConfiguration();
            Subscriptions    = new SubscriptionsConfiguration();
            TransactionMergerConfiguration = new TransactionMergerConfiguration(Storage.ForceUsing32BitsPager);
            Notifications = new NotificationsConfiguration();
            Updates       = new UpdatesConfiguration();
            Migration     = new MigrationConfiguration();
            Integrations  = new IntegrationsConfiguration();
        }
Exemplo n.º 31
0
 public static Configuration CreateConfig()
 {
     Configuration config = new Configuration();
     NetworkConfiguration networkcon = new NetworkConfiguration();
     ClockConfiguration clockcon = new ClockConfiguration();
     CPUConfiguration cpuconfig = new CPUConfiguration();
     MemoryConfiguration memoryconfig = new MemoryConfiguration();
     TeamSpeakConfiguration teamspeakconfig=new TeamSpeakConfiguration();
     StyleConfiguration styleconfig = new StyleConfiguration();
     config.networkConfig = networkcon;
     config.clockConfig = clockcon;
     config.cpuConfig = cpuconfig;
     config.memoryConfig = memoryconfig;
     config.tsconfig = teamspeakconfig;
     config.styleconig = styleconfig;
     return config;
 }
Exemplo n.º 32
0
 public ServerBootStraper(MemoryConfiguration configuration)
     : base(configuration)
 {
     _configuration = configuration;
 }
Exemplo n.º 33
0
        /// <summary>
        /// Loads the configuration from an xml file
        /// </summary>
        /// <param name="xmlFile">The name of an xml file that stores the configuration information</param>
        public void FromXML(string xmlFile)
        {
            XmlDocument dom = new XmlDocument();
            dom.Load(xmlFile);
            XmlNode xNode = dom.DocumentElement;

            if ((xNode.Name == CONFIGURATION_ELEMENT) && (xNode.HasChildNodes))
            {
                foreach (XmlNode iNode in xNode.ChildNodes)
                {

                    if (iNode.Name == SOFTWARE_ELEMENT)
                    {
                        foreach (XmlAttribute iAttribute in iNode.Attributes)
                            /*if (iAttribute.Name == VERSION_ATTRIBUTE)
                                CurrentWockets._Version = iAttribute.Value;
                            else*/ if (iAttribute.Name == MODE_ATTRIBUTE)
                                this._SoftwareMode = ((String.Compare(iAttribute.Value, SoftwareConfiguration.DEBUG.ToString(), true) == 0) ? SoftwareConfiguration.DEBUG : SoftwareConfiguration.RELEASE);
                            else if (iAttribute.Name == MEMORY_MODE_ATTRIBUTE)
                                this._MemoryMode = ((String.Compare(iAttribute.Value, MemoryConfiguration.NON_SHARED.ToString(), true) == 0) ? MemoryConfiguration.NON_SHARED : MemoryConfiguration.SHARED);
                    }
                    else if (iNode.Name == FEATURES_ELEMENT)
                    {
                        foreach (XmlAttribute iAttribute in iNode.Attributes)
                            if (iAttribute.Name == FFT_INTERPOLATION_POWER_ATTRIBUTE)
                                this._FFTInterpolationPower = Convert.ToInt32(iAttribute.Value);
                            else if (iAttribute.Name == FFT_MAX_FREQUENCIES_ATTRIBUTE)
                                this._FFTMaximumFrequencies = Convert.ToInt32(iAttribute.Value);
                            else if (iAttribute.Name == SMOOTH_WINDOW_ATTRIBUTE)
                                this._SmoothWindowCount = Convert.ToInt32(iAttribute.Value);
                            else if (iAttribute.Name == FEATURE_WINDOW_SIZE_ATTRIBUTE)
                                this._FeatureWindowSize= Convert.ToInt32(iAttribute.Value);
                            else if (iAttribute.Name == FEATURE_WINDOW_OVERLAP_ATTRIBUTE)
                                this._FeatureWindowOverlap = Convert.ToDouble(iAttribute.Value);
                            else if (iAttribute.Name == ERROR_WINDOW_SIZE_ATTRIBUTE)
                                this._ErrorWindowSize = Convert.ToInt32(iAttribute.Value);
                            else if (iAttribute.Name == MAXIMUM_CONSECUTIVE_PACKET_LOSS_ATTRIBUTE)
                                this._MaximumConsecutivePacketLoss = Convert.ToInt32(iAttribute.Value);
                            else if (iAttribute.Name == MAXIMUM_NONCONSECUTIVE_PACKET_LOSS_ATTRIBUTE)
                                this._MaximumNonconsecutivePacketLoss = Convert.ToDouble(iAttribute.Value);
                    }
                }
            }
        }