コード例 #1
0
        public override void SetUp()
        {
            base.SetUp();

            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.AddConfig("GridService");
            config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
            config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
            config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll");
            config.Configs["GridService"].Set("Region_Test_Region_1", "DefaultRegion");
            config.Configs["GridService"].Set("Region_Test_Region_2", "FallbackRegion");
            config.Configs["GridService"].Set("Region_Test_Region_3", "FallbackRegion");
            config.Configs["GridService"].Set("Region_Other_Region_4", "FallbackRegion");

            m_LocalConnector = new LocalGridServicesConnector(config, null);
        }
コード例 #2
0
        public void SaveRegionToFile(string description, string filename)
        {
            if (filename.ToLower().EndsWith(".ini"))
            {
                IniConfigSource source = new IniConfigSource();
                try
                {
                    source = new IniConfigSource(filename, Nini.Ini.IniFileType.AuroraStyle); // Load if it exists
                }
                catch (Exception)
                {
                }

                WriteNiniConfig(source);

                source.Save(filename);
            }
        }
コード例 #3
0
        public void WriteNiniConfig(IConfigSource source)
        {
            try
            {
                //MUST reload or it will overwrite other changes!
                source = new IniConfigSource(RegionFile, Nini.Ini.IniFileType.AuroraStyle);
            }
            catch (FileNotFoundException)
            {
                //If this happens, it is the first time a user has opened Aurora and the RegionFile doesn't exist
                // yet, so just let it gracefully fail and create itself later
                return;
            }

            CreateIConfig(source);

            source.Save();
        }
コード例 #4
0
        void cargaSettings()
        {
            !!!!!!!!Creo que aquí está el error.Dónde se crea el archivo si no existe ?? (Anotación externa..debería producir error)

            iniciando = true;

            archivoConf          = new IniConfigSource(rutaConf);
            archivoConf.AutoSave = true;
            config = archivoConf.Configs["Configuracion"];

            sliderVolumen.Value = (int)(volumen * 100);
            setBotonControlVolumen();
            labelMarquesina.Text = txtMarquesina;
            labelCuerpo.Text     = txtCuerpo;
            labelPie.Text        = txtPie;

            iniciando = false;
        }
コード例 #5
0
        private Scene CreateScriptingEnabledTestScene()
        {
            IConfigSource config  = new IniConfigSource();
            List <object> modules = new List <object>();

            AddCommonConfig(config, modules);
            AddScriptingConfig(config, modules);

            Scene scene
                = new SceneHelpers().SetupScene(
                      "attachments-test-scene", TestHelpers.ParseTail(999), 1000, 1000, config);

            SceneHelpers.SetupSceneModules(scene, config, modules.ToArray());

            scene.StartScripts();

            return(scene);
        }
コード例 #6
0
        private void timer4_Tick(object sender, EventArgs e)
        {
            IniConfigSource launcher     = new IniConfigSource("launcher.ini");
            IConfig         patchSection = launcher.Configs["Patch"];
            string          PATCHPATH    = patchSection.Get("PatchPath");
            string          filename     = "bin32.zip";

            if (patchvrs != "Default")
            {
                filename = patchvrs + ".zip";
                filename = filename.Replace("|", "~");
            }

            // Label change
            progressBar1.Value = 0;
            label1.Text        = "Downloading zip file...";

            // Download Files
            try
            {
                using (WebClient webClient = new WebClient())
                {
                    //Catch Or download
                    Uri uri = new System.Uri(PATCHPATH + "/" + filename);
                    Autoupdate.setupname = System.IO.Path.GetFileName(uri.LocalPath);
                    WebClient client = new WebClient();
                    client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
                    client.DownloadFileCompleted   += new AsyncCompletedEventHandler(client_DownloadFileCompleted);
                    client.DownloadFileAsync(uri, System.Environment.CurrentDirectory + "/" + "patch.zip");
                }
            }
            catch (WebException ea)
            {
                var response = ea.Response as HttpWebResponse;
                label1.Text = "Connection Error";
                timer4.Stop();
                if (ea.Status == WebExceptionStatus.ProtocolError)
                {
                    MessageBox.Show("Unable to download the file (" + (int)response.StatusCode + " " + ((HttpWebResponse)ea.Response).StatusDescription + ")", "Connection Error: (" + (int)response.StatusCode + ")", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                label1.Text = "Ready to Update.." + " (" + patchvrs + ")";;
                cclupdate();
            }
        }
コード例 #7
0
        public RegionInfo[] LoadRegions()
        {
            IConfig RegionStartupConfig = m_configSource.Configs["RegionStartup"];

            if (RegionStartupConfig != null)
            {
                string url = RegionStartupConfig.GetString("WebServerURL", String.Empty).Trim();
                if (url == String.Empty)
                {
                    //m_log.Error("[WEBLOADER]: Unable to load webserver URL - URL was empty.");
                    return(null);
                }
                else
                {
                    HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(url);
                    webRequest.Timeout = 30000; //30 Second Timeout

                    m_log.Debug("[WEBLOADER]: Sending Download Request...");
                    HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse();

                    m_log.Info("[WEBLOADER]: Downloading Region Information From Remote Server...");
                    StreamReader reader = new StreamReader(webResponse.GetResponseStream());

                    m_log.Debug("[WEBLOADER]: Done downloading region information from server.");

                    List <RegionInfo> regionInfos = new List <RegionInfo>();

                    IConfigSource source = new IniConfigSource(new Nini.Ini.IniDocument(reader.BaseStream, Nini.Ini.IniFileType.AuroraStyle));

                    int i = 0;
                    foreach (IConfig config in source.Configs)
                    {
                        RegionInfo region = new RegionInfo();
                        //Use this to load the config from the file
                        RegionLoaderFileSystem system = new RegionLoaderFileSystem();
                        system.LoadRegionFromFile("REGION CONFIG #" + (i + 1), "", false, m_configSource, config.Name);
                        regionInfos.Add(region);
                        i++;
                    }
                    return(regionInfos.ToArray());
                }
            }
            return(null);
        }
コード例 #8
0
        public override void SetUp()
        {
            base.SetUp();

            IConfigSource initConfigSource = new IniConfigSource();
            IConfig       config           = initConfigSource.AddConfig("XEngine");

            config.Set("Enabled", "true");

            Scene           scene = new SceneHelpers().SetupScene();
            SceneObjectPart part  = SceneHelpers.AddSceneObject(scene).RootPart;

            XEngine.XEngine engine = new XEngine.XEngine();
            engine.Initialise(initConfigSource);
            engine.AddRegion(scene);

            m_lslApi = new LSL_Api();
            m_lslApi.Initialize(engine, part, null);
        }
コード例 #9
0
        public void GetString()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Test]");
            writer.WriteLine(" cat = muffy");
            writer.WriteLine(" dog = rover");
            writer.WriteLine(" bird = tweety");
            IniConfigSource source =
                new IniConfigSource(new StringReader(writer.ToString()));
            IConfig config = source.Configs["Test"];

            Assert.AreEqual("muffy", config.Get("cat"));
            Assert.AreEqual("rover", config.Get("dog"));
            Assert.AreEqual("muffy", config.GetString("cat"));
            Assert.AreEqual("rover", config.GetString("dog"));
            Assert.AreEqual("my default", config.Get("Not Here", "my default"));
            Assert.IsNull(config.Get("Not Here 2"));
        }
コード例 #10
0
        public void Rename()
        {
            IniConfigSource source = new IniConfigSource();

            IConfig config = source.AddConfig("Pets");

            config.Set("cat", "Muffy");
            config.Set("dog", "Rover");

            config.Name = "MyPets";
            Assert.AreEqual("MyPets", config.Name);

            Assert.IsNull(source.Configs["Pets"]);
            IConfig newConfig = source.Configs["MyPets"];

            Assert.AreEqual(config, newConfig);

            Assert.AreEqual(2, newConfig.GetKeys().Length);
        }
コード例 #11
0
        private GroupLoader()
        {
            var dir = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            IniConfigSource config   = new IniConfigSource(System.IO.Path.Combine(dir, "Halcyon.ini"));
            var             settings = new ConfigSettings();

            settings.SettingsFile = config.Configs;

            Data.Assets.Stratus.Config.Settings.Instance.DisableWritebackCache = true;
            _stratus = new Data.Assets.Stratus.StratusAssetClient();
            _stratus.Initialize(settings);
            _stratus.Start();

            _legacyInv   = new LegacyMysqlInventoryStorage(Properties.Settings.Default.CoreConnStr);
            _inv         = new InventoryStorage(Properties.Settings.Default.InventoryCluster);
            _invSelector = new CassandraMigrationProviderSelector(Properties.Settings.Default.MigrationActive,
                                                                  Properties.Settings.Default.CoreConnStr, _inv, _legacyInv);
        }
コード例 #12
0
            public static CharacterSettings Load(string name)
            {
                string fileName = name + ".cset";

                if (!File.Exists(fileName))
                {
                    throw new FileNotFoundException("Char settings not found", name);
                }

                var settings     = new CharacterSettings();
                var configSource = new IniConfigSource(fileName);

                settings.Mode = configSource.Configs["Main"].Get("Mode").To <CharacterModes>();
                if (settings.Mode == CharacterModes.Grind)
                {
                    settings.MobIds      = configSource.Configs["Grind"].Get("MobIDs").Split('|').Select(int.Parse).ToArray();
                    settings.StartCoords = new Coords(
                        configSource.Configs["Grind"].GetFloat("CoordX", 0),
                        configSource.Configs["Grind"].GetFloat("CoordY", 0),
                        configSource.Configs["Grind"].GetFloat("CoordZ", 0),
                        true);
                    settings.Radius      = configSource.Configs["Grind"].GetFloat("Radius", 10000);
                    settings.AntiKs      = configSource.Configs["Grind"].GetBoolean("AntiKS");
                    settings.ExitOnDeath = configSource.Configs["Grind"].GetBoolean("ExitOnDeath");
                }
                else if (settings.Mode == CharacterModes.Single)
                {
                    settings.UseSpark  = configSource.Configs["Single"].GetInt("UseSpark", 0);
                    settings.UseAttack = configSource.Configs["Single"].GetBoolean("UseAttack");
                    settings.SkillIds  = configSource.Configs["Single"].GetString("SkillIDs").Split('|').WhereNot(string.IsNullOrEmpty).Select(int.Parse).ToArray();
                }
                else if (settings.Mode == CharacterModes.Cleric)
                {
                    settings.PlayerId = configSource.Configs["Cleric"].GetInt("PlayerID");
                    settings.BuffIds  = configSource.Configs["Cleric"].GetString("BuffIDs").Split('|').Select(int.Parse).ToArray();
                }
                else if (settings.Mode == CharacterModes.Frost)
                {
                    settings.FrostBoss = configSource.Configs["Frost"].GetInt("BossNumber");
                }

                return(settings);
            }
コード例 #13
0
        public void Initialize()
        {
            IConfigSource openSimINI = new IniConfigSource();
            IConfig startupConfig = openSimINI.AddConfig("Startup");
            startupConfig.Set("physics", "OpenDynamicsEngine");
            startupConfig.Set("DecodedSculptMapPath", "j2kDecodeCache");

            Vector3 regionExtent = new Vector3(Constants.RegionSize, Constants.RegionSize, Constants.RegionHeight);

            //PhysicsScene pScene = physicsPluginManager.GetPhysicsScene(
            //                "BulletSim", "Meshmerizer", openSimINI, "BSTestRegion", regionExtent);
            RegionInfo info = new RegionInfo();
            info.RegionName = "ODETestRegion";
            info.RegionSizeX = info.RegionSizeY = info.RegionSizeZ = Constants.RegionSize;
            Framework.Scenes.Scene scene = new Framework.Scenes.Scene(info);

            //IMesher mesher = new OpenSim.Region.PhysicsModule.Meshing.Meshmerizer();
            //INonSharedRegionModule mod = mesher as INonSharedRegionModule;
            //mod.Initialise(openSimINI);
            //mod.AddRegion(scene);
            //mod.RegionLoaded(scene);

            //            pScene = new OdeScene();
            odemodule = new PhysicsModule.ODE.OdeModule();
            Console.WriteLine("HERE " + (odemodule == null ? "Null" : "Not null"));
            odemodule.Initialise(openSimINI);
            odemodule.AddRegion(scene);
            odemodule.RegionLoaded(scene);

            // Loading ODEPlugin
            //cbt = new OdePlugin();
            // Getting Physics Scene
            //ps = cbt.GetScene("test");
            // Initializing Physics Scene.
            //ps.Initialise(imp.GetMesher(TopConfig), null, Vector3.Zero);
            float[] _heightmap = new float[(int)Constants.RegionSize * (int)Constants.RegionSize];
            for (int i = 0; i < ((int)Constants.RegionSize * (int)Constants.RegionSize); i++)
            {
                _heightmap[i] = 21f;
            }
            pScene = scene.PhysicsScene;
            pScene.SetTerrain(_heightmap);
        }
コード例 #14
0
        public void Init()
        {
            base.SetUp();

            IConfigSource config = new IniConfigSource();

            config.AddConfig("NPC");
            config.Configs["NPC"].Set("Enabled", "true");
            config.AddConfig("Modules");
            config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule");

            m_afMod  = new AvatarFactoryModule();
            m_umMod  = new UserManagementModule();
            m_attMod = new AttachmentsModule();
            m_npcMod = new NPCModule();

            m_scene = new SceneHelpers().SetupScene();
            SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule());
        }
コード例 #15
0
ファイル: ConfigManager.cs プロジェクト: rdavydov/d3sharp
        private static bool _fileExists = false;        // does the ini file exists?

        static ConfigurationManager()
        {
            try
            {
                Parser      = new IniConfigSource(ConfigFile); // see if the file exists by trying to parse it.
                _fileExists = true;
            }
            catch (Exception)
            {
                Parser      = new IniConfigSource(); // initiate a new .ini source.
                _fileExists = false;
                Logger.Warn("Error loading settings config.ini, will be using default settings.");
            }
            finally
            {
                Parser.Alias.AddAlias("On", true); // adds aliases so we can use On and Off directives in ini files.
                Parser.Alias.AddAlias("Off", false);
            }
        }
コード例 #16
0
        public void TestDeRezSceneObject()
        {
            TestHelpers.InMethod();
//            log4net.Config.XmlConfigurator.Configure();

            UUID userId = UUID.Parse("10000000-0000-0000-0000-000000000001");

            TestScene     scene        = new SceneHelpers().SetupScene();
            IConfigSource configSource = new IniConfigSource();
            IConfig       config       = configSource.AddConfig("Startup");

            config.Set("serverside_object_permissions", true);
            SceneHelpers.SetupSceneModules(scene, configSource, new object[] { new PermissionsModule() });
            IClientAPI client = SceneHelpers.AddScenePresence(scene, userId).ControllingClient;

            // 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);

            // Check that object isn't deleted until we crank the sogd handle.
            SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);

            Assert.That(retrievedPart, Is.Not.Null);
            Assert.That(retrievedPart.ParentGroup.IsDeleted, Is.False);

            sogd.InventoryDeQueueAndDelete();

            SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);

            Assert.That(retrievedPart2, Is.Null);
        }
コード例 #17
0
        public void Save()
        {
            IConfigSource source = new IniConfigSource(filename);

            foreach (Setting setting in settings)
            {
                IConfig config;
                if (source.Configs[setting.Group] == null)
                {
                    config = source.AddConfig(setting.Group);
                }
                else
                {
                    config = source.Configs[setting.Group];
                }
                config.Set(setting.Name, setting.Data);
            }
            source.Save();
        }
コード例 #18
0
ファイル: ConfigManager.cs プロジェクト: zhongshuiyuan/gews
        /// <summary>
        /// Loads all configuration values into the UI controls.
        /// </summary>
        public string init(string path)
        {
            string configPath = path + "\\" + ConfigConst.CONFIG_FILE_NAME;

            if (!File.Exists(configPath))
            {
                return("无法找到配置文件:" + ConfigConst.CONFIG_FILE_NAME);
            }

            // Load the configuration source file
            IConfigSource source = new IniConfigSource(configPath);

            // Set the config to the Logging section of the INI file.
            IConfig config = source.Configs[ConfigConst.CONFIG_NETWORK];

            // Load up some normal configuration values
            string serverIp = config.Get(ConfigConst.CONFIG_SERVER_IP);
            string port     = config.Get(ConfigConst.CONFIG_PORT);
            string restPort = config.Get(ConfigConst.CONFIG_REST_PORT);

            ConfigManager cfgMgr = ConfigManager.Instance;

            cfgMgr.add(ConfigConst.CONFIG_SERVER_IP, serverIp);
            cfgMgr.add(ConfigConst.CONFIG_PORT, port);
            cfgMgr.add(ConfigConst.CONFIG_REST_PORT, restPort);

            config = source.Configs[ConfigConst.CONFIG_DATABASE];
            string dataSource   = config.Get(ConfigConst.CONFIG_DATASOURCE);
            string databaseMain = config.Get(ConfigConst.CONFIG_DATABASE_MAIN);
            string databaseGIS  = config.Get(ConfigConst.CONFIG_DATABASE_GIS);
            string databaseUID  = config.Get(ConfigConst.CONFIG_DATABASE_UID);
            string databasePwd  = config.Get(ConfigConst.CONFIG_DATABASE_PASSWD);
            string mxdFile      = config.Get(ConfigConst.CONFIG_MXD_FILE);

            cfgMgr.add(ConfigConst.CONFIG_DATASOURCE, dataSource);
            cfgMgr.add(ConfigConst.CONFIG_DATABASE_MAIN, databaseMain);
            cfgMgr.add(ConfigConst.CONFIG_DATABASE_GIS, databaseGIS);
            cfgMgr.add(ConfigConst.CONFIG_DATABASE_UID, databaseUID);
            cfgMgr.add(ConfigConst.CONFIG_DATABASE_PASSWD, databasePwd);
            cfgMgr.add(ConfigConst.CONFIG_MXD_FILE, mxdFile);

            return(string.Empty);
        }
コード例 #19
0
 private static bool CompileMooege(string mooegePath, bool LibMooNetStatus)
 {
     if (LibMooNetStatus)
     {
         Console.WriteLine("Compiling Mooege...");
         if (File.Exists(Program.madcowINI))
         {
             IConfigSource source = new IniConfigSource(Program.madcowINI);
             String        Src    = source.Configs["Balloons"].Get("ShowBalloons");
             if (Src.Contains("1"))
             {
                 Form1.GlobalAccess.MadCowTrayIcon.ShowBalloonTip(1000, "MadCow", "Compiling Mooege......", ToolTipIcon.Info);
             }
         }
         var mooegeProject = new Project(mooegePath);
         return(mooegeProject.Build(new Microsoft.Build.Logging.FileLogger()));
     }
     return(false);
 }
コード例 #20
0
        static public void LoadProfile()
        {
            string filename = Application.StartupPath + @"\Prometheus.ini";

            if (File.Exists(filename))
            {
                IConfigSource source = new IniConfigSource();
                foreach (IConfig config in source.Configs)
                {
                    string[] keys = config.GetKeys();
                    for (int x = 0; x < keys.Length; x++)
                    {
                        Setting setting = new Setting(config.Name, keys[x]);
                        setting.Data = config.GetString(keys[x]);
                        Settings.Add(setting);
                    }
                }
            }
        }
コード例 #21
0
        private static LocalGridServicesConnector StartGridService(Scene testScene)
        {
            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.AddConfig("GridService");
            config.Configs["Modules"].Set("GridServices", "LocalGridServicesConnector");
            config.Configs["GridService"].Set("StorageProvider", "OpenSim.Data.Null.dll:NullRegionData");
            config.Configs["GridService"].Set("LocalServiceModule", "OpenSim.Services.GridService.dll:GridService");
            config.Configs["GridService"].Set("ConnectionString", "!static");

            LocalGridServicesConnector gridService = new LocalGridServicesConnector();

            gridService.Initialise(config);
            gridService.AddRegion(testScene);
            gridService.RegionLoaded(testScene);

            return(gridService);
        }
コード例 #22
0
        public void TestDeRezSceneObjectToAgents()
        {
            TestHelpers.InMethod();
//            TestHelpers.EnableLogging();

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

            // We need this so that the creation of the root client for userB in sceneB can trigger the creation of a child client in sceneA
            LocalSimulationConnectorModule lscm = new LocalSimulationConnectorModule();
            EntityTransferModule           etmB = new EntityTransferModule();
            IConfigSource config        = new IniConfigSource();
            IConfig       modulesConfig = config.AddConfig("Modules");

            modulesConfig.Set("EntityTransferModule", etmB.Name);
            modulesConfig.Set("SimulationServices", lscm.Name);
            SceneHelpers.SetupSceneModules(new Scene[] { sceneA, sceneB }, config, lscm);
            SceneHelpers.SetupSceneModules(sceneB, config, etmB);

            // We need this for derez
            //SceneHelpers.SetupSceneModules(sceneA, new PermissionsModule());

            UserAccount uaA = UserAccountHelpers.CreateUserWithInventory(sceneA, "Andy", "AAA", 0x1, "");
            UserAccount uaB = UserAccountHelpers.CreateUserWithInventory(sceneA, "Brian", "BBB", 0x2, "");

            TestClient clientA = (TestClient)SceneHelpers.AddScenePresence(sceneA, uaA).ControllingClient;

            // This is the more long-winded route we have to take to get a child client created for userB in sceneA
            // rather than just calling AddScenePresence() as for userA
            AgentCircuitData  acd           = SceneHelpers.GenerateAgentData(uaB);
            TestClient        clientB       = new TestClient(acd, sceneB);
            List <TestClient> childClientsB = new List <TestClient>();

            EntityTransferHelpers.SetupInformClientOfNeighbourTriggersNeighbourClientCreate(clientB, childClientsB);

            SceneHelpers.AddScenePresence(sceneB, clientB, acd);

            SceneObjectGroup so        = SceneHelpers.AddSceneObject(sceneA);
            uint             soLocalId = so.LocalId;

            sceneA.DeleteSceneObject(so, false);
        }
コード例 #23
0
        public void TestLogoutClientDueToAck()
        {
            TestHelpers.InMethod();
            TestHelpers.EnableLogging();

            IniConfigSource ics    = new IniConfigSource();
            IConfig         config = ics.AddConfig("ClientStack.LindenUDP");

            config.Set("AckTimeout", -1);
            AddUdpServer(ics);

            ScenePresence sp = AddClient();

            m_udpServer.ClientOutgoingPacketHandler(sp.ControllingClient, true, false, false);

            ScenePresence spAfterAckTimeout = m_scene.GetScenePresence(sp.UUID);

            Assert.That(spAfterAckTimeout, Is.Null);
        }
コード例 #24
0
        private static LocalInventoryServicesConnector StartInventoryService(Scene testScene)
        {
            LocalInventoryServicesConnector inventoryService = new LocalInventoryServicesConnector();

            IConfigSource config = new IniConfigSource();

            config.AddConfig("Modules");
            config.AddConfig("InventoryService");
            config.Configs["Modules"].Set("InventoryServices", "LocalInventoryServicesConnector");
            config.Configs["InventoryService"].Set("LocalServiceModule", "OpenSim.Services.InventoryService.dll:InventoryService");
            config.Configs["InventoryService"].Set("StorageProvider", "OpenSim.Tests.Common.dll");

            inventoryService.Initialise(config);
            inventoryService.AddRegion(testScene);
            inventoryService.RegionLoaded(testScene);
            testScene.AddRegionModule(inventoryService.Name, inventoryService);

            return(inventoryService);
        }
コード例 #25
0
        /// <summary>
        /// Save the config files
        /// </summary>
        /// <param name="OldRegionName"></param>
        /// <param name="regionInfo"></param>
        private void SaveChangesFile(string OldRegionName, RegionInfo regionInfo)
        {
            string regionConfigPath = Path.Combine(Util.configDir(), "Regions");

            try
            {
                IConfig startupConfig = (IConfig)m_config.Configs["RegionStartup"];
                regionConfigPath = startupConfig.GetString("RegionsDirectory", regionConfigPath).Trim();
            }
            catch (Exception)
            {
                // No INI setting recorded.
            }
            if (!Directory.Exists(regionConfigPath))
            {
                return;
            }

            string[] iniFiles = Directory.GetFiles(regionConfigPath, "*.ini");
            int      i        = 0;

            foreach (string file in iniFiles)
            {
                IConfigSource source = new IniConfigSource(file, Nini.Ini.IniFileType.AuroraStyle);
                IConfig       cnf    = source.Configs[OldRegionName];
                if (cnf != null) //Does the old one exist in this file?
                {
                    IConfig check = source.Configs[regionInfo.RegionName];
                    if (check == null) //Is the new name non existant as well?
                    {
                        cnf.Set("Location", (regionInfo.RegionLocX / Constants.RegionSize) + "," + (regionInfo.RegionLocY / Constants.RegionSize));
                        cnf.Name = regionInfo.RegionName;
                        source.Save();
                    }
                    else
                    {
                        //The new region exists too, no name change
                        check.Set("Location", (regionInfo.RegionLocX / Constants.RegionSize) + "," + (regionInfo.RegionLocY / Constants.RegionSize));
                    }
                }
                i++;
            }
        }
コード例 #26
0
        /// <summary>
        /// Setup a default config values in case they aren't present in the ini file
        /// </summary>
        /// <returns>A Configuration source containing the default configuration</returns>
        private static IConfigSource DefaultConfig()
        {
            IConfigSource defaultConfig = new IniConfigSource();

            {
                IConfig config = defaultConfig.Configs["Startup"];

                if (null == config)
                {
                    config = defaultConfig.AddConfig("Startup");
                }

                config.Set("region_info_source", "filesystem");

                config.Set("physics", "OpenDynamicsEngine");
                config.Set("meshing", "Meshmerizer");
                config.Set("physical_prim", true);
                config.Set("see_into_this_sim_from_neighbor", true);
                config.Set("serverside_object_permissions", false);
                config.Set("storage_plugin", "OpenSim.Data.SQLite.dll");
                config.Set("storage_connection_string", "URI=file:OpenSim.db,version=3");
                config.Set("storage_prim_inventories", true);
                config.Set("startup_console_commands_file", String.Empty);
                config.Set("shutdown_console_commands_file", String.Empty);
                config.Set("DefaultScriptEngine", "XEngine");
                config.Set("clientstack_plugin", "OpenSim.Region.ClientStack.LindenUDP.dll");
                // life doesn't really work without this
                config.Set("EventQueue", true);
            }

            {
                IConfig config = defaultConfig.Configs["Network"];

                if (null == config)
                {
                    config = defaultConfig.AddConfig("Network");
                }

                config.Set("http_listener_port", ConfigSettings.DefaultRegionHttpPort);
            }

            return(defaultConfig);
        }
コード例 #27
0
        public override void SetUp()
        {
            base.SetUp();

            IConfigSource initConfigSource = new IniConfigSource();
            IConfig       config           = initConfigSource.AddConfig("XEngine");

            config.Set("Enabled", "true");
            config.Set("AllowOSFunctions", "true");
            config.Set("OSFunctionThreatLevel", "Severe");
            config = initConfigSource.AddConfig("NPC");
            config.Set("Enabled", "true");

            m_scene = new SceneHelpers().SetupScene();
            SceneHelpers.SetupSceneModules(m_scene, initConfigSource, new AvatarFactoryModule(), new NPCModule());

            m_engine = new XEngine.XEngine();
            m_engine.Initialise(initConfigSource);
            m_engine.AddRegion(m_scene);
        }
コード例 #28
0
        public void ToStringTest()
        {
            StringWriter writer = new StringWriter();

            writer.WriteLine("[Test]");
            writer.WriteLine(" cat = muffy");
            writer.WriteLine(" dog = rover");
            writer.WriteLine(" bird = tweety");
            IniConfigSource source =
                new IniConfigSource(new StringReader(writer.ToString()));

            string eol = Environment.NewLine;

            string compare = "[Test]" + eol
                             + "cat = muffy" + eol
                             + "dog = rover" + eol
                             + "bird = tweety" + eol;

            Assert.AreEqual(compare, source.ToString());
        }
コード例 #29
0
        public void SaveAfterTextWriter()
        {
            string filePath = "Test.ini";

            StreamWriter writer = new StreamWriter(filePath);

            writer.WriteLine("[new section]");
            writer.WriteLine(" dog = Rover");
            writer.Close();

            IniConfigSource source = new IniConfigSource(filePath);

            Assert.AreEqual(filePath, source.SavePath);
            StringWriter textWriter = new StringWriter();

            source.Save(textWriter);
            Assert.IsNull(source.SavePath);

            File.Delete(filePath);
        }
コード例 #30
0
        /// <summary>
        /// Applies any Delete modifications
        /// </summary>
        /// <param name="mod">The mod.</param>
        private void Delete(IniDelete mod)
        {
            try
            {
                IConfigSource target = new IniConfigSource(targetFile);

                if (config.BreakOnNoMatch && !target.Configs[mod.section].Contains(mod.key))
                {
                    throw new Exception("Could not match section");
                }

                target.Configs[mod.section].Remove(mod.key);
                target.Save();
                LogCount(log);
            }
            catch (Exception inner)
            {
                throw new Exception("Failed to process Delete modification to Section/Key = " + mod.section + "/" + mod.key, inner);
            }
        }
コード例 #31
0
ファイル: IniConfig.cs プロジェクト: debop/NFramework
 public IniConfig(string name, IConfigSource source) : base(name, source) {
     _parent = (IniConfigSource)source;
 }