public void DefaultCodeInspectionsIsNotNull()
        {
            var configService = new ConfigurationLoader();
            var config = configService.GetDefaultCodeInspections();

            Assert.IsNotNull(config);
        }
Esempio n. 2
0
 public void Setup() {
     dir = FileSystemHelper.ResetTemporaryDirectory();
     opts = new ConfigurationOptions {
         FileSet = new FileSet(dir,"*.bxls")
     };
     writefile("simple_config", simple_config);
     loader = new ConfigurationLoader(opts);
 }
        public void GetDefaultTodoMarkersTest()
        {
            var configService = new ConfigurationLoader();

            ToDoMarker[] markers = configService.GetDefaultTodoMarkers();
            Assert.AreEqual("NOTE:", markers[0].Text,"Note failed to load.");
            Assert.AreEqual("TODO:", markers[1].Text,"Todo failed to load.");
            Assert.AreEqual("BUG:", markers[2].Text,"Bug failed to load.");
        }
        private static IEnumerable<ICodeGenerator> GetGenerators(IGeneratorArguments arguments)
        {
            ConfigurationLoader config = new ConfigurationLoader(arguments);

            if (config.Count == 0)
                arguments.WriteLine("{0}: warning: Unable to locate generators.", arguments.InputPath);
            
            return config;
        }
        public void ToDoMarkersTextIsNotNull()
        {
            var configService = new ConfigurationLoader();
            ToDoMarker[] markers = configService.LoadConfiguration().UserSettings.ToDoListSettings.ToDoMarkers;

            foreach (var marker in markers)
            {
                Assert.IsNotNull(marker.Text);
            }
        }
        public void Intialize()
        {
            _addin = new Mock<AddIn>();
            _view = new Mock<IToDoExplorerWindow>();

            _window = RdMockFacotry.CreateWindowMock();
            _windows = new MockWindowsCollection(_window.Object);

            _loader = new ConfigurationLoader();
            _markers = _loader.GetDefaultTodoMarkers();

            _gridViewSorter = new GridViewSort<ToDoItem>("Priority", false);
        }
        public void TestAppSettingNotFound()
        {
            const string appsettingKey = "someRandomKey";
            var appSetting = ConfigurationManager.AppSettings[appsettingKey];
            appSetting.Should().BeNull();

            var config = new ConfigurationLoader<DevSettings>(overrideType: OverrideType.AppSettingKey);
            var devSettings = config.Create(appsettingKey);

            devSettings.Should().NotBeNull();
            devSettings.ConnectionStringName.Should().Be("valueabc");
            devSettings.SomeCount.Should().Be(5);
            devSettings.SomePath.Should().Be(@"C:\temp\mypath");
        }
        public void DefaultCodeInspectionsIsAsSpecified()
        {
            var inspection = new Mock<IInspection>();
            inspection.SetupGet(m => m.Description).Returns("TestInspection");
            inspection.SetupGet(m => m.Name).Returns("TestInspection");
            inspection.SetupGet(m => m.Severity).Returns(CodeInspectionSeverity.DoNotShow);

            var expected = new[] { inspection.Object };
            var configService = new ConfigurationLoader(expected, null);

            var actual = configService.GetDefaultCodeInspections();

            Assert.AreEqual(expected.Length, actual.Length);
            Assert.AreEqual(inspection.Object.Name, actual[0].Name);
            Assert.AreEqual(inspection.Object.Severity, actual[0].Severity);
        }
        public void TestChain_EnvironmentVariableFound()
        {
            //have appsetting and machine name in settings
            var machineNameFinder = new FakeMachineNameFinder("jonDevAppSettingTest");
            var appsettings = new FakeAppsettingsLoader("myoverridekey", "jonDevAppSettingTest");

            var config = new ConfigurationLoader<DevSettings>(machineNameFinder: machineNameFinder, appSettings: appsettings);

            const string envVariablesName = "myoverridekey";
            Environment.SetEnvironmentVariable(envVariablesName, "myenvvar");

            var devSettings = config.Create(envVariablesName);

            devSettings.Should().NotBeNull();
            devSettings.ConnectionStringName.Should().Be("valueabc");
            devSettings.SomeCount.Should().Be(6);
            devSettings.SomePath.Should().Be(@"C:\temp\mypath");
        }
Esempio n. 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NDjangoViewEngine"/> class.
        /// It can happen only once - in the NDjangoHandle constructor there's special lock for this contructor's call.
        /// </summary>
        public NDjangoViewEngine()
        {
            loader = new ConfigurationLoader();
            //provider = new TemplateManagerProvider().WithLoader(this).WithTag("url", new AspMvcUrlTag());
            //provider = NDjango.FiltersCS.FilterManager.Initialize(provider);
            provider =
                new TemplateManagerProvider()
                    .WithLoader(this)
                    .WithFilters(loader.GetFilters())
                    .WithTags(loader.GetTags())
                    .WithTag("url", new AspMvcUrlTag())
                    .WithFilters(NDjango.FiltersCS.FilterManager.GetFilters());

            base.ViewLocationFormats = new string[] { "~/Views/{1}/{0}.django" };

            base.PartialViewLocationFormats = base.ViewLocationFormats;
            rootDir = HttpRuntime.AppDomainAppPath;

            ViewEngines.Engines.Add(this);
        }
Esempio n. 11
0
        public static void Main(string[] args)
        {
            ArgvConfigSource configSource = new ArgvConfigSource(args);

            XmlConfigurator.Configure();

            configSource.AddSwitch("Startup", "inifile");
            configSource.AddSwitch("Startup", "inimaster");
            configSource.AddSwitch("Startup", "inidirectory");

            ConfigurationLoader configurationLoader = new ConfigurationLoader();
            ConfigSettings appSettings;
            NetworkServersInfo networkSettings;
            configurationLoader.LoadConfigSettings(configSource, out appSettings, out networkSettings);

            MigrationWorker app = new MigrationWorker(configSource);
            app.Start();

            Console.WriteLine("Hit enter to quit");
            Console.ReadLine();
        }
Esempio n. 12
0
 public void Startup(ConfigurationLoader loader)
 {
     /* intentionally left empty */
 }
Esempio n. 13
0
        public void PostLoad()
        {
            bool failed      = false;
            var  failedtests = new List <string>();

            LogController.AddLogAction(AddLog);
            foreach (ITest test in m_Tests)
            {
                var tr = new TestResult
                {
                    Name    = test.GetType().FullName,
                    RunTime = Environment.TickCount
                };
                m_Log.Info("********************************************************************************");
                m_Log.InfoFormat("Executing test {0}", test.GetType().FullName);
                m_Log.Info("********************************************************************************");
                try
                {
                    ClearLog();
                    test.Setup();

                    if (test.Run())
                    {
                        tr.Message = "Success\n\nLog:\n" + GetLog();
                        tr.Result  = true;

                        m_Log.Info("********************************************************************************");
                        m_Log.InfoFormat("Executed test {0} with SUCCESS", test.GetType().FullName);
                        m_Log.Info("********************************************************************************");
                    }
                    else
                    {
                        failed     = true;
                        tr.Message = "Failure\n\nLog:\n" + GetLog();
                        tr.Result  = false;
                        failedtests.Add(test.GetType().FullName);

                        m_Log.Info("********************************************************************************");
                        m_Log.ErrorFormat("Executed test {0} with FAILURE", test.GetType().FullName);
                        m_Log.Info("********************************************************************************");
                    }
                }
                catch (Exception e)
                {
                    failed        = true;
                    tr.Message    = string.Format("Exception {0}: {1}\n{2}\n\nLog:\n", e.GetType().FullName, e.ToString(), e.StackTrace.ToString()) + GetLog();
                    tr.Result     = false;
                    tr.StackTrace = e.StackTrace;
                    if (!failedtests.Contains(test.GetType().FullName))
                    {
                        failedtests.Add(test.GetType().FullName);
                    }

                    m_Log.Info("********************************************************************************");
                    m_Log.InfoFormat("Executed test {0} with FAILURE", test.GetType().FullName);
                    m_Log.ErrorFormat("Exception {0}: {1}\n{2}", e.GetType().FullName, e.ToString(), e.StackTrace.ToString());
                    m_Log.Info("********************************************************************************");
                }

                try
                {
                    test.Cleanup();
                }
                catch (Exception e)
                {
                    m_Log.Info("********************************************************************************");
                    m_Log.InfoFormat("Executed test {0} with FAILURE (Cleanup)", test.GetType().FullName);
                    m_Log.ErrorFormat("Exception {0}: {1}\n{2}", e.GetType().FullName, e.ToString(), e.StackTrace.ToString());
                    m_Log.Info("********************************************************************************");
                    failed        = true;
                    tr.Message    = string.Format("Exception {0}: {1}\n{2}\n\nLog:\n", e.GetType().FullName, e.ToString(), e.StackTrace.ToString()) + GetLog();
                    tr.Result     = false;
                    tr.StackTrace = e.StackTrace;
                    if (!failedtests.Contains(test.GetType().FullName))
                    {
                        failedtests.Add(test.GetType().FullName);
                    }
                }

                if (ExcludeSummaryCount)
                {
                    tr.RunTime = 0;
                }
                else
                {
                    tr.RunTime = Environment.TickCount - tr.RunTime;
                }

                TestResults.Add(tr);
            }

            if (m_XUnitResultsFileName?.Length != 0)
            {
                WriteXUnitResults(m_XUnitResultsFileName);
            }

            if (m_NUnitResultsFileName?.Length != 0)
            {
                WriteNUnit2Results(m_NUnitResultsFileName);
            }

            if (failed)
            {
                m_Log.InfoFormat("Failed tests ({0}): {1}", failedtests.Count, string.Join(" ", failedtests));
                Thread.Sleep(100);
                throw new ConfigurationLoader.TestingErrorException();
            }
            else
            {
                ConfigurationLoader loader = m_Loader;
                if (null != loader)
                {
                    loader.TriggerShutdown();
                }
            }
        }
Esempio n. 14
0
 public void Startup(ConfigurationLoader loader)
 {
     ThreadManager.CreateThread(HandlerThread).Start();
 }
        public void TestMachineNameNotFound()
        {
            var machineNameFinder = new FakeMachineNameFinder("bob");
            var appsettings = new FakeAppsettingsLoader("myoverridekey", "jonDevAppSettingTest");

            var config = new ConfigurationLoader<DevSettings>(overrideType: OverrideType.MachineName, machineNameFinder: machineNameFinder, appSettings: appsettings);
            var devSettings = config.Create();

            devSettings.Should().NotBeNull();
            devSettings.ConnectionStringName.Should().Be("valueabc");
            devSettings.SomeCount.Should().Be(5);
            devSettings.SomePath.Should().Be(@"C:\temp\mypath");
        }
Esempio n. 16
0
        public void Startup(ConfigurationLoader loader)
        {
            IConfig config = loader.Config.Configs[GetType().FullName];

            m_Service = loader.GetService <ServerParamServiceInterface>(config.GetString("ServerParamService"));
        }
Esempio n. 17
0
 public void Startup(ConfigurationLoader loader)
 {
     m_VoiceService = loader.GetService <VoiceServiceInterface>(m_VoiceServiceName);
 }
Esempio n. 18
0
        /// <summary>
        /// Creates a new Base Handler Configuration which loads common Handler settings from a Configuration Graph
        /// </summary>
        /// <param name="g">Configuration Graph</param>
        /// <param name="objNode">Object Node</param>
        public BaseHandlerConfiguration(IGraph g, INode objNode)
        {
            // Are there any User Groups associated with this Handler?
            IEnumerable <INode> groups = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUserGroup)));

            foreach (INode group in groups)
            {
                Object temp = ConfigurationLoader.LoadObject(g, group);
                if (temp is UserGroup)
                {
                    this._userGroups.Add((UserGroup)temp);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load Handler Configuration as the RDF Configuration file specifies a value for the Handlers dnr:userGroup property which cannot be loaded as an object which is a UserGroup");
                }
            }

            // General Handler Settings
            this._showErrors = ConfigurationLoader.GetConfigurationBoolean(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyShowErrors)), this._showErrors);
            String introFile = ConfigurationLoader.GetConfigurationString(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyIntroFile)));

            if (introFile != null)
            {
                introFile = ConfigurationLoader.ResolvePath(introFile);
                if (File.Exists(introFile))
                {
                    using (StreamReader reader = new StreamReader(introFile))
                    {
                        this._introText = reader.ReadToEnd();
                        reader.Close();
                    }
                }
            }
            this._stylesheet  = ConfigurationLoader.GetConfigurationString(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyStylesheet))).ToSafeString();
            this._corsEnabled = ConfigurationLoader.GetConfigurationBoolean(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyEnableCors)), true);

            // Cache Settings
            this._cacheDuration = ConfigurationLoader.GetConfigurationInt32(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyCacheDuration)), this._cacheDuration);
            if (this._cacheDuration < MinimumCacheDuration)
            {
                this._cacheDuration = MinimumCacheDuration;
            }
            if (this._cacheDuration > MaximumCacheDuration)
            {
                this._cacheDuration = MaximumCacheDuration;
            }
            this._cacheSliding = ConfigurationLoader.GetConfigurationBoolean(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyCacheSliding)), this._cacheSliding);

            // SPARQL Expression Factories
            IEnumerable <INode> factories = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyExpressionFactory)));

            foreach (INode factory in factories)
            {
                Object temp = ConfigurationLoader.LoadObject(g, factory);
                if (temp is ISparqlCustomExpressionFactory)
                {
                    this._expressionFactories.Add((ISparqlCustomExpressionFactory)temp);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load Handler Configuration as the RDF Configuration file specifies a value for the Handlers dnr:expressionFactory property which cannot be loaded as an object which is a SPARQL Expression Factory");
                }
            }

            // SPARQL Property Function Factories
            factories = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFunctionFactory)));
            foreach (INode factory in factories)
            {
                Object temp = ConfigurationLoader.LoadObject(g, factory);
                if (temp is IPropertyFunctionFactory)
                {
                    this._propertyFunctionFactories.Add((IPropertyFunctionFactory)temp);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load Handler Configuration as the RDF Configuration file specifies a value for the Handlers dnr:propertyFunctionFactory property which cannot be loaded as an object which is a SPARQL Property Function Factory");
                }
            }

            // Writer Properties
            this._writerCompressionLevel = ConfigurationLoader.GetConfigurationInt32(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyCompressionLevel)), this._writerCompressionLevel);
            this._writerDtds             = ConfigurationLoader.GetConfigurationBoolean(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyDtdWriting)), this._writerDtds);
            this._writerHighSpeed        = ConfigurationLoader.GetConfigurationBoolean(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyHighSpeedWriting)), this._writerHighSpeed);
            this._writerMultiThreading   = ConfigurationLoader.GetConfigurationBoolean(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyMultiThreadedWriting)), this._writerMultiThreading);
            this._writerPrettyPrinting   = ConfigurationLoader.GetConfigurationBoolean(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyPrettyPrinting)), this._writerPrettyPrinting);
            this._writerAttributes       = ConfigurationLoader.GetConfigurationBoolean(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyAttributeWriting)), this._writerAttributes);

            // Load in the Default Namespaces if specified
            INode nsNode = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyImportNamespacesFrom)));

            if (nsNode != null)
            {
                Object nsTemp = ConfigurationLoader.LoadObject(g, nsNode);
                if (nsTemp is IGraph)
                {
                    this._defaultNamespaces.Import(((IGraph)nsTemp).NamespaceMap);
                }
            }
        }
Esempio n. 19
0
        public void Initialize(DrawArgs drawArgs)
        {
            try
            {
                m_Initializing = true;

                double centerLatitude  = 0.5 * (m_GeoBB.North + m_GeoBB.South);
                double centerLongitude = 0.5 * (m_GeoBB.West + m_GeoBB.East);

                m_NwImageLayer = CreateImageLayer(m_GeoBB.North, centerLatitude, m_GeoBB.West, centerLongitude, drawArgs,
                                                  String.Format("{0}\\{1}\\{2}\\{3:D4}\\{3:D4}_{4:D4}.dds",
                                                                ShapeTile.CachePath,
                                                                ConfigurationLoader.GetRenderablePathString(m_ShapeTileArgs.ParentShapeFileLayer),
                                                                Level + 1,
                                                                2 * Row + 1,
                                                                2 * Col));

                m_NeImageLayer = CreateImageLayer(m_GeoBB.North, centerLatitude, centerLongitude, m_GeoBB.East, drawArgs,
                                                  String.Format("{0}\\{1}\\{2}\\{3:D4}\\{3:D4}_{4:D4}.dds",
                                                                ShapeTile.CachePath,
                                                                ConfigurationLoader.GetRenderablePathString(m_ShapeTileArgs.ParentShapeFileLayer),
                                                                Level + 1,
                                                                2 * Row + 1,
                                                                2 * Col + 1));

                m_SwImageLayer = CreateImageLayer(centerLatitude, m_GeoBB.South, m_GeoBB.West, centerLongitude, drawArgs,
                                                  String.Format("{0}\\{1}\\{2}\\{3:D4}\\{3:D4}_{4:D4}.dds",
                                                                ShapeTile.CachePath,
                                                                ConfigurationLoader.GetRenderablePathString(m_ShapeTileArgs.ParentShapeFileLayer),
                                                                Level + 1,
                                                                2 * Row,
                                                                2 * Col));

                m_SeImageLayer = CreateImageLayer(centerLatitude, m_GeoBB.South, centerLongitude, m_GeoBB.East, drawArgs,
                                                  String.Format("{0}\\{1}\\{2}\\{3:D4}\\{3:D4}_{4:D4}.dds",
                                                                ShapeTile.CachePath,
                                                                ConfigurationLoader.GetRenderablePathString(m_ShapeTileArgs.ParentShapeFileLayer),
                                                                Level + 1,
                                                                2 * Row,
                                                                2 * Col + 1));


                if (m_NwImageLayer != null)
                {
                    m_NwImageLayer.Initialize(drawArgs);
                }
                if (m_NeImageLayer != null)
                {
                    m_NeImageLayer.Initialize(drawArgs);
                }
                if (m_SwImageLayer != null)
                {
                    m_SwImageLayer.Initialize(drawArgs);
                }
                if (m_SeImageLayer != null)
                {
                    m_SeImageLayer.Initialize(drawArgs);
                }
            }
            catch (Exception ex)
            {
                Utility.Log.Write(ex);
            }
            finally
            {
                m_Initializing = false;
                if (m_Disposing)
                {
                    Dispose();
                    m_Initialized = false;
                }
                else
                {
                    m_Initialized = true;
                }
            }
        }
Esempio n. 20
0
 protected virtual void LoadConfigSettings(IConfigSource configSource)
 {
     m_configLoader = new ConfigurationLoader();
     m_config = m_configLoader.LoadConfigSettings(configSource, out m_configSettings);
     ReadExtraConfigSettings();
 }
        public void TestChain_MachineNameFound()
        {
            //machine name only
            var machineNameFinder = new FakeMachineNameFinder("mymachineName");
            var appsettings = new FakeAppsettingsLoader("myoverridekey", "jonDevAppSettingTestXXX");

            const string envVariablesName = "myoverridekey";
            Environment.SetEnvironmentVariable(envVariablesName, "myenvvarx");

            var config = new ConfigurationLoader<DevSettings>(machineNameFinder: machineNameFinder, appSettings: appsettings);
            var devSettings = config.Create(envVariablesName);

            devSettings.Should().NotBeNull();
            devSettings.ConnectionStringName.Should().Be("valueabc");
            devSettings.SomeCount.Should().Be(5);
            devSettings.SomePath.Should().Be(@"E:\work");
        }
 public void Startup(ConfigurationLoader loader)
 {
 }
Esempio n. 23
0
 public void Startup(ConfigurationLoader loader)
 {
     m_HttpServer = loader.HttpServer;
 }
Esempio n. 24
0
 public MySQLAssetService(ConfigurationLoader loader, IConfig ownSection)
 {
     m_ConnectionString    = MySQLUtilities.BuildConnectionString(ownSection, m_Log);
     m_ConfigurationIssues = loader.KnownConfigurationIssues;
     m_ReferencesService   = new MySQLAssetReferencesService(this);
 }
        /// <summary>
        /// Tries to load a Graph based on information from the Configuration Graph.
        /// </summary>
        /// <param name="g">Configuration Graph.</param>
        /// <param name="objNode">Object Node.</param>
        /// <param name="targetType">Target Type.</param>
        /// <param name="obj">Output Object.</param>
        /// <returns></returns>
        public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
        {
            obj = null;
            IGraph output;

            // Check whether to use a specific Triple Collection
            INode collectionNode = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUsingTripleCollection)));

            try
            {
                if (collectionNode == null)
                {
                    // Simple Graph creation
                    output = (IGraph)Activator.CreateInstance(targetType);
                }
                else
                {
                    // Graph with custom triple collection
                    BaseTripleCollection tripleCollection = ConfigurationLoader.LoadObject(g, collectionNode) as BaseTripleCollection;
                    if (tripleCollection == null)
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the Graph identified by the Node '" + objNode.ToString() + "' as the dnr:usingTripleCollection points to an object which cannot be loaded as an instance of the required type BaseTripleCollection");
                    }
                    output = (IGraph)Activator.CreateInstance(targetType, new Object[] { tripleCollection });
                }
            }
            catch
            {
                // Any error means this loader can't load this type
                return(false);
            }

            // Now we want to find out where the data for the Graph is coming from
            // Data Source loading order is Graphs, Files, Strings, Databases, Stores, URIs
            IEnumerable <INode> sources;

            // Load from Graphs
            sources = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFromGraph)));
            foreach (INode source in sources)
            {
                ConfigurationLoader.CheckCircularReference(objNode, source, "dnr:fromGraph");

                Object graph = ConfigurationLoader.LoadObject(g, source);
                if (graph is IGraph)
                {
                    output.Merge((IGraph)graph);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load data from another Graph for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:fromGraph property points to an Object that cannot be loaded as an object which implements the IGraph interface");
                }
            }

            // Load from Embedded Resources
            sources = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFromEmbedded)));
            foreach (INode source in sources)
            {
                if (source.NodeType == NodeType.Literal)
                {
                    EmbeddedResourceLoader.Load(output, ((ILiteralNode)source).Value);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load data from an Embedded Resource for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:fromEmbedded property is not a Literal Node as required");
                }
            }

            // Load from Files
            sources = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFromFile)));
            foreach (INode source in sources)
            {
                if (source.NodeType == NodeType.Literal)
                {
                    FileLoader.Load(output, ConfigurationLoader.ResolvePath(((ILiteralNode)source).Value));
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load data from a file for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:fromFile property is not a Literal Node as required");
                }
            }

            // Load from Strings
            sources = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFromString)));
            foreach (INode source in sources)
            {
                if (source.NodeType == NodeType.Literal)
                {
                    StringParser.Parse(output, ((ILiteralNode)source).Value);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load data from a string for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:fromString property is not a Literal Node as required");
                }
            }

            IEnumerable <Object> connections;

            // Load from Stores
            IEnumerable <INode> stores = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFromStore)));

            stores.All(s => !ConfigurationLoader.CheckCircularReference(objNode, s, "dnr:fromStore"));
            connections = stores.Select(s => ConfigurationLoader.LoadObject(g, s));
            sources     = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyWithUri)));
            foreach (Object store in connections)
            {
                if (store is IStorageProvider)
                {
                    foreach (INode source in sources)
                    {
                        if (source.NodeType == NodeType.Uri || source.NodeType == NodeType.Literal)
                        {
                            ((IStorageProvider)store).LoadGraph(output, source.ToString());
                        }
                        else
                        {
                            throw new DotNetRdfConfigurationException("Unable to load data from a Generic Store for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:withUri property is not a URI/Literal Node as required");
                        }
                    }
                }
                else if (store is ITripleStore)
                {
                    foreach (INode source in sources)
                    {
                        if (source.NodeType == NodeType.Uri)
                        {
                            output.Merge(((ITripleStore)store)[((IUriNode)source).Uri]);
                        }
                        else if (source.NodeType == NodeType.Literal)
                        {
                            output.Merge(((ITripleStore)store)[UriFactory.Create(((ILiteralNode)source).Value)]);
                        }
                        else
                        {
                            throw new DotNetRdfConfigurationException("Unable to load data from a Store for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:withUri property is not a URI/Literal Node as required");
                        }
                    }
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load data from a Store for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values of the dnr:fromStore property points to an Object which cannot be loaded as an object which implements either the IStorageProvider/ITripleStore interface");
                }
            }

            // Load from Datasets
            IEnumerable <INode> ds = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFromDataset)));

            ds.All(d => !ConfigurationLoader.CheckCircularReference(objNode, d, ConfigurationLoader.PropertyFromDataset));
            IEnumerable <Object> datasets = ds.Select(d => ConfigurationLoader.LoadObject(g, d));

            sources = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyWithUri)));
            foreach (Object dataset in datasets)
            {
                if (dataset is ISparqlDataset)
                {
                    foreach (INode source in sources)
                    {
                        if (source.NodeType == NodeType.Uri)
                        {
                            output.Merge(((ISparqlDataset)dataset)[((IUriNode)sources).Uri]);
                        }
                        else if (source.NodeType == NodeType.Literal)
                        {
                            output.Merge(((ISparqlDataset)dataset)[UriFactory.Create(((ILiteralNode)source).Value)]);
                        }
                        else
                        {
                            throw new DotNetRdfConfigurationException("Unable to load data from a Dataset for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:withUri property is not a URI/Literal Node as required");
                        }
                    }
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load data from a Dataset for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values of the dnr:fromDataset property points to an Object which cannot be loaded as an object which implements the required ISparqlDataset interface");
                }
            }


            // Finally load from Remote URIs
            sources = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFromUri)));
            foreach (INode source in sources)
            {
                if (source.NodeType == NodeType.Uri)
                {
                    UriLoader.Load(output, ((IUriNode)source).Uri);
                }
                else if (source.NodeType == NodeType.Literal)
                {
                    UriLoader.Load(output, UriFactory.Create(((ILiteralNode)source).Value));
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load data from a URI for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:fromUri property is not a URI/Literal Node as required");
                }
            }

            // Then are we assigning a Base URI to this Graph which overrides any existing Base URI?
            INode baseUri = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyAssignUri)));

            if (baseUri != null)
            {
                if (baseUri.NodeType == NodeType.Uri)
                {
                    output.BaseUri = ((IUriNode)baseUri).Uri;
                }
                else if (baseUri.NodeType == NodeType.Literal)
                {
                    output.BaseUri = UriFactory.Create(((ILiteralNode)baseUri).Value);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to assign a new Base URI for the Graph identified by the Node '" + objNode.ToString() + "' as the value for the dnr:assignUri property is not a URI/Literal Node as required");
                }
            }

            // Finally we'll apply any reasoners
            IEnumerable <INode> reasoners = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyReasoner)));

            foreach (INode reasoner in reasoners)
            {
                Object temp = ConfigurationLoader.LoadObject(g, reasoner);
                if (temp is IInferenceEngine)
                {
                    ((IInferenceEngine)temp).Apply(output);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to apply a reasoner for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:reasoner property points to an Object which cannot be loaded as an object which implements the IInferenceEngine interface");
                }
            }

            obj = output;
            return(true);
        }
Esempio n. 26
0
        /// <summary>
        /// Tries to load a SPARQL Dataset based on information from the Configuration Graph
        /// </summary>
        /// <param name="g">Configuration Graph</param>
        /// <param name="objNode">Object Node</param>
        /// <param name="targetType">Target Type</param>
        /// <param name="obj">Output Object</param>
        /// <returns></returns>
        public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
        {
            obj = null;
            bool  unionDefGraph    = ConfigurationLoader.GetConfigurationBoolean(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUnionDefaultGraph)), false);
            INode defaultGraphNode = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyDefaultGraphUri)));
            Uri   defaultGraph     = (defaultGraphNode != null && defaultGraphNode.NodeType == NodeType.Uri ? ((IUriNode)defaultGraphNode).Uri : null);

            INode storeNode;

            switch (targetType.FullName)
            {
            case InMemoryDataset:
                storeNode = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUsingStore)));
                if (storeNode == null)
                {
                    obj = new InMemoryDataset();
                }
                else
                {
                    Object temp = ConfigurationLoader.LoadObject(g, storeNode);
                    if (temp is IInMemoryQueryableStore)
                    {
                        if (unionDefGraph)
                        {
                            obj = new InMemoryDataset((IInMemoryQueryableStore)temp, unionDefGraph);
                        }
                        else if (defaultGraph != null)
                        {
                            obj = new InMemoryDataset((IInMemoryQueryableStore)temp, defaultGraph);
                        }
                        else
                        {
                            obj = new InMemoryDataset((IInMemoryQueryableStore)temp);
                        }
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the In-Memory Dataset identified by the Node '" + objNode.ToString() + "' since the Object pointed to by the dnr:usingStore property could not be loaded as an object which implements the IInMemoryQueryableStore interface");
                    }
                }
                break;

            case InMemoryQuadDataset:
                storeNode = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUsingStore)));
                if (storeNode == null)
                {
                    obj = new InMemoryQuadDataset();
                }
                else
                {
                    Object temp = ConfigurationLoader.LoadObject(g, storeNode);
                    if (temp is IInMemoryQueryableStore)
                    {
                        obj = new InMemoryQuadDataset((IInMemoryQueryableStore)temp);
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the In-Memory Dataset identified by the Node '" + objNode.ToString() + "' since the Object pointed to by the dnr:usingStore property could not be loaded as an object which implements the IInMemoryQueryableStore interface");
                    }
                }
                break;

            case WebDemandDataset:
                storeNode = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUsingDataset)));
                if (storeNode == null)
                {
                    obj = new WebDemandDataset(new InMemoryQuadDataset());
                }
                else
                {
                    Object temp = ConfigurationLoader.LoadObject(g, storeNode);
                    if (temp is ISparqlDataset)
                    {
                        obj = new WebDemandDataset((ISparqlDataset)temp);
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the Web Demand Dataset identified by the Node '" + objNode.ToString() + "' since the Object pointed to by the dnr:usingDataset property could not be loaded as an object which implements the ISparqlDataset interface");
                    }
                }
                break;
            }

            return(obj != null);
        }
Esempio n. 27
0
        protected virtual void LoadConfigSettings(IConfigSource configSource)
        {
			if (m_log.IsDebugEnabled) {
				m_log.DebugFormat ("{0} called", System.Reflection.MethodBase.GetCurrentMethod().Name);
			}

            m_configLoader = new ConfigurationLoader();
            ConfigSource = m_configLoader.LoadConfigSettings(configSource, envConfigSource, out m_configSettings, out m_networkServersInfo);
            Config = ConfigSource.Source;
            ReadExtraConfigSettings();
        }
Esempio n. 28
0
        public static Dictionary <String, Object> collateData(String txnName, String url, IJavaScriptExecutor jsExe, int txnStatus)
        {
            log.Debug("Started collate data for Transaction : " + txnName + " with status " + txnStatus);
            Dictionary <String, Object> rtnValue = new Dictionary <string, object>();
            long    currNavTime;
            long    totalTime  = 0;
            long    serverTime = 0;
            Boolean navType    = false;
            double  speedIndex = 0;

            Dictionary <String, Object> collectedData = new Dictionary <string, object>();

            try
            {
                Dictionary <string, object>         navigationDetails = new Dictionary <string, object>();
                Dictionary <string, object>         memoryDetails     = new Dictionary <string, object>();
                Dictionary <string, object>         browserDetails    = new Dictionary <string, object>();
                Dictionary <String, Object>         heapUsage         = new Dictionary <string, object>();
                List <Dictionary <String, Object> > resourceDetails   = null;
                List <Dictionary <String, Object> > markDetails       = null;

                Boolean       isNavigationAPIEnabled, isResourceAPIEnabled, isMemoryAPIEnabled, isMarkAPIEnabled;
                StringBuilder document = new StringBuilder();
                long          loadEventEnd, currentHeapUsage, msFirstPaint;
                long          startTime, endTime, duration;

                //Load Configuration from remote service

                ConfigurationLoader config = ConfigurationLoader.getInstance();
                if (config.clientConfig.Count > 0)
                {
                    log.Debug("Configuration Loading..");
                    collectedData = (from x in config.clientConfig select x).ToDictionary(x => x.Key, x => x.Value);
                    collectedData.Add("TxnName", txnName);
                    collectedData.Add("txnStatus", txnStatus);
                    collectedData.Add("Url", url);

                    isNavigationAPIEnabled = ((config.clientConfig.ContainsKey("isNavigationAPIEnabled")) ? Convert.ToBoolean(config.clientConfig["isNavigationAPIEnabled"]) : false);
                    isResourceAPIEnabled   = ((config.clientConfig.ContainsKey("isResourceAPIEnabled")) ? Convert.ToBoolean(config.clientConfig["isResourceAPIEnabled"]) : false);
                    isMemoryAPIEnabled     = ((config.clientConfig.ContainsKey("isMemoryAPIEnabled")) ? Convert.ToBoolean(config.clientConfig["isMemoryAPIEnabled"]) : false);
                    isMarkAPIEnabled       = ((config.clientConfig.ContainsKey("isMarkAPIEnabled")) ? Convert.ToBoolean(config.clientConfig["isMarkAPIEnabled"]) : false);

                    log.Debug("Configuration Loading completed");
                    log.Debug("Navigation API data collection started for " + txnName);

                    if (isNavigationAPIEnabled)
                    {
                        log.Debug("User Agent : " + CollectorConstants.getUserAgent());
                        if (CollectorConstants.getUserAgent().Contains("Trident"))
                        {
                            log.Debug("Processing IE logic");
                            startTime = getCurrentMilliSeconds();
                            do
                            {
                                loadEventEnd = Convert.ToInt64(jsExe.ExecuteScript(CollectorConstants.getLoadEventEndIE()).ToString());
                                endTime      = getCurrentMilliSeconds();
                                duration     = (endTime - startTime) / 1000;
                                if (duration > 180)
                                {
                                    break;
                                }
                            }while (loadEventEnd <= 0);

                            object strNavigationDetails = jsExe.ExecuteScript(CollectorConstants.getNavigationTimeIE());
                            navigationDetails = JSONUtils.JsonStringToMap(strNavigationDetails.ToString());
                        }
                        else
                        {
                            log.Debug("Processing other browser logic");
                            //Loop until loadEventEnd is non zero or 3 minutes to avoid infinite loop
                            startTime = getCurrentMilliSeconds();
                            do
                            {
                                //navigationDetails = (Map<String, Object>)jsExe.executeScript("var performance = window.performance || window.webkitPerformance || window.mozPerformance || window.msPerformance || {};var timings = performance.timing || {}; return timings.loadEventEnd;");
                                loadEventEnd = Convert.ToInt64(jsExe.ExecuteScript(CollectorConstants.getLoadEventEnd()).ToString());
                                endTime      = getCurrentMilliSeconds();
                                duration     = (endTime - startTime) / 1000;
                                if (duration > 180)
                                {
                                    break;
                                }
                            }while (loadEventEnd <= 0); //Adding the loop to avoid loadEventEnd = 0

                            navigationDetails = (Dictionary <String, Object>)jsExe.ExecuteScript(CollectorConstants.getNavigationTime());
                            if (CollectorConstants.getUserAgent().Contains("Chrome") && !CollectorConstants.getUserAgent().Contains("Edge"))
                            {
                                msFirstPaint = (long)jsExe.ExecuteScript(CollectorConstants.getFirstPaint());
                                if (msFirstPaint != -9999)
                                {
                                    collectedData.Add("msFirstPaint", msFirstPaint);
                                }
                                else
                                {
                                    collectedData.Add("msFirstPaint", navigationDetails["loadEventEnd"]);
                                }
                            }
                            else
                            {
                                //No first paint event available for firefox
                                if (!CollectorConstants.getUserAgent().Contains("Edge"))
                                {
                                    collectedData.Add("msFirstPaint", navigationDetails["loadEventEnd"]);
                                }
                            }
                        }

                        log.Debug("Collected Navigation API data " + navigationDetails.ToString() + " for Transaction : " + txnName);
                        //validate if this is a new transaction. If true persist data else break immediately

                        currNavTime = (long)navigationDetails["navigationStart"];

                        if (currNavTime > getPrevTxnStartTime())
                        {
                            setPrevTxnStartTime(currNavTime);
                            navType = true;
                            collectedData.Add("StartTime", currNavTime);
                            totalTime  = ((long)navigationDetails["loadEventEnd"] - (long)navigationDetails["navigationStart"]);
                            serverTime = ((long)navigationDetails["responseStart"] - (long)navigationDetails["requestStart"]);
                            log.Debug("Hard Navigation : {}" + txnName);
                            speedIndex = Convert.ToDouble(jsExe.ExecuteScript(CollectorConstants.getSpeedIndex()));
                            collectedData.Add("SpeedIndex", speedIndex);
                            log.Debug("SpeedIndex for Transaction:" + txnName + " is " + speedIndex);
                        }
                        else
                        {
                            navType = false;
                            collectedData.Add("StartTime", getCurrentMilliSeconds());
                            navigationDetails = null;
                            log.Debug("Soft Navigation : {}" + txnName);
                        }
                        collectedData.Add("NavigationTime", navigationDetails);
                        collectedData.Add("NavType", navType);
                    }
                    // Fetch Client-side Resource Details via Resource Timing API
                    if (isResourceAPIEnabled)
                    {
                        long beforeLength, afterLength = 0;

                        do
                        {
                            beforeLength = (long)jsExe.ExecuteScript(CollectorConstants.getResourceLength());
                            Thread.Sleep(CollectorConstants.getResourceSettleTime());
                            afterLength = (long)jsExe.ExecuteScript(CollectorConstants.getResourceLength());
                        } while (beforeLength < afterLength);

                        if (CollectorConstants.getUserAgent().Contains("Trident"))
                        {
                            var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                            resourceDetails = serializer.Deserialize <List <Dictionary <string, object> > >
                                                  (jsExe.ExecuteScript(CollectorConstants.getResourceTimeIE()).ToString());
                        }
                        else
                        {
                            resourceDetails = ((IReadOnlyCollection <Object>)jsExe.ExecuteScript(CollectorConstants.getResourceTime())).ToDictionaries();
                        }
                        jsExe.ExecuteScript(CollectorConstants.clearResourceTiming());
                        log.Debug("Collected Resource Timing API : " + resourceDetails.ToString());
                        collectedData.Add("ResourceTime", resourceDetails);
                    }

                    if (navigationDetails == null && resourceDetails.Count <= 0)
                    {
                        log.Info("The transaction " + txnName + " probably did not make a server request and hence will be ignored.");
                        return(rtnValue);
                    }

                    // Fetch Client-side Menory Details via Memory API

                    if (isMemoryAPIEnabled)
                    {
                        if (CollectorConstants.getUserAgent().Contains("Chrome"))
                        {
                            heapUsage = (Dictionary <String, Object>)jsExe.ExecuteScript(CollectorConstants.getHeapUsage());
                            log.Debug("Heap Usage : " + heapUsage.ToString());
                            if (heapUsage.ContainsKey("totalJSHeapSize"))
                            {
                                memoryDetails.Add("jsHeapSizeLimit", heapUsage["jsHeapSizeLimit"]);
                                memoryDetails.Add("totalJSHeapSize", heapUsage["totalJSHeapSize"]);
                                memoryDetails.Add("usedJSHeapSize", heapUsage["usedJSHeapSize"]);
                                if (getPrevTxnHeapSize() == 0)
                                {
                                    setPrevTxnHeapSize((long)heapUsage["usedJSHeapSize"]);
                                    memoryDetails.Add("currentPageUsage", getPrevTxnHeapSize());
                                }
                                else
                                {
                                    currentHeapUsage = ((long)heapUsage["usedJSHeapSize"] - getPrevTxnHeapSize());
                                    setPrevTxnHeapSize((long)heapUsage["usedJSHeapSize"]);
                                    memoryDetails.Add("currentPageUsage", currentHeapUsage);
                                }
                            }
                            else
                            {
                                memoryDetails.Add("jsHeapSizeLimit", 0);
                                memoryDetails.Add("totalJSHeapSize", 0);
                                memoryDetails.Add("usedJSHeapSize", 0);
                                memoryDetails.Add("currentPageUsage", 0);
                            }
                        }
                        else
                        {
                            memoryDetails.Add("jsHeapSizeLimit", 0);
                            memoryDetails.Add("totalJSHeapSize", 0);
                            memoryDetails.Add("usedJSHeapSize", 0);
                            memoryDetails.Add("currentPageUsage", 0);
                        }
                        log.Debug("Collected Memory Details : " + memoryDetails.ToString());
                        collectedData.Add("Memory", memoryDetails);
                    }

                    //Fetch dom element count
                    long domElements = (long)jsExe.ExecuteScript(CollectorConstants.getDomLength());
                    log.Debug("DOM Element Count :{} " + domElements);
                    collectedData.Add("DomElements", domElements);


                    //Fetch Browser Details
                    browserDetails.Add("UserAgent", CollectorConstants.getUserAgent());
                    collectedData.Add("Browser", browserDetails);


                    // Fetch Client-side details Details via ResourceTiming API
                    if (isMarkAPIEnabled)
                    {
                        Thread.Sleep(CollectorConstants.getMarkWaitTime());
                        if (CollectorConstants.getUserAgent().Contains("Trident"))
                        {
                            var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                            markDetails = serializer.Deserialize <List <Dictionary <string, object> > >
                                              (jsExe.ExecuteScript(CollectorConstants.getMarkTimeIE()).ToString());
                        }
                        else
                        {
                            markDetails = ((IReadOnlyCollection <Object>)jsExe.ExecuteScript(CollectorConstants.getResourceTime())).ToDictionaries();
                        }


                        if (markDetails.Count > 0)
                        {
                            collectedData.Add("MarkTime", markDetails);
                        }
                        jsExe.ExecuteScript(CollectorConstants.clearMarkTiming());
                        log.Info("Collected mark details from Resource Timing API : " + markDetails.ToString());
                    }

                    //Store DOM if required for analysis
                    if (config.clientConfig.ContainsKey("isDOMNeeded") && Convert.ToBoolean(config.clientConfig["isDOMNeeded"].ToString()))
                    {
                        if (navType == true)
                        {
                            document = document.Append((jsExe.ExecuteScript(CollectorConstants.getDom())).ToString());
                        }
                        else
                        {
                            document = null;
                        }
                    }
                    else
                    {
                        document = null;
                    }

                    collectedData.Add("DOMContent", document);
                    log.Debug("DOM Element : {}" + document);


                    log.Debug("Calling data persist for " + txnName + " asynchronously");
                    AsyncpersistData(collectedData);
                    log.Debug("Completed calling data persist for " + txnName + " asynchronously");
                    rtnValue.Add("UploadStatus", "Success");
                    rtnValue.Add("RunID", config.clientConfig["RunID"]);
                    rtnValue.Add("totalTime", totalTime);
                    rtnValue.Add("serverTime", serverTime);
                    rtnValue.Add("txnName", txnName);
                    if (txnStatus == 1)
                    {
                        rtnValue.Add("txnStatus", "Pass");
                    }
                    else
                    {
                        rtnValue.Add("txnStatus", "Fail");
                    }
                }
                else
                {
                    log.Error("Exception in collateData for transaction " + txnName + " in getting configuration");
                }
            }
            catch (Exception e)
            {
                log.Error("Exception in collateData for transaction " + txnName + " at " + e);
            }
            log.Debug("Completed collating data for " + txnName);
            return(rtnValue);
        }
Esempio n. 29
0
        /// <summary>
        ///     Do the initial setup for the application
        /// </summary>
        /// <param name="originalConfig"></param>
        /// <param name="configSource"></param>
        /// <param name="cmdParams"></param>
        /// <param name="configLoader"></param>
        public virtual void Initialize(IConfigSource originalConfig, IConfigSource configSource, string[] cmdParams,
            ConfigurationLoader configLoader)
        {
            m_commandLineParameters = cmdParams;
            m_StartupTime = DateTime.Now;
            m_version = VersionInfo.Version + " (" + Util.GetRuntimeInformation() + ")";
            m_original_config = originalConfig;
            m_config = configSource;
            m_configurationLoader = configLoader;

            // This thread will go on to become the console listening thread
            if (System.Threading.Thread.CurrentThread.Name != "ConsoleThread")
                System.Threading.Thread.CurrentThread.Name = "ConsoleThread";

            //Register the interface
            ApplicationRegistry.RegisterModuleInterface<ISimulationBase>(this);

            Configuration(configSource);

            InitializeModules();

            RegisterConsoleCommands();
        }
Esempio n. 30
0
        public void IncludeTests()
        {
            const string mainIniFile = "OpenSimDefaults.ini";

            m_config = new IniConfigSource();

            // Create ini files in a directory structure
            IniConfigSource ini;
            IConfig         config;

            ini    = new IniConfigSource();
            config = ini.AddConfig("IncludeTest");
            config.Set("Include-absolute", "absolute/*/config/*.ini");
            config.Set("Include-relative", "../" + m_testSubdirectory + "/relative/*/config/*.ini");
            CreateIni(mainIniFile, ini);

            ini = new IniConfigSource();
            ini.AddConfig("Absolute1").Set("name1", "value1");
            CreateIni("absolute/one/config/setting.ini", ini);

            ini = new IniConfigSource();
            ini.AddConfig("Absolute2").Set("name2", 2.3);
            CreateIni("absolute/two/config/setting1.ini", ini);

            ini = new IniConfigSource();
            ini.AddConfig("Absolute2").Set("name3", "value3");
            CreateIni("absolute/two/config/setting2.ini", ini);

            ini = new IniConfigSource();
            ini.AddConfig("Relative1").Set("name4", "value4");
            CreateIni("relative/one/config/setting.ini", ini);

            ini = new IniConfigSource();
            ini.AddConfig("Relative2").Set("name5", true);
            CreateIni("relative/two/config/setting1.ini", ini);

            ini = new IniConfigSource();
            ini.AddConfig("Relative2").Set("name6", 6);
            CreateIni("relative/two/config/setting2.ini", ini);

            // Prepare call to ConfigurationLoader.LoadConfigSettings()
            ConfigurationLoader cl              = new ConfigurationLoader();
            IConfigSource       argvSource      = new IniConfigSource();
            EnvConfigSource     envConfigSource = new EnvConfigSource();

            argvSource.AddConfig("Startup").Set("inifile", mainIniFile);
            ConfigSettings     configSettings;
            NetworkServersInfo networkInfo;

            OpenSimConfigSource source = cl.LoadConfigSettings(argvSource, envConfigSource,
                                                               out configSettings, out networkInfo);

            // Remove default config
            config = source.Source.Configs["Startup"];
            source.Source.Configs.Remove(config);
            config = source.Source.Configs["Network"];
            source.Source.Configs.Remove(config);

            // Finally, we are able to check the result
            Assert.AreEqual(m_config.ToString(), source.Source.ToString(),
                            "Configuration with includes does not contain all settings.");
            // The following would be preferable but fails due to a type mismatch which I am not able to resolve
            //CollectionAssert.AreEquivalent(m_config.Configs, source.Source.Configs,
            //    String.Format("Configuration with includes does not contain all settings.\nAll settings:\n{0}\nSettings read:\n{1}", m_config, source.Source));
        }
Esempio n. 31
0
 public static Configuration GetDefault()
 {
     return(ConfigurationLoader.GetConfiguration <Configuration>("data.json"));
 }
        public void RemoveTagsWin()
        {
            var contents = ConfigurationLoader.RemoveTags(ContentsWin, "base");

            Assert.IsFalse(contents.Contains("base"));
        }
Esempio n. 33
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                OutputHelp();
                return;
            }

            // Parse args
            string configurationFilepath = null;

            for (int i = 0; i < args.Length; i++)
            {
                if (args[i][0] == '-')
                {
                    // arg is a flag
                    switch (args[i])
                    {
                    case "-h":
                        OutputHelp();
                        return;

                    case "-c":
                        configurationFilepath = args[++i];
                        break;

                    default:
                        Console.Out.WriteLine($"Unknown flag {args[i]}");
                        return;
                    }
                }
            }

            if (!File.Exists(configurationFilepath))
            {
                Console.Out.WriteLine("The configuration file does not exits.");
                return;
            }

            // Get the configuration
            Configuration configuration;

            try
            {
                ConfigurationLoader configurationLoader = new ConfigurationLoader();
                using (StreamReader reader = new StreamReader(configurationFilepath))
                {
                    configuration = configurationLoader.Load(reader);
                }
            }
            catch (Exception e)
            {
                Console.Out.WriteLine("Failed to load the configuration.");
                OutputError(e);
                return;
            }

            // Start StellaClient
            StellaClientLib.StellaClient stellaClient;
            try
            {
                Settings settings = new Settings(800000, configuration.DmaChannel);
                settings.Channels[0] = new Channel(configuration.LedCount, configuration.PwmPin, configuration.Brightness, false, StripType.WS2812_STRIP);
                stellaClient         = new StellaClientLib.StellaClient(configuration, new StellaServer(), new WS281x(settings));
                stellaClient.Start();
            }
            catch (Exception e)
            {
                Console.Out.WriteLine("Failed to start StellaClient");
                OutputError(e);
                return;
            }

            // Wait for cancel signal
            var autoResetEvent = new AutoResetEvent(false);

            Console.CancelKeyPress += (sender, eventArgs) =>
            {
                // cancel the cancellation to allow the program to shutdown cleanly
                eventArgs.Cancel = true;
                autoResetEvent.Set();
            };

            // main blocks here waiting for ctrl-C
            autoResetEvent.WaitOne();
            Console.WriteLine("Manual shutdown.");
            stellaClient.Dispose();
        }
Esempio n. 34
0
        /// <summary>
        /// Tries to load a Generic IO Manager based on information from the Configuration Graph
        /// </summary>
        /// <param name="g">Configuration Graph</param>
        /// <param name="objNode">Object Node</param>
        /// <param name="targetType">Target Type</param>
        /// <param name="obj">Output Object</param>
        /// <returns></returns>
        public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
        {
#if !NO_SYNC_HTTP
            IStorageProvider          storageProvider = null;
            IStorageServer            storageServer   = null;
            SparqlConnectorLoadMethod loadMode;
#else
            IAsyncStorageProvider storageProvider = null;
            IAsyncStorageServer   storageServer   = null;
#endif
            obj = null;

            String server, user, pwd, store, catalog, loadModeRaw;

            Object temp;
            INode  storeObj;

            //Create the URI Nodes we're going to use to search for things
            INode propServer          = g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyServer)),
                  propDb              = g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyDatabase)),
                  propStore           = g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyStore)),
                  propAsync           = g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyAsync)),
                  propStorageProvider = g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyStorageProvider));

            switch (targetType.FullName)
            {
            case AllegroGraph:
                //Get the Server, Catalog and Store
                server = ConfigurationLoader.GetConfigurationString(g, objNode, propServer);
                if (server == null)
                {
                    return(false);
                }
                catalog = ConfigurationLoader.GetConfigurationString(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyCatalog)));
                store   = ConfigurationLoader.GetConfigurationString(g, objNode, propStore);
                if (store == null)
                {
                    return(false);
                }

                //Get User Credentials
                ConfigurationLoader.GetUsernameAndPassword(g, objNode, true, out user, out pwd);

                if (user != null && pwd != null)
                {
                    storageProvider = new AllegroGraphConnector(server, catalog, store, user, pwd);
                }
                else
                {
                    storageProvider = new AllegroGraphConnector(server, catalog, store);
                }
                break;

            case AllegroGraphServer:
                //Get the Server, Catalog and User Credentials
                server = ConfigurationLoader.GetConfigurationString(g, objNode, propServer);
                if (server == null)
                {
                    return(false);
                }
                catalog = ConfigurationLoader.GetConfigurationString(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyCatalog)));
                ConfigurationLoader.GetUsernameAndPassword(g, objNode, true, out user, out pwd);

                if (user != null && pwd != null)
                {
                    storageServer = new AllegroGraphServer(server, catalog, user, pwd);
                }
                else
                {
                    storageServer = new AllegroGraphServer(server, catalog);
                }
                break;

#if !PORTABLE
            case DatasetFile:
                //Get the Filename and whether the loading should be done asynchronously
                String file = ConfigurationLoader.GetConfigurationString(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFromFile)));
                if (file == null)
                {
                    return(false);
                }
                file = ConfigurationLoader.ResolvePath(file);
                bool isAsync = ConfigurationLoader.GetConfigurationBoolean(g, objNode, propAsync, false);
                storageProvider = new DatasetFileManager(file, isAsync);
                break;
#endif

            case Dydra:
                throw new DotNetRdfConfigurationException("DydraConnector is no longer supported by dotNetRDF and is considered obsolete");

            case FourStore:
                //Get the Server and whether Updates are enabled
                server = ConfigurationLoader.GetConfigurationString(g, objNode, propServer);
                if (server == null)
                {
                    return(false);
                }
                bool enableUpdates = ConfigurationLoader.GetConfigurationBoolean(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyEnableUpdates)), true);
                storageProvider = new FourStoreConnector(server, enableUpdates);
                break;

            case Fuseki:
                //Get the Server URI
                server = ConfigurationLoader.GetConfigurationString(g, objNode, propServer);
                if (server == null)
                {
                    return(false);
                }
                storageProvider = new FusekiConnector(server);
                break;

            case InMemory:
                //Get the Dataset/Store
                INode datasetObj = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUsingDataset)));
                if (datasetObj != null)
                {
                    temp = ConfigurationLoader.LoadObject(g, datasetObj);
                    if (temp is ISparqlDataset)
                    {
                        storageProvider = new InMemoryManager((ISparqlDataset)temp);
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the In-Memory Manager identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:usingDataset property points to an Object that cannot be loaded as an object which implements the ISparqlDataset interface");
                    }
                }
                else
                {
                    //If no dnr:usingDataset try dnr:usingStore instead
                    storeObj = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUsingStore)));
                    if (storeObj != null)
                    {
                        temp = ConfigurationLoader.LoadObject(g, storeObj);
                        if (temp is IInMemoryQueryableStore)
                        {
                            storageProvider = new InMemoryManager((IInMemoryQueryableStore)temp);
                        }
                        else
                        {
                            throw new DotNetRdfConfigurationException("Unable to load the In-Memory Manager identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:usingStore property points to an Object that cannot be loaded as an object which implements the IInMemoryQueryableStore interface");
                        }
                    }
                    else
                    {
                        //If no dnr:usingStore either then create a new empty store
                        storageProvider = new InMemoryManager();
                    }
                }
                break;

#if !NO_SYNC_HTTP
            case ReadOnly:
                //Get the actual Manager we are wrapping
                storeObj = ConfigurationLoader.GetConfigurationNode(g, objNode, propStorageProvider);
                temp     = ConfigurationLoader.LoadObject(g, storeObj);
                if (temp is IStorageProvider)
                {
                    storageProvider = new ReadOnlyConnector((IStorageProvider)temp);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load the Read-Only Connector identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:genericManager property points to an Object which cannot be loaded as an object which implements the required IStorageProvider interface");
                }
                break;

            case ReadOnlyQueryable:
                //Get the actual Manager we are wrapping
                storeObj = ConfigurationLoader.GetConfigurationNode(g, objNode, propStorageProvider);
                temp     = ConfigurationLoader.LoadObject(g, storeObj);
                if (temp is IQueryableStorage)
                {
                    storageProvider = new QueryableReadOnlyConnector((IQueryableStorage)temp);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load the Queryable Read-Only Connector identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:genericManager property points to an Object which cannot be loaded as an object which implements the required IQueryableStorage interface");
                }
                break;
#endif

            case Sesame:
            case SesameV5:
            case SesameV6:
                //Get the Server and Store ID
                server = ConfigurationLoader.GetConfigurationString(g, objNode, propServer);
                if (server == null)
                {
                    return(false);
                }
                store = ConfigurationLoader.GetConfigurationString(g, objNode, propStore);
                if (store == null)
                {
                    return(false);
                }
                ConfigurationLoader.GetUsernameAndPassword(g, objNode, true, out user, out pwd);
                if (user != null && pwd != null)
                {
#if !NO_SYNC_HTTP
                    storageProvider = (IStorageProvider)Activator.CreateInstance(targetType, new Object[] { server, store, user, pwd });
#else
                    storageProvider = (IAsyncStorageProvider)Activator.CreateInstance(targetType, new Object[] { server, store, user, pwd });
#endif
                }
                else
                {
#if !NO_SYNC_HTTP
                    storageProvider = (IStorageProvider)Activator.CreateInstance(targetType, new Object[] { server, store });
#else
                    storageProvider = (IAsyncStorageProvider)Activator.CreateInstance(targetType, new Object[] { server, store });
#endif
                }
                break;

            case SesameServer:
                //Get the Server and User Credentials
                server = ConfigurationLoader.GetConfigurationString(g, objNode, propServer);
                if (server == null)
                {
                    return(false);
                }
                ConfigurationLoader.GetUsernameAndPassword(g, objNode, true, out user, out pwd);

                if (user != null && pwd != null)
                {
                    storageServer = new SesameServer(server, user, pwd);
                }
                else
                {
                    storageServer = new SesameServer(server);
                }
                break;

#if !NO_SYNC_HTTP
            case Sparql:
                //Get the Endpoint URI or the Endpoint
                server = ConfigurationLoader.GetConfigurationString(g, objNode, new INode[] { g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyQueryEndpointUri)), g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyEndpointUri)) });

                //What's the load mode?
                loadModeRaw = ConfigurationLoader.GetConfigurationString(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyLoadMode)));
                loadMode    = SparqlConnectorLoadMethod.Construct;
                if (loadModeRaw != null)
                {
                    try
                    {
#if SILVERLIGHT
                        loadMode = (SparqlConnectorLoadMethod)Enum.Parse(typeof(SparqlConnectorLoadMethod), loadModeRaw, false);
#else
                        loadMode = (SparqlConnectorLoadMethod)Enum.Parse(typeof(SparqlConnectorLoadMethod), loadModeRaw);
#endif
                    }
                    catch
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the SparqlConnector identified by the Node '" + objNode.ToString() + "' as the value given for the property dnr:loadMode is not valid");
                    }
                }

                if (server == null)
                {
                    INode endpointObj = ConfigurationLoader.GetConfigurationNode(g, objNode, new INode[] { g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyQueryEndpoint)), g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyEndpoint)) });
                    if (endpointObj == null)
                    {
                        return(false);
                    }
                    temp = ConfigurationLoader.LoadObject(g, endpointObj);
                    if (temp is SparqlRemoteEndpoint)
                    {
                        storageProvider = new SparqlConnector((SparqlRemoteEndpoint)temp, loadMode);
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the SparqlConnector identified by the Node '" + objNode.ToString() + "' as the value given for the property dnr:endpoint points to an Object which cannot be loaded as an object which is of the type SparqlRemoteEndpoint");
                    }
                }
                else
                {
                    //Are there any Named/Default Graph URIs
                    IEnumerable <Uri> defGraphs = from def in ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyDefaultGraphUri)))
                                                  where def.NodeType == NodeType.Uri
                                                  select((IUriNode)def).Uri;

                    IEnumerable <Uri> namedGraphs = from named in ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyNamedGraphUri)))
                                                    where named.NodeType == NodeType.Uri
                                                    select((IUriNode)named).Uri;

                    if (defGraphs.Any() || namedGraphs.Any())
                    {
                        storageProvider = new SparqlConnector(new SparqlRemoteEndpoint(UriFactory.Create(server), defGraphs, namedGraphs), loadMode);
                    }
                    else
                    {
                        storageProvider = new SparqlConnector(UriFactory.Create(server), loadMode);
                    }
                }
                break;

            case ReadWriteSparql:
                SparqlRemoteEndpoint       queryEndpoint;
                SparqlRemoteUpdateEndpoint updateEndpoint;

                //Get the Query Endpoint URI or the Endpoint
                server = ConfigurationLoader.GetConfigurationString(g, objNode, new INode[] { g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUpdateEndpointUri)), g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyEndpointUri)) });

                //What's the load mode?
                loadModeRaw = ConfigurationLoader.GetConfigurationString(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyLoadMode)));
                loadMode    = SparqlConnectorLoadMethod.Construct;
                if (loadModeRaw != null)
                {
                    try
                    {
#if SILVERLIGHT
                        loadMode = (SparqlConnectorLoadMethod)Enum.Parse(typeof(SparqlConnectorLoadMethod), loadModeRaw, false);
#else
                        loadMode = (SparqlConnectorLoadMethod)Enum.Parse(typeof(SparqlConnectorLoadMethod), loadModeRaw);
#endif
                    }
                    catch
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the ReadWriteSparqlConnector identified by the Node '" + objNode.ToString() + "' as the value given for the property dnr:loadMode is not valid");
                    }
                }

                if (server == null)
                {
                    INode endpointObj = ConfigurationLoader.GetConfigurationNode(g, objNode, new INode[] { g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyQueryEndpoint)), g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyEndpoint)) });
                    if (endpointObj == null)
                    {
                        return(false);
                    }
                    temp = ConfigurationLoader.LoadObject(g, endpointObj);
                    if (temp is SparqlRemoteEndpoint)
                    {
                        queryEndpoint = (SparqlRemoteEndpoint)temp;
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the ReadWriteSparqlConnector identified by the Node '" + objNode.ToString() + "' as the value given for the property dnr:queryEndpoint/dnr:endpoint points to an Object which cannot be loaded as an object which is of the type SparqlRemoteEndpoint");
                    }
                }
                else
                {
                    //Are there any Named/Default Graph URIs
                    IEnumerable <Uri> defGraphs = from def in ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyDefaultGraphUri)))
                                                  where def.NodeType == NodeType.Uri
                                                  select((IUriNode)def).Uri;

                    IEnumerable <Uri> namedGraphs = from named in ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyNamedGraphUri)))
                                                    where named.NodeType == NodeType.Uri
                                                    select((IUriNode)named).Uri;

                    if (defGraphs.Any() || namedGraphs.Any())
                    {
                        queryEndpoint = new SparqlRemoteEndpoint(UriFactory.Create(server), defGraphs, namedGraphs);
                        ;
                    }
                    else
                    {
                        queryEndpoint = new SparqlRemoteEndpoint(UriFactory.Create(server));
                    }
                }

                //Find the Update Endpoint or Endpoint URI
                server = ConfigurationLoader.GetConfigurationString(g, objNode, new INode[] { g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUpdateEndpointUri)), g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyEndpointUri)) });

                if (server == null)
                {
                    INode endpointObj = ConfigurationLoader.GetConfigurationNode(g, objNode, new INode[] { g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUpdateEndpoint)), g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyEndpoint)) });
                    if (endpointObj == null)
                    {
                        return(false);
                    }
                    temp = ConfigurationLoader.LoadObject(g, endpointObj);
                    if (temp is SparqlRemoteUpdateEndpoint)
                    {
                        updateEndpoint = (SparqlRemoteUpdateEndpoint)temp;
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the ReadWriteSparqlConnector identified by the Node '" + objNode.ToString() + "' as the value given for the property dnr:updateEndpoint/dnr:endpoint points to an Object which cannot be loaded as an object which is of the type SparqlRemoteUpdateEndpoint");
                    }
                }
                else
                {
                    updateEndpoint = new SparqlRemoteUpdateEndpoint(UriFactory.Create(server));
                }

                storageProvider = new ReadWriteSparqlConnector(queryEndpoint, updateEndpoint, loadMode);

                break;
#endif

            case SparqlHttpProtocol:
                //Get the Service URI
                server = ConfigurationLoader.GetConfigurationString(g, objNode, propServer);
                if (server == null)
                {
                    return(false);
                }
                storageProvider = new SparqlHttpProtocolConnector(UriFactory.Create(server));
                break;

            case Stardog:
            case StardogV1:
            case StardogV2:
            case StardogV3:
                //Get the Server and Store
                server = ConfigurationLoader.GetConfigurationString(g, objNode, propServer);
                if (server == null)
                {
                    return(false);
                }
                store = ConfigurationLoader.GetConfigurationString(g, objNode, propStore);
                if (store == null)
                {
                    return(false);
                }

                //Get User Credentials
                ConfigurationLoader.GetUsernameAndPassword(g, objNode, true, out user, out pwd);

                //Get Reasoning Mode
                StardogReasoningMode reasoning = StardogReasoningMode.None;
                String mode = ConfigurationLoader.GetConfigurationString(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyLoadMode)));
                if (mode != null)
                {
                    try
                    {
                        reasoning = (StardogReasoningMode)Enum.Parse(typeof(StardogReasoningMode), mode, true);
                    }
                    catch
                    {
                        reasoning = StardogReasoningMode.None;
                    }
                }

                if (user != null && pwd != null)
                {
                    switch (targetType.FullName)
                    {
                    case StardogV1:
                        storageProvider = new StardogV1Connector(server, store, reasoning, user, pwd);
                        break;

                    case StardogV2:
                        storageProvider = new StardogV2Connector(server, store, reasoning, user, pwd);
                        break;

                    case StardogV3:
                        storageProvider = new StardogV3Connector(server, store, user, pwd);
                        break;

                    case Stardog:
                    default:
                        storageProvider = new StardogConnector(server, store, user, pwd);
                        break;
                    }
                }
                else
                {
                    switch (targetType.FullName)
                    {
                    case StardogV1:
                        storageProvider = new StardogV1Connector(server, store, reasoning);
                        break;

                    case StardogV2:
                        storageProvider = new StardogV2Connector(server, store, reasoning);
                        break;

                    case StardogV3:
                        storageProvider = new StardogV3Connector(server, store);
                        break;

                    case Stardog:
                    default:
                        storageProvider = new StardogConnector(server, store);
                        break;
                    }
                }
                break;

            case StardogServer:
            case StardogServerV1:
            case StardogServerV2:
            case StardogServerV3:
                //Get the Server and User Credentials
                server = ConfigurationLoader.GetConfigurationString(g, objNode, propServer);
                if (server == null)
                {
                    return(false);
                }
                ConfigurationLoader.GetUsernameAndPassword(g, objNode, true, out user, out pwd);

                if (user != null && pwd != null)
                {
                    switch (targetType.FullName)
                    {
                    case StardogServerV1:
                        storageServer = new StardogV1Server(server, user, pwd);
                        break;

                    case StardogServerV2:
                        storageServer = new StardogV2Server(server, user, pwd);
                        break;

                    case StardogServerV3:
                        storageServer = new StardogV3Server(server, user, pwd);
                        break;

                    case StardogServer:
                    default:
                        storageServer = new StardogServer(server, user, pwd);
                        break;
                    }
                }
                else
                {
                    switch (targetType.FullName)
                    {
                    case StardogServerV1:
                        storageServer = new StardogV1Server(server);
                        break;

                    case StardogServerV2:
                        storageServer = new StardogV2Server(server);
                        break;

                    case StardogServerV3:
                        storageServer = new StardogV3Server(server);
                        break;

                    case StardogServer:
                    default:
                        storageServer = new StardogServer(server);
                        break;
                    }
                }
                break;
            }

            //Set the return object if one has been loaded
            if (storageProvider != null)
            {
                obj = storageProvider;
            }
            else if (storageServer != null)
            {
                obj = storageServer;
            }

            //Check whether this is a standard HTTP manager and if so load standard configuration
            if (obj is BaseHttpConnector)
            {
                BaseHttpConnector connector = (BaseHttpConnector)obj;

                int timeout = ConfigurationLoader.GetConfigurationInt32(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyTimeout)), 0);
                if (timeout > 0)
                {
                    connector.Timeout = timeout;
                }
#if !NO_PROXY
                INode proxyNode = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyProxy)));
                if (proxyNode != null)
                {
                    temp = ConfigurationLoader.LoadObject(g, proxyNode);
                    if (temp is WebProxy)
                    {
                        connector.Proxy = (WebProxy)temp;
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load storage provider/server identified by the Node '" + objNode.ToString() + "' as the value given for the dnr:proxy property pointed to an Object which could not be loaded as an object of the required type WebProxy");
                    }
                }
#endif
            }

            return(obj != null);
        }
Esempio n. 35
0
 public void Shutdown()
 {
     m_Loader = null;
 }
Esempio n. 36
0
        public ConfigurationWindow(CheatSheet mod)
        {
            this.mod     = mod;
            this.CanMove = true;
            base.Width   = 280;
            base.Height  = 358;

            Texture2D texture = mod.GetTexture("UI/closeButton");
            UIImage   uIImage = new UIImage(texture);

            uIImage.Anchor       = AnchorPosition.TopRight;
            uIImage.Position     = new Vector2(base.Width - this.spacing, this.spacing);
            uIImage.onLeftClick += new EventHandler(this.bClose_onLeftClick);
            this.AddChild(uIImage);

            //ConfigurationLoader.Initialized();

            string[] labels = new string[] { CSText("ItemBrowser"), CSText("NPCBrowser"), CSText("RecipeBrowser"), CSText("MinionBooster"), CSText("Butcher"), CSText("ClearMenu"),
                                             CSText("ExtraAccessorySlots"), CSText("ModExtensions"), CSText("PaintTools"), CSText("SpawnRate"), CSText("Vacuum"), CSText("Waypoints"), CSText("LightHack"), CSText("GodMode")
                                             /* "Boss Downer", "Event Manager"*/
            };
            Func <bool>[] selecteds = new Func <bool>[] {
                () => ConfigurationLoader.personalConfiguration.ItemBrowser,
                () => ConfigurationLoader.personalConfiguration.NPCBrowser,
                () => ConfigurationLoader.personalConfiguration.RecipeBrowser,
                () => ConfigurationLoader.personalConfiguration.MinionBooster,
                () => ConfigurationLoader.personalConfiguration.Butcher,
                () => ConfigurationLoader.personalConfiguration.ClearMenu,
                () => ConfigurationLoader.personalConfiguration.ExtraAccessorySlots,
                () => ConfigurationLoader.personalConfiguration.ModExtensions,
                () => ConfigurationLoader.personalConfiguration.PaintTools,
                () => ConfigurationLoader.personalConfiguration.SpawnRate,
                () => ConfigurationLoader.personalConfiguration.Vacuum,
                () => ConfigurationLoader.personalConfiguration.Waypoints,
                () => ConfigurationLoader.personalConfiguration.LightHack,
                () => ConfigurationLoader.personalConfiguration.GodMode,
                //  ConfigurationLoader.configuration.BossDowner,
                //  ConfigurationLoader.configuration.EventManager,
            };

            Action <bool>[] assignSelected = new Action <bool>[] {
                (bool a) => ConfigurationLoader.personalConfiguration.ItemBrowser         = a,
                (bool a) => ConfigurationLoader.personalConfiguration.NPCBrowser          = a,
                (bool a) => ConfigurationLoader.personalConfiguration.RecipeBrowser       = a,
                (bool a) => ConfigurationLoader.personalConfiguration.MinionBooster       = a,
                (bool a) => ConfigurationLoader.personalConfiguration.Butcher             = a,
                (bool a) => ConfigurationLoader.personalConfiguration.ClearMenu           = a,
                (bool a) => ConfigurationLoader.personalConfiguration.ExtraAccessorySlots = a,
                (bool a) => ConfigurationLoader.personalConfiguration.ModExtensions       = a,
                (bool a) => ConfigurationLoader.personalConfiguration.PaintTools          = a,
                (bool a) => ConfigurationLoader.personalConfiguration.SpawnRate           = a,
                (bool a) => ConfigurationLoader.personalConfiguration.Vacuum    = a,
                (bool a) => ConfigurationLoader.personalConfiguration.Waypoints = a,
                (bool a) => ConfigurationLoader.personalConfiguration.LightHack = a,
                (bool a) => ConfigurationLoader.personalConfiguration.GodMode   = a,
            };

            for (int i = 0; i < labels.Length; i++)
            {
                int        iClosure = i;
                UICheckbox cb       = new UICheckbox(labels[i]);
                cb.Selected = selecteds[i]();
                cb.X        = spacing;
                cb.Y        = i * 24 + spacing;
                //cb.SelectedChanged += new EventHandler(bCheckBoxTicked);
                cb.SelectedChanged += (a, b) =>
                {
                    assignSelected[iClosure](cb.Selected);
                    cb.Selected = selecteds[iClosure]();
                    ConfigurationLoader.SaveSetting();
                    ((CheatSheet)mod).hotbar.ChangedConfiguration();
                    ConfigurationTool.configurationWindow.selected = true;
                };

                //cb.label.ForegroundColor = Color.Red;
                AddChild(cb);
            }
        }
        /// <summary>
        /// Tries to load a triple/graph collection which is specified in the given configuration graph.
        /// </summary>
        /// <param name="g">Configuration Graph.</param>
        /// <param name="objNode">Object Node.</param>
        /// <param name="targetType">Target type.</param>
        /// <param name="obj">Returned Object.</param>
        /// <returns></returns>
        public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
        {
            obj = null;
            INode  wrapsNode;
            Object wrappedCollection;

            if (_tripleCollectionType.IsAssignableFrom(targetType))
            {
                wrapsNode = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUsingTripleCollection)));
                if (wrapsNode == null)
                {
                    // Simple Triple Collection creation
                    try
                    {
                        obj = (BaseTripleCollection)Activator.CreateInstance(targetType);
                    }
                    catch
                    {
                        return(false);
                    }
                }
                else
                {
                    // Wrapped Triple Collection creation
                    wrappedCollection = ConfigurationLoader.LoadObject(g, wrapsNode) as BaseTripleCollection;
                    if (wrappedCollection == null)
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the Triple Collection identified by the Node '" + objNode.ToString() + "' as the dnr:usingTripleCollection points to an object which cannot be loaded as an instance of the required type BaseTripleCollection for this collection to wrap");
                    }
                    try
                    {
                        obj = (BaseTripleCollection)Activator.CreateInstance(targetType, new Object[] { wrappedCollection });
                    }
                    catch
                    {
                        return(false);
                    }
                }
            }
            else if (_graphCollectionType.IsAssignableFrom(targetType))
            {
                wrapsNode = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUsingGraphCollection)));
                if (wrapsNode == null)
                {
                    // Simple Graph Collection creation
                    try
                    {
                        obj = (BaseGraphCollection)Activator.CreateInstance(targetType);
                    }
                    catch
                    {
                        return(false);
                    }
                }
                else
                {
                    // Wrapped Graph Collection creation
                    wrappedCollection = ConfigurationLoader.LoadObject(g, wrapsNode) as BaseGraphCollection;
                    if (wrappedCollection == null)
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the Graph Collection identified by the Node '" + objNode.ToString() + "' as the dnr:usingGraphCollection points to an object which cannot be loaded as an instance of the required type BaseGraphCollection for this collection to wrap");
                    }
                    try
                    {
                        obj = (BaseGraphCollection)Activator.CreateInstance(targetType, new Object[] { wrappedCollection });
                    }
                    catch
                    {
                        return(false);
                    }
                }
            }
            return(obj != null);
        }
 internal void ApplyEndpointDefaults(ReplicaListenOptions listenOptions)
 {
     listenOptions.KestrelServerOptions = this;
     ConfigurationLoader?.ApplyConfigurationDefaults(listenOptions);
     EndpointDefaults(listenOptions);
 }
        static async Task Main(string[] args)
        {
            AppDomain.CurrentDomain.UnhandledException += Global_UnhandledException;

            #region Config

            var configuration = ConfigurationLoader.GetConfiguration();

            var provider         = configuration["Database:Provider"];
            var connectionName   = configuration["Database:ConnectionString"] ?? "devices";
            var connectionString = configuration.GetConnectionString(connectionName);

            if (!int.TryParse(configuration["SignalsRegistration:Delay"], out int delay))
            {
                delay = 2000;
            }

            if (!Enum.TryParse(configuration["SignalsRegistration:Startup"], out StartupMode startupMode))
            {
                startupMode = StartupMode.database;
            }

            #endregion

            #region Services

            // Data context
            var context = new ANSContext(connectionString, provider);
            context.Database.Migrate();

            // API
            var api = new AdamantApi(configuration);

            #endregion

            #region DI & NLog

            var nLogConfig = configuration["SignalsRegistration:NlogConfig"];
            if (String.IsNullOrEmpty(nLogConfig))
            {
                nLogConfig = "nlog.config";
            }

            else
            {
                nLogConfig = Utilities.HandleUnixHomeDirectory(nLogConfig);
            }

            _logger = NLog.LogManager.LoadConfiguration(nLogConfig).GetCurrentClassLogger();

            var services = new ServiceCollection();

            // Application services

            services.AddSingleton <IConfiguration>(configuration);
            services.AddSingleton <AdamantApi>();
            services.AddSingleton(context);

            services.AddSingleton <SignalsPoller>();

            // Other
            services.AddSingleton <ILoggerFactory, LoggerFactory>();
            services.AddSingleton(typeof(ILogger <>), typeof(Logger <>));
            services.AddLogging(b => b.SetMinimumLevel(LogLevel.Trace));

            var serviceProvider = services.BuildServiceProvider();

            var loggerFactory = serviceProvider.GetRequiredService <ILoggerFactory>();

            loggerFactory.AddNLog(new NLogProviderOptions {
                CaptureMessageTemplates = true, CaptureMessageProperties = true
            });

            #endregion

            var totalDevices = context.Devices.Count();
            _logger.Info("Database initialized. Total devices in db: {0}", totalDevices);
            _logger.Info("Starting polling. Delay: {0}ms.", delay);

            var address = configuration["SignalsRegistration:Address"];
            if (string.IsNullOrEmpty(address))
            {
                throw new Exception("ANS account address is required");
            }

            var privateKey = configuration["SignalsRegistration:PrivateKey"];
            if (string.IsNullOrEmpty(privateKey))
            {
                throw new Exception("ANS account private key is required");
            }

            var worker = serviceProvider.GetRequiredService <SignalsPoller>();
            worker.Delay      = TimeSpan.FromMilliseconds(delay);
            worker.Address    = address;
            worker.PrivateKey = privateKey;
            worker.StartPolling(startupMode);

            if (worker.PollingTask != null)
            {
                await worker.PollingTask;
            }
            else
            {
                throw new Exception("Can't await worker");
            }
        }
Esempio n. 40
0
 public void Delete(object configurationItem)
 {
     File.Delete(String.Format("{0}{1}\\{2}.xml", ConfigurationLoader.GetFileConfigurationPath(), ConfigurationFolder, ((Template)configurationItem).Name));
     Configuration.GetInstance().Templates.Remove(((Template)configurationItem));
 }
Esempio n. 41
0
 public void Startup(ConfigurationLoader loader)
 {
     m_ExternalHostNameService = loader.ExternalHostNameService;
 }
Esempio n. 42
0
        public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
        {
            switch (targetType.FullName)
            {
            case MongoDBManager:
                String server       = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyServer));
                String storeID      = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyDatabase));
                String collectionID = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyCatalog));
                String loadMode     = ConfigurationLoader.GetConfigurationString(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, ConfigurationLoader.PropertyLoadMode));

                MongoDBSchemas schema = MongoDBDocumentManager.DefaultSchema;
                if (loadMode != null)
                {
                    switch (loadMode)
                    {
                    case "GraphCentric":
                        schema = MongoDBSchemas.GraphCentric;
                        break;

                    case "TripleCentric":
                        schema = MongoDBSchemas.TripleCentric;
                        break;
                    }
                }

                if (storeID != null)
                {
                    AlexandriaMongoDBManager manager;
                    if (server == null)
                    {
                        if (collectionID == null)
                        {
                            manager = new AlexandriaMongoDBManager(storeID, schema);
                        }
                        else
                        {
                            manager = new AlexandriaMongoDBManager(new MongoDBDocumentManager(new MongoConfiguration(), storeID, collectionID, schema));
                        }
                    }
                    else
                    {
                        //Have a Custom Connection String
                        if (collectionID == null)
                        {
                            manager = new AlexandriaMongoDBManager(new MongoDBDocumentManager(server, storeID, schema));
                        }
                        else
                        {
                            manager = new AlexandriaMongoDBManager(new MongoDBDocumentManager(server, storeID, collectionID, schema));
                        }
                    }

                    obj = manager;
                    return(true);
                }

                //If we get here then the required dnr:database property was missing
                throw new DotNetRdfConfigurationException("Unable to load the MongoDB Manager identified by the Node '" + objNode.ToString() + "' since there was no value given for the required property dnr:database");
                break;

            case MongoDBDataset:
                INode managerNode = ConfigurationLoader.GetConfigurationNode(g, objNode, ConfigurationLoader.CreateConfigurationNode(g, "dnr:genericManager"));
                if (managerNode == null)
                {
                    throw new DotNetRdfConfigurationException("Unable to load the MongoDB Dataset identified by the Node '" + objNode.ToString() + "' since there we no value for the required property dnr:genericManager");
                }

                Object temp = ConfigurationLoader.LoadObject(g, managerNode);
                if (temp is AlexandriaMongoDBManager)
                {
                    obj = new AlexandriaMongoDBDataset((AlexandriaMongoDBManager)temp);
                    return(true);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load the MongoDB Dataset identified by the Node '" + objNode.ToString() + "' since the value for the dnr:genericManager property pointed to an Object which could not be loaded as an object of type AlexandriaMongoDBManager");
                }

                break;
            }

            obj = null;
            return(false);
        }
        /// <summary>
        /// Tries to load a Triple Store based on information from the Configuration Graph.
        /// </summary>
        /// <param name="g">Configuration Graph.</param>
        /// <param name="objNode">Object Node.</param>
        /// <param name="targetType">Target Type.</param>
        /// <param name="obj">Output Object.</param>
        /// <returns></returns>
        public bool TryLoadObject(IGraph g, INode objNode, Type targetType, out object obj)
        {
            obj = null;

            ITripleStore store = null;
            INode        subObj;
            Object       temp;

            // Get Property Nodes we need
            INode propStorageProvider = g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyStorageProvider)),
                  propAsync           = g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyAsync));

            // Check whether to use a specific Graph Collection
            INode collectionNode = ConfigurationLoader.GetConfigurationNode(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUsingGraphCollection)));

            // Instantiate the Store Class
            switch (targetType.FullName)
            {
            case TripleStore:
                if (collectionNode == null)
                {
                    store = new TripleStore();
                }
                else
                {
                    BaseGraphCollection graphCollection = ConfigurationLoader.LoadObject(g, collectionNode) as BaseGraphCollection;
                    if (graphCollection == null)
                    {
                        throw new DotNetRdfConfigurationException("Unable to load the Triple Store identified by the Node '" + objNode.ToString() + "' as the dnr:usingGraphCollection points to an object which cannot be loaded as an instance of the required type BaseGraphCollection");
                    }
                    store = new TripleStore(graphCollection);
                }
                break;

            case WebDemandTripleStore:
                store = new WebDemandTripleStore();
                break;

            case PersistentTripleStore:
                subObj = ConfigurationLoader.GetConfigurationNode(g, objNode, propStorageProvider);
                if (subObj == null)
                {
                    return(false);
                }

                temp = ConfigurationLoader.LoadObject(g, subObj);
                if (temp is IStorageProvider)
                {
                    store = new PersistentTripleStore((IStorageProvider)temp);
                }
                else
                {
                    throw new DotNetRdfConfigurationException("Unable to load a Persistent Triple Store identified by the Node '" + objNode.ToString() + "' as the value given the for dnr:genericManager property points to an Object which could not be loaded as an object which implements the IStorageProvider interface");
                }
                break;
            }

            // Read in additional data to be added to the Store
            if (store != null)
            {
                IEnumerable <INode> sources = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyUsingGraph)));

                // Read from Graphs
                foreach (INode source in sources)
                {
                    temp = ConfigurationLoader.LoadObject(g, source);
                    if (temp is IGraph)
                    {
                        store.Add((IGraph)temp);
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load data from a Graph for the Triple Store identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:usingGraph property points to an Object that cannot be loaded as an object which implements the IGraph interface");
                    }
                }

                // Load from Embedded Resources
                sources = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFromEmbedded)));
                foreach (INode source in sources)
                {
                    if (source.NodeType == NodeType.Literal)
                    {
                        EmbeddedResourceLoader.Load(store, ((ILiteralNode)source).Value);
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load data from an Embedded Resource for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:fromEmbedded property is not a Literal Node as required");
                    }
                }

                // Read from Files - we assume these files are Dataset Files
                sources = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyFromFile)));
                foreach (INode source in sources)
                {
                    if (source.NodeType == NodeType.Literal)
                    {
                        FileLoader.Load(store, ConfigurationLoader.ResolvePath(((ILiteralNode)source).Value));
                    }
                    else
                    {
                        throw new DotNetRdfConfigurationException("Unable to load data from a file for the Triple Store identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:fromFile property is not a Literal Node as required");
                    }
                }

                // Finally we'll apply any reasoners
                if (store is IInferencingTripleStore)
                {
                    IEnumerable <INode> reasoners = ConfigurationLoader.GetConfigurationData(g, objNode, g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyReasoner)));
                    foreach (INode reasoner in reasoners)
                    {
                        temp = ConfigurationLoader.LoadObject(g, reasoner);
                        if (temp is IInferenceEngine)
                        {
                            ((IInferencingTripleStore)store).AddInferenceEngine((IInferenceEngine)temp);
                        }
                        else
                        {
                            throw new DotNetRdfConfigurationException("Unable to apply a reasoner for the Graph identified by the Node '" + objNode.ToString() + "' as one of the values for the dnr:reasoner property points to an Object which cannot be loaded as an object which implements the IInferenceEngine interface");
                        }
                    }
                }

                // And as an absolute final step if the store is transactional we'll flush any changes we've made
                if (store is ITransactionalStore)
                {
                    ((ITransactionalStore)store).Flush();
                }
            }

            obj = store;
            return(store != null);
        }
Esempio n. 44
0
 public virtual void HandleConfigRefresh(string mod, string[] cmd)
 {
     //Rebuild the configs
     ConfigurationLoader loader = new ConfigurationLoader();
     m_config = loader.LoadConfigSettings(m_original_config);
     foreach (IApplicationPlugin plugin in m_applicationPlugins)
     {
         plugin.ReloadConfiguration(m_config);
     }
     m_log.Info ("Finished reloading configuration.");
 }
        public void Startup(ConfigurationLoader loader)
        {
            IConfig config = loader.Config.Configs[GetType().FullName];

            m_AssetService        = loader.GetService <AssetServiceInterface>(config.GetString("AssetService", "AssetService"));
            m_PhysicsShapeManager = loader.GetService <PhysicsShapeManager>(config.GetString("PhysicsShapeManager", "PhysicsShapeManager"));

            string physicsShapeType = config.GetString("PhysicsShapeType", "prim").ToLowerInvariant();

            switch (physicsShapeType)
            {
            case "none":
                m_PhysicsShapeType = PrimitivePhysicsShapeType.None;
                break;

            case "prim":
                m_PhysicsShapeType = PrimitivePhysicsShapeType.Prim;
                break;

            case "convex":
                m_PhysicsShapeType = PrimitivePhysicsShapeType.Convex;
                break;

            default:
                throw new ConfigurationLoader.ConfigurationErrorException(string.Format("Invalid PhysicsShapeType: {0}", physicsShapeType));
            }

            if (config.Contains("HexData"))
            {
                ObjectPart.PrimitiveShape p = new ObjectPart.PrimitiveShape
                {
                    Serialization = config.GetString("HexData").FromHexStringToByteArray()
                };
                m_Shape = p.DecodedParams;
            }
            else
            {
                string shapeType = config.GetString("ShapeType", "Box").ToLowerInvariant();
                switch (shapeType)
                {
                case "box":
                    m_Shape.ShapeType = PrimitiveShapeType.Box;
                    break;

                case "cylinder":
                    m_Shape.ShapeType = PrimitiveShapeType.Cylinder;
                    break;

                case "prism":
                    m_Shape.ShapeType = PrimitiveShapeType.Prism;
                    break;

                case "sphere":
                    m_Shape.ShapeType = PrimitiveShapeType.Sphere;
                    break;

                case "torus":
                    m_Shape.ShapeType = PrimitiveShapeType.Torus;
                    break;

                case "tube":
                    m_Shape.ShapeType = PrimitiveShapeType.Tube;
                    break;

                case "ring":
                    m_Shape.ShapeType = PrimitiveShapeType.Ring;
                    break;

                case "sculpt":
                    m_Shape.ShapeType = PrimitiveShapeType.Sculpt;
                    break;

                default:
                    throw new ConfigurationLoader.ConfigurationErrorException(string.Format("Invalid ShapeType: {0}", shapeType));
                }

                string sculptType = config.GetString("SculptType", "sphere").ToLowerInvariant();
                switch (sculptType)
                {
                case "sphere":
                    m_Shape.SculptType = PrimitiveSculptType.Sphere;
                    break;

                case "torus":
                    m_Shape.SculptType = PrimitiveSculptType.Torus;
                    break;

                case "plane":
                    m_Shape.SculptType = PrimitiveSculptType.Plane;
                    break;

                case "cylinder":
                    m_Shape.SculptType = PrimitiveSculptType.Cylinder;
                    break;

                case "mesh":
                    m_Shape.SculptType = PrimitiveSculptType.Mesh;
                    break;

                default:
                    throw new ConfigurationLoader.ConfigurationErrorException(string.Format("Invalid SculptType: {0}", sculptType));
                }

                if (config.Contains("SculptMapID"))
                {
                    m_Shape.SculptMap = new UUID(config.GetString("SculptMapID"));
                }

                if (config.Contains("SculptMapFile"))
                {
                    if (!config.Contains("SculptMapID"))
                    {
                        throw new ConfigurationLoader.ConfigurationErrorException("SculptMap parameter not present");
                    }
                    byte[] data;
                    using (var fs = new FileStream(config.GetString("SculptMapFile"), FileMode.Open))
                    {
                        var fileLength = (int)fs.Length;
                        data = new byte[fileLength];
                        if (fileLength != fs.Read(data, 0, fileLength))
                        {
                            throw new ConfigurationLoader.ConfigurationErrorException("Failed to load file");
                        }
                    }
                    var assetdata = new AssetData
                    {
                        Data = data,
                        Type = m_Shape.SculptType == PrimitiveSculptType.Mesh ? AssetType.Mesh : AssetType.Texture,
                        ID   = m_Shape.SculptMap,
                        Name = "PrimToMesh imported"
                    };
                    m_AssetService.Store(assetdata);
                }

                if (config.GetBoolean("IsSculptInverted", false))
                {
                    m_Shape.IsSculptInverted = true;
                }
                if (config.GetBoolean("IsSculptMirrored", false))
                {
                    m_Shape.IsSculptMirrored = true;
                }

                string profileShape = config.GetString("ProfileShape", "Circle").ToLowerInvariant();
                switch (profileShape)
                {
                case "circle":
                    m_Shape.ProfileShape = PrimitiveProfileShape.Circle;
                    break;

                case "square":
                    m_Shape.ProfileShape = PrimitiveProfileShape.Square;
                    break;

                case "isometrictriangle":
                    m_Shape.ProfileShape = PrimitiveProfileShape.IsometricTriangle;
                    break;

                case "equilateraltriangle":
                    m_Shape.ProfileShape = PrimitiveProfileShape.EquilateralTriangle;
                    break;

                case "righttriangle":
                    m_Shape.ProfileShape = PrimitiveProfileShape.RightTriangle;
                    break;

                case "halfcircle":
                    m_Shape.ProfileShape = PrimitiveProfileShape.HalfCircle;
                    break;

                default:
                    throw new ConfigurationLoader.ConfigurationErrorException(string.Format("Invalid ProfileShape: {0}", profileShape));
                }

                string holeShape = config.GetString("HollowShape", "Same").ToLowerInvariant();
                switch (holeShape)
                {
                case "same":
                    m_Shape.HoleShape = PrimitiveProfileHollowShape.Same;
                    break;

                case "circle":
                    m_Shape.HoleShape = PrimitiveProfileHollowShape.Circle;
                    break;

                case "square":
                    m_Shape.HoleShape = PrimitiveProfileHollowShape.Square;
                    break;

                case "triangle":
                    m_Shape.HoleShape = PrimitiveProfileHollowShape.Triangle;
                    break;

                default:
                    throw new ConfigurationLoader.ConfigurationErrorException(string.Format("Invalid HollowShape: {0}", holeShape));
                }

                m_Shape.ProfileBegin  = double.Parse(config.GetString("ProfileBegin", "0"), CultureInfo.InvariantCulture);
                m_Shape.ProfileEnd    = double.Parse(config.GetString("ProfileEnd", "1"), CultureInfo.InvariantCulture);
                m_Shape.ProfileHollow = double.Parse(config.GetString("ProfileHollow", "0"), CultureInfo.InvariantCulture);
                m_Shape.IsHollow      = m_Shape.ProfileHollow > 0;
                m_Shape.PathBegin     = double.Parse(config.GetString("PathBegin", "0"), CultureInfo.InvariantCulture);
                m_Shape.PathEnd       = double.Parse(config.GetString("PathEnd", "1"), CultureInfo.InvariantCulture);
                m_Shape.IsOpen        = m_Shape.ProfileBegin > 0 || m_Shape.ProfileEnd < 1f;
                m_Shape.PathScale.X   = double.Parse(config.GetString("PathScaleX", "0"), CultureInfo.InvariantCulture);
                m_Shape.PathScale.Y   = double.Parse(config.GetString("PathScaleY", "0"), CultureInfo.InvariantCulture);
                m_Shape.TopShear.X    = double.Parse(config.GetString("TopShearX", "0"), CultureInfo.InvariantCulture);
                m_Shape.TopShear.Y    = double.Parse(config.GetString("TopShearY", "0"), CultureInfo.InvariantCulture);
                m_Shape.TwistBegin    = double.Parse(config.GetString("TwistBegin", "0"), CultureInfo.InvariantCulture);
                m_Shape.TwistEnd      = double.Parse(config.GetString("TwistEnd", "0"), CultureInfo.InvariantCulture);
                m_Shape.RadiusOffset  = double.Parse(config.GetString("RadiusOffset", "0"), CultureInfo.InvariantCulture);
                m_Shape.Taper.X       = double.Parse(config.GetString("TaperX", "0"), CultureInfo.InvariantCulture);
                m_Shape.Taper.Y       = double.Parse(config.GetString("TaperY", "0"), CultureInfo.InvariantCulture);
                m_Shape.Revolutions   = double.Parse(config.GetString("Revolutions", "1"), CultureInfo.InvariantCulture);
                m_Shape.Skew          = double.Parse(config.GetString("Skew", "0"), CultureInfo.InvariantCulture);
            }

            m_OutputFileName = config.GetString("OutputFilename");
        }
        private SettingsControlViewModel GetDefaultViewModel(ConfigurationLoader configService, SettingsViews activeView = SettingsViews.GeneralSettings)
        {
            var config = configService.LoadConfiguration();

            return new SettingsControlViewModel(configService,
                config,
                new SettingsView
                {
                    Control = new GeneralSettings(new GeneralSettingsViewModel(config)),
                    View = SettingsViews.GeneralSettings
                },
                new SettingsView
                {
                    Control = new TodoSettings(new TodoSettingsViewModel(config)),
                    View = SettingsViews.TodoSettings
                },
                new SettingsView
                {
                    Control = new InspectionSettings(new InspectionSettingsViewModel(config)),
                    View = SettingsViews.InspectionSettings
                },
                new SettingsView
                {
                    Control = new UnitTestSettings(new UnitTestSettingsViewModel(config)),
                    View = SettingsViews.UnitTestSettings
                },
                new SettingsView
                {
                    Control = new IndenterSettings(new IndenterSettingsViewModel(config)),
                    View = SettingsViews.IndenterSettings
                },
                activeView);
        }
 public void TestWhenNoSectionGivenWillFindAnyInConfig()
 {
     var config = new ConfigurationLoader<DevSettings>();
     Assert.IsNotNull(config);
 }
Esempio n. 48
0
 public virtual void HandleConfigRefresh(string mod, string[] cmd)
 {
     //Rebuild the configs
     ConfigurationLoader loader = new ConfigurationLoader();
     m_config = loader.LoadConfigSettings(m_original_config);
     //Update all modules
     IRegionModulesController controller = m_applicationRegistry.Get<IRegionModulesController>();
     foreach (IRegionModuleBase module in controller.AllModules)
     {
         module.Initialise(m_config);
     }
     MainConsole.Instance.Output("Finished reloading configuration.");
 }
        private ConfigurationLoader GetConfigLoader(Configuration config)
        {
            var configLoader = new ConfigurationLoader(Inspections(), null);
            configLoader.SaveConfiguration(config);

            return configLoader;
        }
Esempio n. 50
0
 private ConfigurationContainer CreateConfiguration(string configFile)
 {
     ConfigurationLoader loader = new ConfigurationLoader(configFile);	// todo: configuration loader should load file && report error if it is missing!
     watcher = new FileChangedWatcher(configFile);
     return new ConfigurationContainer(loader, watcher);
 }
Esempio n. 51
0
 private void LoadConfiguration()
 {
     _config = ConfigurationLoader.LoadConfiguration();
 }
Esempio n. 52
0
 private static IConfigSource Configuration(IConfigSource configSource)
 {
     ConfigurationLoader m_configLoader = new ConfigurationLoader();
     return m_configLoader.LoadConfigSettings(configSource);
 }
        public void StorageVirtuosoConfigSerialization()
        {
            NTriplesFormatter formatter = new NTriplesFormatter();
            VirtuosoManager   manager   = VirtuosoTest.GetConnection();

            try
            {
                Assert.NotNull(manager);

                Graph g              = new Graph();
                INode rdfType        = g.CreateUriNode(new Uri(RdfSpecsHelper.RdfType));
                INode dnrType        = g.CreateUriNode(UriFactory.Create(ConfigurationLoader.PropertyType));
                INode objFactory     = g.CreateUriNode(UriFactory.Create(ConfigurationLoader.ClassObjectFactory));
                INode virtFactory    = g.CreateLiteralNode("VDS.RDF.Configuration.VirtuosoObjectFactory, dotNetRDF.Data.Virtuoso");
                INode genericManager = g.CreateUriNode(UriFactory.Create(ConfigurationLoader.ClassStorageProvider));
                INode virtManager    = g.CreateLiteralNode("VDS.RDF.Storage.VirtuosoManager, dotNetRDF.Data.Virtuoso");

                //Serialize Configuration
                ConfigurationSerializationContext context = new ConfigurationSerializationContext(g);
                manager.SerializeConfiguration(context);

                Console.WriteLine("Serialized Configuration");
                foreach (Triple t in g.Triples)
                {
                    Console.WriteLine(t.ToString(formatter));
                }
                Console.WriteLine();

                //Ensure that it was serialized
                INode factory = g.GetTriplesWithPredicateObject(rdfType, objFactory).Select(t => t.Subject).FirstOrDefault();
                Assert.NotNull(factory);
                Assert.True(g.ContainsTriple(new Triple(factory, dnrType, virtFactory)), "Should contain a Triple declaring the dnr:type to be the Virtuoso Object factory type");
                INode objNode = g.GetTriplesWithPredicateObject(rdfType, genericManager).Select(t => t.Subject).FirstOrDefault();
                Assert.NotNull(objNode);
                Assert.True(g.ContainsTriple(new Triple(objNode, dnrType, virtManager)), "Should contain a Triple declaring the dnr:type to be the Virtuoso Manager type");

                //Serialize again
                manager.SerializeConfiguration(context);

                Console.WriteLine("Serialized Configuration (after 2nd pass)");
                foreach (Triple t in g.Triples)
                {
                    Console.WriteLine(t.ToString(formatter));
                }
                Console.WriteLine();

                //Ensure that object factory has not been serialized again
                Assert.Single(g.GetTriplesWithPredicateObject(rdfType, objFactory));

                //Now try to load the object
                ConfigurationLoader.AutoConfigureObjectFactories(g);
                Object loadedObj = ConfigurationLoader.LoadObject(g, objNode);
                if (loadedObj is VirtuosoManager)
                {
                    Assert.Equal(manager.ToString(), loadedObj.ToString());
                }
                else
                {
                    Assert.True(false, "Returned an object of type '" + loadedObj.GetType().FullName + "' when deserializing");
                }
            }
            finally
            {
                if (manager != null)
                {
                    manager.Dispose();
                }
            }
        }
Esempio n. 54
0
        public void FullGenerationErrorTemplate()
        {
            // Perform generation
            IndexConfiguration indexConfiguration = new ConfigurationLoader(this.FileSystem).Load(".", this.FileSystem.Path.Combine("Config", "ErrorInHtml.json"));
            Configuration[] configurations = indexConfiguration.Configurations;
            GenerationError[] errors = new ProjbookEngine(this.FileSystem, "Project.csproj", this.ExtensionDirectory.FullName, indexConfiguration, ".", false).GenerateAll();

            // Assert result
            Assert.IsNotNull(errors);
            Assert.AreEqual(2, errors.Length);
            Assert.IsTrue(errors[0].SourceFile.EndsWith("Template/Malformated.txt".Replace('/', this.FileSystem.Path.DirectorySeparatorChar)));
            Assert.IsTrue(errors[1].SourceFile.EndsWith("Template/Malformated.txt".Replace('/', this.FileSystem.Path.DirectorySeparatorChar)));
            Assert.AreEqual(@"Error during HTML generation: (16:1) - Encountered end tag ""Sections"" with no matching start tag.  Are your start/end tags properly balanced?", errors[0].Message);
            Assert.AreEqual(16, errors[0].Line);
            Assert.AreEqual(1, errors[0].Column);
            Assert.AreEqual(@"Error during PDF generation: (16:1) - Encountered end tag ""Sections"" with no matching start tag.  Are your start/end tags properly balanced?", errors[1].Message);
            Assert.AreEqual(16, errors[1].Line);
            Assert.AreEqual(1, errors[1].Column);
        }
Esempio n. 55
0
 private void CreateConfig(IConfigSource baseConfig)
 {
     ConfigurationLoader m_configLoader = new ConfigurationLoader();
     m_config = m_configLoader.LoadConfigSettings(baseConfig);
 }
Esempio n. 56
0
        public void FullGenerationUnexistingMembers()
        {
            // Perform generation
            IndexConfiguration indexConfiguration = new ConfigurationLoader(this.FileSystem).Load(".", this.FileSystem.Path.Combine("Config", "MissingMembersInPage.json"));
            Configuration[] configurations = indexConfiguration.Configurations;
            GenerationError[] errors = new ProjbookEngine(this.FileSystem, this.FileSystem.Path.Combine(".", "Project.csproj"), this.ExtensionDirectory.FullName, indexConfiguration, ".", false).GenerateAll();

            // Assert result
            Assert.IsNotNull(errors);
            Assert.AreEqual(3, errors.Length);
            Assert.AreEqual("Cannot find member: NotFound", errors[0].Message);
            Assert.AreEqual(1, errors[0].Line);
            Assert.AreEqual(27, errors[0].Column);
            Assert.AreEqual("Cannot find member: NotFound", errors[1].Message);
            Assert.AreEqual(7, errors[1].Line);
            Assert.AreEqual(27, errors[1].Column);
            Assert.IsTrue(errors[2].Message.StartsWith("Cannot find target 'Source/NotFound.cs' in any referenced project"));
            Assert.AreEqual(13, errors[2].Line);
            Assert.AreEqual(12, errors[2].Column);
        }
Esempio n. 57
0
        /// <summary>
        /// Trigger task execution.
        /// </summary>
        /// <returns>True if the task succeeded.</returns>
        public override bool Execute()
        {
            // Load configuration
            FileSystem fileSystem = new FileSystem();
            ConfigurationLoader configurationLoader = new ConfigurationLoader(fileSystem);
            IndexConfiguration indexConfiguration;
            try
            {
                indexConfiguration = configurationLoader.Load(fileSystem.Path.GetDirectoryName(this.ProjectPath), this.ConfigurationFile);
            }
            catch (ConfigurationException configurationException)
            {
                // Report generation errors
                this.ReportErrors(configurationException.GenerationErrors);
                return false;
            }
            catch (Exception exception)
            {
                this.Log.LogError(string.Empty, string.Empty, string.Empty, this.ConfigurationFile, 0, 0, 0, 0, string.Format("Error during loading configuration: {0}", exception.Message));
                return false;
            }

            // Parse compilation symbols
            string[] compilationSymbols = new string[0];
            if (!string.IsNullOrWhiteSpace(this.CompilationSymbols))
            {
                compilationSymbols = this.CompilationSymbols
                    .Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)
                    .Select(x => x.Trim()).ToArray();
            }

            // Instantiate a ProjBook engine
            ProjbookEngine projbookEngine = new ProjbookEngine(fileSystem, this.ProjectPath, this.ExtensionPath, indexConfiguration, this.OutputDirectory, compilationSymbols.Contains(NOPDF_SYMBOL));

            // Run generation
            bool success = true;
            GenerationError[] errors = projbookEngine.GenerateAll();

            // Report generation errors
            this.ReportErrors(errors);

            // Stop processing in case of error
            if (errors.Length > 0)
                success = false;

            return success;
        }
Esempio n. 58
0
        public void FullGeneration(string configFileName, string expectedHtmlFileName, string expectedHtmlIndexFileName, string expectedPdfFileName, string generatedHtmlFileName, string generatedHtmlIndexFileName, string generatedPdfFileName, bool readOnly)
        {
            // Process path separator
            configFileName = configFileName.Replace('/', this.FileSystem.Path.DirectorySeparatorChar);
            expectedHtmlFileName = expectedHtmlFileName.Replace('/', this.FileSystem.Path.DirectorySeparatorChar);
            expectedPdfFileName = expectedPdfFileName.Replace('/', this.FileSystem.Path.DirectorySeparatorChar);
            expectedHtmlIndexFileName = expectedHtmlIndexFileName.Replace('/', this.FileSystem.Path.DirectorySeparatorChar);

            // Prepare configuration
            IndexConfiguration indexConfiguration = new ConfigurationLoader(this.FileSystem).Load(".", configFileName);
            Configuration[] configurations = indexConfiguration.Configurations;
            Configuration configuration = configurations[0];
            string htmlTemplatePath = configuration.TemplateHtml;
            string pdfTemplatePath = configuration.TemplatePdf;
            string firstPagePath = new FileInfo(configuration.Pages.First().Path).FullName;

            // Retrieve attribute of html template
            FileAttributes? htmlTemplateFileAttributes = null;
            if (this.FileSystem.File.Exists(htmlTemplatePath))
            {
                htmlTemplateFileAttributes = this.FileSystem.File.GetAttributes(htmlTemplatePath);
            }

            // Retrieve attribute of pdf template
            FileAttributes? pdfTemplateFileAttributes = null;
            if (this.FileSystem.File.Exists(pdfTemplatePath))
            {
                pdfTemplateFileAttributes = this.FileSystem.File.GetAttributes(pdfTemplatePath);
            }

            // Retrieve attribute of the first markdown page
            FileAttributes? firstPageFileAttributes = null;
            if (this.FileSystem.File.Exists(firstPagePath))
            {
                firstPageFileAttributes = this.FileSystem.File.GetAttributes(firstPagePath);
            }

            // Make the file read only
            if (readOnly)
            {
                if (null != htmlTemplateFileAttributes)
                {
                    this.FileSystem.File.SetAttributes(htmlTemplatePath, htmlTemplateFileAttributes.Value | FileAttributes.ReadOnly);
                }
                if (null != pdfTemplateFileAttributes)
                {
                    this.FileSystem.File.SetAttributes(pdfTemplatePath, pdfTemplateFileAttributes.Value | FileAttributes.ReadOnly);
                }
                if (null != firstPageFileAttributes)
                {
                    this.FileSystem.File.SetAttributes(firstPagePath, firstPageFileAttributes.Value | FileAttributes.ReadOnly);
                }
            }

            // Execute test
            try
            {
                // Ensure right working directory
                Environment.CurrentDirectory = Path.GetDirectoryName(typeof(FullGenerationTests).Assembly.Location);

                // Execute generation
                GenerationError[] errors = new ProjbookEngine(this.FileSystem, this.FileSystem.Path.Combine(".", "Project.csproj"), this.ExtensionDirectory.FullName, indexConfiguration, ".", false).GenerateAll();

                // Read expected output
                string expectedContent = string.IsNullOrWhiteSpace(expectedHtmlFileName) ? string.Empty : this.FileSystem.File.ReadAllText(expectedHtmlFileName);

                // Read expected output for index
                string expectedIndexContent = string.IsNullOrWhiteSpace(expectedHtmlIndexFileName) ? string.Empty : this.FileSystem.File.ReadAllText(expectedHtmlIndexFileName);

                // Read expected output
                string expectedPdfContent = string.IsNullOrWhiteSpace(expectedPdfFileName) ? string.Empty : this.FileSystem.File.ReadAllText(expectedPdfFileName);

                // Read generated output
                string generatedContent = !this.FileSystem.File.Exists(generatedHtmlFileName) ? string.Empty : this.FileSystem.File.ReadAllText(generatedHtmlFileName);

                // Read generated output for index
                string generatedIndexContent = !this.FileSystem.File.Exists(generatedHtmlIndexFileName) ? string.Empty : this.FileSystem.File.ReadAllText(generatedHtmlIndexFileName);

                // Read generated pdf ouput
                string generatedPdfContent = !this.FileSystem.File.Exists(generatedPdfFileName) ? string.Empty : this.FileSystem.File.ReadAllText(generatedPdfFileName);

                // Remove line return for cross platform platform testing
                expectedContent = expectedContent.Replace("\r", string.Empty).Replace("\n", string.Empty);
                expectedIndexContent = expectedIndexContent.Replace("\r", string.Empty).Replace("\n", string.Empty);
                expectedPdfContent = expectedPdfContent.Replace("\r", string.Empty).Replace("\n", string.Empty);
                generatedContent = generatedContent.Replace("\r", string.Empty).Replace("\n", string.Empty);
                generatedIndexContent = generatedIndexContent.Replace("\r", string.Empty).Replace("\n", string.Empty);
                generatedPdfContent = generatedPdfContent.Replace("\r", string.Empty).Replace("\n", string.Empty);

                // Assert result
                Assert.IsNotNull(errors);
                Assert.AreEqual(0, errors.Length);
                Assert.AreEqual(expectedContent, generatedContent);
                Assert.AreEqual(expectedIndexContent, generatedIndexContent);
                Assert.AreEqual(expectedPdfContent, generatedPdfContent);

            #if !NOPDF
                Assert.AreEqual(configuration.GeneratePdf, this.FileSystem.File.Exists(this.FileSystem.Path.ChangeExtension(configuration.OutputPdf, "pdf")));
            #endif
            }
            finally
            {
                if (readOnly)
                {
                    if (null != htmlTemplateFileAttributes)
                    {
                        this.FileSystem.File.SetAttributes(htmlTemplatePath, htmlTemplateFileAttributes.Value);
                    }
                    if (null != pdfTemplateFileAttributes)
                    {
                        this.FileSystem.File.SetAttributes(pdfTemplatePath, pdfTemplateFileAttributes.Value);
                    }
                    if (null != firstPageFileAttributes)
                    {
                        this.FileSystem.File.SetAttributes(firstPagePath, firstPageFileAttributes.Value);
                    }
                }
            }
        }
Esempio n. 59
0
 protected virtual void LoadConfigSettings(IConfigSource configSource)
 {
     m_configLoader = new ConfigurationLoader();
     ConfigSource = m_configLoader.LoadConfigSettings(configSource, envConfigSource, out m_configSettings, out m_networkServersInfo);
     Config = ConfigSource.Source;
     ReadExtraConfigSettings();
 }
 public void TestIncorrectGlobalSectionNameErrors()
 {
     var config = new ConfigurationLoader<DevSettings>("myglobalsettingsThatIsntThere");
 }