当前位置: 首页>>代码示例>>C#>>正文


C# Config.IniConfigSource类代码示例

本文整理汇总了C#中Nini.Config.IniConfigSource的典型用法代码示例。如果您正苦于以下问题:C# IniConfigSource类的具体用法?C# IniConfigSource怎么用?C# IniConfigSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IniConfigSource类属于Nini.Config命名空间,在下文中一共展示了IniConfigSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestDeRezSceneObject

        public void TestDeRezSceneObject()
        {
            TestHelper.InMethod();
//            log4net.Config.XmlConfigurator.Configure();
                        
            UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");
            
            TestScene scene = SceneSetupHelpers.SetupScene();
            IConfigSource configSource = new IniConfigSource();
            IConfig config = configSource.AddConfig("Startup");
            config.Set("serverside_object_permissions", true);
            SceneSetupHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
            TestClient client = SceneSetupHelpers.AddRootAgent(scene, userId);
            
            // Turn off the timer on the async sog deleter - we'll crank it by hand for this test.
            AsyncSceneObjectGroupDeleter sogd = scene.SceneObjectGroupDeleter;
            sogd.Enabled = false;            
            
            SceneObjectPart part
                = new SceneObjectPart(userId, PrimitiveBaseShape.Default, Vector3.Zero, Quaternion.Identity, Vector3.Zero);
            part.Name = "obj1";
            scene.AddNewSceneObject(new SceneObjectGroup(part), false);
            List<uint> localIds = new List<uint>();
            localIds.Add(part.LocalId);

            scene.DeRezObjects(client, localIds, UUID.Zero, DeRezAction.Delete, UUID.Zero);
            sogd.InventoryDeQueueAndDelete();
            
            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
            Assert.That(retrievedPart, Is.Null);
        }
开发者ID:phantasmagoric,项目名称:InfiniteGrid-Opensim,代码行数:31,代码来源:SceneObjectDeRezTests.cs

示例2: UpdateMooegeIni

 internal static void UpdateMooegeIni(Repository repository)
 {
     var repoIniPath = new IniConfigSource(Paths.GetMooegeIniPath(repository));
     //For each selection we set the correct MPQ storage path & PacketLog|ServerLog settings on the config INI, this is the best way I could think to have the paths updated at everytime
     //We CANNOT call variable Compile.mooegeINI because that variable only saves latest compiled ini path for INSTANT writting after compiling a repository.
     //WE do not need to write different IPS / PORTS for this since its LOCAL function, We do that over RepositorySelectionSERVER.
     #region SetSettings
     repoIniPath.Configs["Storage"].Set("MPQRoot", MadCow.MpqServer);
     repoIniPath.Configs["ServerLog"].Set("Enabled", Mooege.FileLogging);
     repoIniPath.Configs["PacketLog"].Set("Enabled", Mooege.PacketLogging);
     repoIniPath.Configs["Storage"].Set("EnableTasks", Mooege.Tasks);
     repoIniPath.Configs["Storage"].Set("LazyLoading", Mooege.LazyLoading);
     repoIniPath.Configs["Authentication"].Set("DisablePasswordChecks", Mooege.PasswordCheck);
     //We set the server variables:
     //MooNet-Server IP
     repoIniPath.Configs["MooNet-Server"].Set("BindIP", MadCow.CurrentProfile.MooNetServerIp);
     //Game-Server IP
     repoIniPath.Configs["Game-Server"].Set("BindIP", MadCow.CurrentProfile.GameServerIp);
     //Public IP
     repoIniPath.Configs["NAT"].Set("PublicIP", MadCow.CurrentProfile.NatIp);
     //MooNet-Server Port
     repoIniPath.Configs["MooNet-Server"].Set("Port", MadCow.CurrentProfile.MooNetServerPort);
     //Game-Server Port
     repoIniPath.Configs["Game-Server"].Set("Port", MadCow.CurrentProfile.GameServerPort);
     //MOTD
     repoIniPath.Configs["MooNet-Server"].Set("MOTD", MadCow.CurrentProfile.MooNetServerMotd);
     //NAT
     repoIniPath.Configs["NAT"].Set("Enabled", MadCow.CurrentProfile.NatEnabled);
     repoIniPath.Save();
     #endregion
     Console.WriteLine("Current Profile: " + MadCow.CurrentProfile);
     Console.WriteLine("Set Mooege config.ini according to your profile " + MadCow.CurrentProfile);
     Console.WriteLine(repository + " is ready to go.");
 }
开发者ID:OverlordCW,项目名称:MadCow,代码行数:34,代码来源:Configuration.cs

示例3: SetUp

        public override void SetUp()
        {
            base.SetUp();

            uint port = 9999;
            uint sslPort = 9998;

            // This is an unfortunate bit of clean up we have to do because MainServer manages things through static
            // variables and the VM is not restarted between tests.
            MainServer.RemoveHttpServer(port);

            BaseHttpServer server = new BaseHttpServer(port, false, sslPort, "");
            MainServer.AddHttpServer(server);
            MainServer.Instance = server;

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Startup");
            config.Configs["Startup"].Set("EventQueue", "true");

            CapabilitiesModule capsModule = new CapabilitiesModule();
            EventQueueGetModule eqgModule = new EventQueueGetModule();

            m_scene = new SceneHelpers().SetupScene();
            SceneHelpers.SetupSceneModules(m_scene, config, capsModule, eqgModule);
        }
开发者ID:JeffCost,项目名称:opensim,代码行数:25,代码来源:EventQueueTests.cs

示例4: TestCachedUserNameForNewAgent

        public void TestCachedUserNameForNewAgent()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            HGUserManagementModule hgumm = new HGUserManagementModule();
            UUID userId = TestHelpers.ParseStem("11");
            string firstName = "Fred";
            string lastName = "Astaire";
            string homeUri = "example.com";

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            config.Configs["Modules"].Set("UserManagementModule", hgumm.Name);

            SceneHelpers sceneHelpers = new SceneHelpers();
            TestScene scene = sceneHelpers.SetupScene();
            SceneHelpers.SetupSceneModules(scene, config, hgumm);

            AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
            acd.firstname = firstName;
            acd.lastname = lastName;
            acd.ServiceURLs["HomeURI"] = "http://" + homeUri;

            SceneHelpers.AddScenePresence(scene, acd);

            string name = hgumm.GetUserName(userId);
            Assert.That(name, Is.EqualTo(string.Format("{0}.{1} @{2}", firstName, lastName, homeUri)));
        }
开发者ID:ffoliveira,项目名称:opensimulator,代码行数:29,代码来源:HGUserManagementModuleTests.cs

示例5: TestCrossOnSameSimulator

        public void TestCrossOnSameSimulator()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

            UUID userId = TestHelpers.ParseTail(0x1);
            int sceneObjectIdTail = 0x2;

            EntityTransferModule etmA = new EntityTransferModule();
            EntityTransferModule etmB = new EntityTransferModule();
            LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();

            IConfigSource config = new IniConfigSource();
            IConfig modulesConfig = config.AddConfig("Modules");
            modulesConfig.Set("EntityTransferModule", etmA.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);

            SceneHelpers sh = new SceneHelpers();
            TestScene sceneA = sh.SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
            TestScene sceneB = sh.SetupScene("sceneB", TestHelpers.ParseTail(0x200), 1000, 999);

            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(sceneA, config, etmA);
            SceneHelpers.SetupSceneModules(sceneB, config, etmB);

            SceneObjectGroup so1 = SceneHelpers.AddSceneObject(sceneA, 1, userId, "", sceneObjectIdTail);
            UUID so1Id = so1.UUID;
            so1.AbsolutePosition = new Vector3(128, 10, 20);

            // Cross with a negative value
            so1.AbsolutePosition = new Vector3(128, -10, 20);

            Assert.IsNull(sceneA.GetSceneObjectGroup(so1Id));
            Assert.NotNull(sceneB.GetSceneObjectGroup(so1Id));
        }
开发者ID:ffoliveira,项目名称:opensimulator,代码行数:35,代码来源:SceneObjectCrossingTests.cs

示例6: ConfigCollectionEvents

        public void ConfigCollectionEvents()
        {
            IniConfigSource source = new IniConfigSource ();
            source.Configs.ConfigAdded +=
                            new ConfigEventHandler (this.source_configAdded);
            source.Configs.ConfigRemoved +=
                            new ConfigEventHandler (this.source_configRemoved);

            Assert.AreEqual (configAddedCount, 0);

            eventCollection = null;
            IConfig config = source.AddConfig ("Test");
            Assert.IsTrue (source.Configs == eventCollection);
            Assert.AreEqual (configAddedCount, 1);
            Assert.AreEqual ("Test", eventConfig.Name);

            eventCollection = null;
            config = source.Configs.Add ("Test 2");
            Assert.IsTrue (source.Configs == eventCollection);
            Assert.AreEqual (configAddedCount, 2);
            Assert.AreEqual ("Test 2", eventConfig.Name);

            eventCollection = null;
            source.Configs.RemoveAt (0);
            Assert.IsTrue (source.Configs == eventCollection);
            Assert.AreEqual (configAddedCount, 2);
            Assert.AreEqual ("Test", eventConfig.Name);
        }
开发者ID:e-lefort,项目名称:CSharpIniFileSerializer,代码行数:28,代码来源:ConfigCollectionTests.cs

示例7: Init

        public void Init()
        {
            //AppDomain.CurrentDomain.SetData("APPBASE", Environment.CurrentDirectory + "/bin");
//            Console.WriteLine(AppDomain.CurrentDomain.BaseDirectory);
            m_xEngine = new XEngine();

            // Necessary to stop serialization complaining
            WorldCommModule wcModule = new WorldCommModule();

            IniConfigSource configSource = new IniConfigSource();

            IConfig startupConfig = configSource.AddConfig("Startup");
            startupConfig.Set("DefaultScriptEngine", "XEngine");

            IConfig xEngineConfig = configSource.AddConfig("XEngine");
            xEngineConfig.Set("Enabled", "true");

            // These tests will not run with AppDomainLoading = true, at least on mono.  For unknown reasons, the call
            // to AssemblyResolver.OnAssemblyResolve fails.
            xEngineConfig.Set("AppDomainLoading", "false");

            m_scene = new SceneHelpers().SetupScene("My Test", UUID.Random(), 1000, 1000, configSource);
            SceneHelpers.SetupSceneModules(m_scene, configSource, m_xEngine, wcModule);

            m_scene.EventManager.OnChatFromWorld += OnChatFromWorld;
            m_scene.StartScripts();
        }
开发者ID:CassieEllen,项目名称:opensim,代码行数:27,代码来源:ScriptPerformanceTests.cs

示例8: AddNewConfigsAndKeys

        public void AddNewConfigsAndKeys()
        {
            // Add some new configs and keys here and test.
            StringWriter writer = new StringWriter ();
            writer.WriteLine ("[Pets]");
            writer.WriteLine (" cat = muffy");
            writer.WriteLine (" dog = rover");
            IniConfigSource source = new IniConfigSource
                                    (new StringReader (writer.ToString ()));

            IConfig config = source.Configs["Pets"];
            Assert.AreEqual ("Pets", config.Name);
            Assert.AreEqual (2, config.GetKeys ().Length);

            IConfig newConfig = source.AddConfig ("NewTest");
            newConfig.Set ("Author", "Brent");
            newConfig.Set ("Birthday", "February 8th");

            newConfig = source.AddConfig ("AnotherNew");

            Assert.AreEqual (3, source.Configs.Count);
            config = source.Configs["NewTest"];
            Assert.IsNotNull (config);
            Assert.AreEqual (2, config.GetKeys ().Length);
            Assert.AreEqual ("February 8th", config.Get ("Birthday"));
            Assert.AreEqual ("Brent", config.Get ("Author"));
        }
开发者ID:rwhitworth,项目名称:nini,代码行数:27,代码来源:ConfigSourceBaseTests.cs

示例9: SetupNeighbourRegions

        private void SetupNeighbourRegions(TestScene sceneA, TestScene sceneB)
        {            
            // XXX: HTTP server is not (and should not be) necessary for this test, though it's absence makes the 
            // CapabilitiesModule complain when it can't set up HTTP endpoints.
            //            BaseHttpServer httpServer = new BaseHttpServer(99999);
            //            MainServer.AddHttpServer(httpServer);
            //            MainServer.Instance = httpServer;

            // We need entity transfer modules so that when sp2 logs into the east region, the region calls 
            // EntityTransferModuleto set up a child agent on the west region.
            // XXX: However, this is not an entity transfer so is misleading.
            EntityTransferModule etmA = new EntityTransferModule();
            EntityTransferModule etmB = new EntityTransferModule();
            LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Chat");
            IConfig modulesConfig = config.AddConfig("Modules");
            modulesConfig.Set("EntityTransferModule", etmA.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);

            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(sceneA, config, new CapabilitiesModule(), etmA, new ChatModule());           
            SceneHelpers.SetupSceneModules(sceneB, config, new CapabilitiesModule(), etmB, new ChatModule());
        }
开发者ID:RadaSangOn,项目名称:workCore2,代码行数:25,代码来源:ChatModuleTests.cs

示例10: LoadMainConfig

        private static void LoadMainConfig()
        {
            try
            {
                _mainConfigFile = string.Format("{0}/Conf/{1}", FileHelpers.AssemblyRoot, "default.conf"); // the config file's location.
                _mainConfigParser = new IniConfigSource(_mainConfigFile); // see if the file exists by trying to parse it.
                _mainConfigFileExists = true;
            }
            catch (Exception)
            {
                _mainConfigParser = new IniConfigSource(); // initiate a new .ini source.
                _mainConfigFileExists = false;
                Log.Warning("Error loading settings {0}, will be using default settings.", _mainConfigFile);
            }
            finally
            {
                // adds aliases so we can use On and Off directives in ini files.
                _mainConfigParser.Alias.AddAlias("On", true);
                _mainConfigParser.Alias.AddAlias("Off", false);

                // logger level aliases.
                //Parser.Alias.AddAlias("MinimumLevel", Logger.Level.Trace);
                //Parser.Alias.AddAlias("MaximumLevel", Logger.Level.Trace);

                _mainConfigParser.ExpandKeyValues();
            }
        }
开发者ID:Ziftr,项目名称:CoiniumServ,代码行数:27,代码来源:ConfigManager.cs

示例11: TestSameRegionTeleport

        public void TestSameRegionTeleport()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            EntityTransferModule etm = new EntityTransferModule();

            IConfigSource config = new IniConfigSource();
            config.AddConfig("Modules");
            // Not strictly necessary since FriendsModule assumes it is the default (!)
            config.Configs["Modules"].Set("EntityTransferModule", etm.Name);

            TestScene scene = new SceneHelpers().SetupScene("sceneA", TestHelpers.ParseTail(0x100), 1000, 1000);
            SceneHelpers.SetupSceneModules(scene, config, etm);

            Vector3 teleportPosition = new Vector3(10, 11, 12);
            Vector3 teleportLookAt = new Vector3(20, 21, 22);

            ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1));
            sp.AbsolutePosition = new Vector3(30, 31, 32);
            scene.RequestTeleportLocation(
                sp.ControllingClient,
                scene.RegionInfo.RegionHandle,
                teleportPosition,
                teleportLookAt,
                (uint)TeleportFlags.ViaLocation);

            Assert.That(sp.AbsolutePosition, Is.EqualTo(teleportPosition));

            // Lookat is sent to the client only - sp.Lookat does not yield the same thing (calculation from camera
            // position instead).
//            Assert.That(sp.Lookat, Is.EqualTo(teleportLookAt));
        }
开发者ID:OpenPlex-Sim,项目名称:opensim,代码行数:33,代码来源:ScenePresenceTeleportTests.cs

示例12: Parse

        public static IConfigSource Parse(string rawConfiguration)
        {
            IConfigSource source;

            try
            {
                source = new IniConfigSource(new StringReader(rawConfiguration));
            }
            catch (IniException e)
            {
                throw new ConfigurationException(string.Format("Configuration load failed - {0}", e.Message), e);
            }

            // Check that all the parameters and sections are there.
            try
            {
                IConfig generalConfig = GetConfig(source, GENERAL_SECTION_NAME);
                string rawModelType = generalConfig.GetString(MODEL_TYPE_KEY);

                Enum.Parse(typeof(AbstractGameAssetType), rawModelType, true);
            }
            catch (ArgumentException e)
            {
                throw new ConfigurationException(string.Format("Configuration problem - {0}", e.Message), e);
            }

            return source;
        }
开发者ID:justinccdev,项目名称:waterwars,代码行数:28,代码来源:GameModelConfigurationParser.cs

示例13: Get

        public static string Get(Type connType)
        {
            string sConn;

            if (conns.TryGetValue(connType, out sConn))
                return sConn;

            Assembly asm = Assembly.GetExecutingAssembly();
            string sType = connType.Name;

            // Note: when running from NUnit, the DLL is located in some temp dir, so how do we get 
            // to the INI file? Ok, so put it into the resources! 
            // string iniName = Path.Combine(Path.GetDirectoryName(asm.Location), "TestDataConnections.ini");

            string[] allres = asm.GetManifestResourceNames();
            string sResFile = Array.Find(allres, s => s.Contains("TestDataConnections.ini"));

            if (String.IsNullOrEmpty(sResFile))
                throw new Exception(String.Format("Please add resource TestDataConnections.ini, with section [TestConnections] and settings like {0}=\"...\"",
                    sType));

            using (Stream resource = asm.GetManifestResourceStream(sResFile))
            {
                IConfigSource source = new IniConfigSource(resource);
                var cfg = source.Configs["TestConnections"];
                sConn = cfg.Get(sType, "");
            }

            if (!String.IsNullOrEmpty(sConn))
                conns[connType] = sConn;

            return sConn;
        }
开发者ID:AlexRa,项目名称:opensim-mods-Alex,代码行数:33,代码来源:DefaultTestConns.cs

示例14: SetAndSave

		public void SetAndSave ()
		{
			string filePath = "Test.ini";

			StreamWriter writer = new StreamWriter (filePath);
			writer.WriteLine ("; some comment");
			writer.WriteLine ("[new section]");
			writer.WriteLine (" dog = Rover");
			writer.WriteLine (""); // empty line
			writer.WriteLine ("; a comment");
			writer.WriteLine (" cat = Muffy");
			writer.Close ();
			
			IniConfigSource source = new IniConfigSource (filePath);
			IConfig config = source.Configs["new section"];
			Assert.AreEqual ("Rover", config.Get ("dog"));
			Assert.AreEqual ("Muffy", config.Get ("cat"));
			
			config.Set ("dog", "Spots");
			config.Set ("cat", "Misha");
			config.Set ("DoesNotExist", "SomeValue");
			
			Assert.AreEqual ("Spots", config.Get ("dog"));
			Assert.AreEqual ("Misha", config.Get ("cat"));
			Assert.AreEqual ("SomeValue", config.Get ("DoesNotExist"));
			source.Save ();
			
			source = new IniConfigSource (filePath);
			config = source.Configs["new section"];
			Assert.AreEqual ("Spots", config.Get ("dog"));
			Assert.AreEqual ("Misha", config.Get ("cat"));
			Assert.AreEqual ("SomeValue", config.Get ("DoesNotExist"));
			
			File.Delete (filePath);
		}
开发者ID:JeffreyZksun,项目名称:gpstranslator,代码行数:35,代码来源:IniConfigSourceTests.cs

示例15: DefaultConfig

        private static IConfigSource DefaultConfig()
        {
            IConfigSource result = new IniConfigSource();

            {
                IConfig config = result.AddConfig("Config");
                config.Set("listen_port", 8003);
                config.Set("assetset_location", String.Format(".{0}assets{0}AssetSets.xml", Path.DirectorySeparatorChar));
            }

            {
                IConfig config = result.AddConfig("Plugins");
                config.Set("asset_storage_provider", "OpenSimAssetStorage");
                config.Set("inventory_storage_provider", "OpenSimInventoryStorage");
                config.Set("authentication_provider", "NullAuthentication");
                config.Set("authorization_provider", "AuthorizeAll");
                config.Set("metrics_provider", "NullMetrics");
                config.Set("frontends", "ReferenceFrontend,OpenSimAssetFrontend,OpenSimInventoryFrontend,BrowseFrontend");
            }

            {
                IConfig config = result.AddConfig("OpenSim");
                config.Set("asset_database_provider", "OpenSim.Data.MySQL.dll");
                config.Set("inventory_database_provider", "OpenSim.Data.MySQL.dll");
                config.Set("asset_database_connect", String.Empty);
                config.Set("inventory_database_connect", String.Empty);
            }

            return result;
        }
开发者ID:ChrisD,项目名称:opensim,代码行数:30,代码来源:AssetInventoryConfig.cs


注:本文中的Nini.Config.IniConfigSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。