private void ConfigureModule(string installationPath, OSDMap map) { bool standaloneSwitch = map["StandaloneSwitch"]; bool ConsoleConfiguration = map["ConsoleConfiguration"]; bool useConfigDirectory = true; if (standaloneSwitch) { useConfigDirectory = MainConsole.Instance.Prompt("Are you running this module in standalone or on Aurora.Server?", "Standalone", new List <string>(new[] { "Standalone", "Aurora.Server" })) == "Standalone"; } string configDir = useConfigDirectory ? map["ConfigDirectory"] : map["ServerConfigDirectory"]; string configurationFinished = map["ConfigurationFinished"]; string configPath = Path.Combine(Environment.CurrentDirectory, configDir); OSDArray config = (OSDArray)map["Configs"]; foreach (OSD c in config) { try { File.Copy(Path.Combine(installationPath, c.AsString()), Path.Combine(configPath, c.AsString())); } catch { } } if (ConsoleConfiguration) { OSDMap ConsoleConfig = (OSDMap)map["ConsoleConfig"]; foreach (KeyValuePair <string, OSD> kvp in ConsoleConfig) { string resp = MainConsole.Instance.Prompt(kvp.Key); OSDMap configMap = (OSDMap)kvp.Value; string file = configMap["File"]; string Section = configMap["Section"]; string ConfigOption = configMap["ConfigOption"]; Nini.Ini.IniDocument doc = new Nini.Ini.IniDocument(Path.Combine(configPath, file)); doc.Sections[Section].Set(ConfigOption, resp); doc.Save(Path.Combine(configPath, file)); } } MainConsole.Instance.Warn(configurationFinished); }
private void ConfigureModule(string installationPath, OSDMap map) { bool standaloneSwitch = map["StandaloneSwitch"]; bool ConsoleConfiguration = map["ConsoleConfiguration"]; bool useConfigDirectory = true; if (standaloneSwitch) useConfigDirectory = MainConsole.Instance.Prompt("Are you running this module in standalone or on Aurora.Server?", "Standalone", new List<string>(new[] {"Standalone", "Aurora.Server"})) == "Standalone"; string configDir = useConfigDirectory ? map["ConfigDirectory"] : map["ServerConfigDirectory"]; string configurationFinished = map["ConfigurationFinished"]; string configPath = Path.Combine(Environment.CurrentDirectory, configDir); OSDArray config = (OSDArray) map["Configs"]; foreach (OSD c in config) { try { File.Copy(Path.Combine(installationPath, c.AsString()), Path.Combine(configPath, c.AsString())); } catch { } } if (ConsoleConfiguration) { OSDMap ConsoleConfig = (OSDMap) map["ConsoleConfig"]; foreach (KeyValuePair<string, OSD> kvp in ConsoleConfig) { string resp = MainConsole.Instance.Prompt(kvp.Key); OSDMap configMap = (OSDMap) kvp.Value; string file = configMap["File"]; string Section = configMap["Section"]; string ConfigOption = configMap["ConfigOption"]; Nini.Ini.IniDocument doc = new Nini.Ini.IniDocument(Path.Combine(configPath, file)); doc.Sections[Section].Set(ConfigOption, resp); doc.Save(Path.Combine(configPath, file)); } } MainConsole.Instance.Warn(configurationFinished); }