Beispiel #1
0
 static void LoadDefaultConfig()
 {
     instance = new LoonePermissionsConfig
     {
         defaultGroup     = "default",
         databaseSettings = new MySqlSettings {
             Database = "unturned", Username = "******", Password = "******", Address = "127.0.0.1", Port = 3306
         }
     };
 }
Beispiel #2
0
        protected override void Load()
        {
            Instance = this;

            hooks.Add(new UnturnedProvider());
            hooks.Add(new TLFProvider());

            Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();

            for (int i = 0; i < assemblies.Length; i++)
            {
                if (assemblies[i].GetName().Name == "Assembly-CSharp")
                {
                    GameAssembly = assemblies[i];
                    break;
                }
            }

            for (int i = 0; i < hooks.Count; i++)
            {
                for (int ii = 0; ii < assemblies.Length; ii++)
                {
                    if (hooks[i].DeterminingAssembly == assemblies[ii].GetName().Name)
                    {
                        GameHook       = hooks[i];
                        RocketAssembly = assemblies[ii];
                        goto FoundRocketAssembly;
                    }
                }
            }

            RocketLogger.Log("Failed to find any supporting games! Please only use this software with supported games.");
            UnloadPlugin();
            return;

FoundRocketAssembly:

            RocketLogger.Log(string.Format("Welcome to Loone Permissions v{0}!", Assembly.GetName().Version), ConsoleColor.Yellow);
            RocketLogger.Log(string.Format("Plugin is now running in compatibility mode with: {0}", GameHook.DeterminingAssembly), ConsoleColor.Yellow);

            GameHook.Initialize();

            LoonePermissionsConfig.Initialize();
            MySqlManager.Initialize();
            CommandManager.Initialize();

            Invoke("LateInit", 1f);
        }
 public static void Initialize()
 {
     if (File.Exists(Directory))
     {
         string config = File.ReadAllText(Directory);
         try {
             instance = JsonConvert.DeserializeObject <LoonePermissionsConfig>(config);
         } catch {
             File.WriteAllText(Directory_Errored, config);
             LoadDefaultConfig();
             SaveConfig();
             RocketLogger.LogError("Config failed to load! Reverting to default settings...");
         }
     }
     else
     {
         LoadDefaultConfig();
         SaveConfig();
     }
 }