public void Reload() { string ConfigPath = DirectoryConfig.GetInstance().GetConfigPath("Core"); if (File.Exists(ConfigPath)) { ConfigFile = new IniParser(ConfigPath); } }
public void Reload() { string ConfigPath = DirectoryConfig.GetInstance().GetConfigPath("Pluton"); if (File.Exists(ConfigPath)) { PlutonConfig = new IniParser(ConfigPath); } }
public static void Init() { TrustedHashes = new List <string>(); string path = DirectoryConfig.GetInstance().GetConfigPath("Hashes"); if (!File.Exists(path)) { File.AppendAllText(path, "// empty"); } TrustedHashes = (from line in File.ReadAllLines(path) where !String.IsNullOrEmpty(line) && !line.StartsWith("//") select line).ToList <string>(); }
public void Initialize() { string ConfigPath = DirectoryConfig.GetInstance().GetConfigPath("Core"); if (File.Exists(ConfigPath)) { ConfigFile = new IniParser(ConfigPath); Debug.Log("Config " + ConfigPath + " loaded!"); } else { File.Create(ConfigPath).Close(); ConfigFile = new IniParser(ConfigPath); Debug.Log("Core config " + ConfigPath + " Created!"); Debug.Log("The config will be filled with the default values."); GenerateConfig(); ConfigFile.Save(); } }
public void Initialize() { string ConfigPath = DirectoryConfig.GetInstance().GetConfigPath("Pluton"); if (File.Exists(ConfigPath)) { PlutonConfig = new IniParser(ConfigPath); Debug.Log("Config " + ConfigPath + " loaded!"); } else { Directory.CreateDirectory(Util.GetPublicFolder()); File.Create(ConfigPath).Close(); PlutonConfig = new IniParser(ConfigPath); Debug.Log("Config " + ConfigPath + " Created!"); Debug.Log("The config will be filled with the default values."); } pluton.enabled = GetBoolValue("Config", "enabled", true); }
public static void AttachBootstrap() { try { DirectoryConfig.GetInstance(); CoreConfig.GetInstance(); Config.GetInstance(); if (!pluton.enabled) { Debug.Log("[Bootstrap] Pluton is disabled!"); return; } Init(); PlutonLoaded = true; Console.WriteLine("Pluton Loaded!"); } catch (Exception ex) { Debug.LogException(ex); Debug.Log("[Bootstarp] Error while loading Pluton!"); } }
public static void AttachBootstrap() { try { Hooks.CreateOrUpdateSubjects(); System.Reflection.Assembly executingAssembly = System.Reflection.Assembly.GetExecutingAssembly(); Type[] types = executingAssembly.GetTypes(); for (int i = 0; i < types.Length; i++) { object[] customAttributes = types[i].GetCustomAttributes(typeof(ConsoleSystem.Factory), false); if (customAttributes != null && customAttributes.Length != 0) { ConsoleSystem.Factory factory = customAttributes[0] as ConsoleSystem.Factory; typeof(ConsoleSystem.Index).CallStaticMethod("BuildFields", types[i], factory); typeof(ConsoleSystem.Index).CallStaticMethod("BuildProperties", types[i], factory); typeof(ConsoleSystem.Index).CallStaticMethod("BuildFunctions", types[i], factory); } } DirectoryConfig.GetInstance(); CoreConfig.GetInstance(); Config.GetInstance(); if (!pluton.enabled) { Debug.Log("[Bootstrap] Pluton is disabled!"); return; } Init(); PlutonLoaded = true; Console.WriteLine("Pluton Loaded!"); } catch (Exception ex) { Debug.LogException(ex); Debug.Log("[Bootstarp] Error while loading Pluton!"); } }
public static void reload(ConsoleSystem.Arg arg) { if (PluginLoader.GetInstance().Plugins.ContainsKey(arg.ArgsStr)) { PluginLoader.GetInstance().ReloadPlugin(arg.ArgsStr); arg.ReplyWith(String.Format("{0} plugin reloaded!", arg.ArgsStr)); } else if (arg.ArgsStr == "") { DirectoryConfig.GetInstance().Reload(); CoreConfig.GetInstance().Reload(); Config.GetInstance().Reload(); Server.GetInstance().LoadLoadouts(); if (Server.GetInstance().Loaded) { Hooks.On_ServerInit(); } PluginLoader.GetInstance().ReloadPlugins(); arg.ReplyWith("Pluton reloaded!"); var planes = (from plane in UnityEngine.Object.FindObjectsOfType <CargoPlane>() where plane.transform.position.x == 0f && plane.transform.position.z == 0f select plane).ToList(); planes.ForEach(p => p.SendMessage("KillMessage", UnityEngine.SendMessageOptions.DontRequireReceiver)); if (planes.Count != 0) { Pluton.Logger.LogWarning(String.Format("Destroyed {0} plane at Vector3.zero", planes.Count)); } } else { arg.ReplyWith(String.Format("Couldn't find plugin: {0}!", arg.ArgsStr)); } }