public Settings() { Config = new ConfigSettings(); Server = new ServerSettings(); Drawesome = new DrawesomeSettings(); Prompts = new PromptSettings(); }
public Settings(ConfigSettings config, ServerSettings server, DrawesomeSettings drawesome, PromptSettings prompts) { Config = config; Server = server; Drawesome = drawesome; Prompts = prompts; }
// If mock is enabled we skip the console readline. public static void Load(bool mocked = false) { m_Mocked = mocked; var updated = false; if (File.Exists(m_FilePath)) { Core.WriteConsole($"Reading server configuration from {m_RelPath}..."); m_Settings = JsonConfig.Deserialize <ServerSettings>(m_FilePath); if (m_Settings == null) { Utility.PushColor(ConsoleColor.Red); Console.WriteLine("failed"); Utility.PopColor(); throw new FileNotFoundException($"Failed to deserialize {m_FilePath}."); } Utility.PushColor(ConsoleColor.Green); Console.WriteLine("done"); Utility.PopColor(); } else { updated = true; m_Settings = new ServerSettings(); } if (mocked) { return; } if (m_Settings.DataDirectories.Count == 0) { updated = true; m_Settings.DataDirectories.AddRange(GetDataDirectories()); } if (m_Settings.Listeners.Count == 0) { updated = true; m_Settings.Listeners.AddRange(GetListeners()); } if (m_Settings.Expansion == null) { var expansion = GetSetting <Expansion>("currentExpansion"); var hasExpansion = expansion != null; expansion ??= GetExpansion(); if (expansion <= Expansion.ML && !hasExpansion) { SetPre6000Support(); } updated = true; m_Settings.Expansion = expansion; } Core.Expansion = m_Settings.Expansion.Value; if (updated) { Save(); Utility.PushColor(ConsoleColor.Green); Core.WriteConsoleLine($"Server configuration saved to {m_RelPath}."); Utility.PopColor(); } }
public X509Certificate2 RequestCertificate(string xmppDomain) { var certConfig = ServerSettings.Certificate(xmppDomain); return(new X509Certificate2(Path.Combine(ExampleHelper.ProcessDirectory, certConfig["path"]), certConfig["secret"])); }