public static void AttachBootstrap() { try { var path = ((Environment.OSVersion.Platform == PlatformID.Unix) ? Path.DirectorySeparatorChar.ToString() : "") + System.Reflection.Assembly.GetExecutingAssembly().Location.Replace(Path.DirectorySeparatorChar + "Pluton.Core.dll", ""); foreach (var file in Directory.GetFiles(path, "Pluton.*.dll")) { if (!file.EndsWith("Pluton.Core.dll")) { System.Reflection.Assembly module = System.Reflection.Assembly.LoadFile(file); foreach (var type in module.GetTypes()) { if (type.ToString() == file.Split(Path.DirectorySeparatorChar).Last().Replace("dll", "Bootstrap")) { module.CreateInstance(type.ToString()); } } } } DirectoryConfig.GetInstance(); CoreConfig.GetInstance(); Config.GetInstance(); Init(); PlutonLoaded = true; Console.WriteLine($"[v.{Version}] Pluton loaded!"); } catch (Exception ex) { Debug.LogException(ex); Debug.Log("[Bootstarp] Error while loading Pluton!"); } }
public void Reload() { string ConfigPath = DirectoryConfig.GetInstance().GetConfigPath("Core"); if (File.Exists(ConfigPath)) { ConfigFile = 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(); }
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(); } }