コード例 #1
0
ファイル: FSWatcher.cs プロジェクト: 906507516/Oxide
 /// <summary>
 /// Initializes a new instance of the FSWatcher class
 /// </summary>
 /// <param name="directory"></param>
 /// <param name="filter"></param>
 public FSWatcher(string directory, string filter)
 {
     watchedPlugins = new HashSet<string>();
     changeQueue = new Dictionary<string, QueuedChange>();
     timers = Interface.Oxide.GetLibrary<Timer>();
     LoadWatcher(directory, filter);
 }
コード例 #2
0
 public void Destroy(ref Oxide.Plugins.Timer timer)
 {
     Oxide.Plugins.Timer timer1 = timer;
     if (timer1 != null)
     {
         timer1.DestroyToPool();
     }
     else
     {
     }
     timer = null;
 }
コード例 #3
0
 void Init()
 {
     LoadConfig();
     mySave = Interface.GetMod().DataFileSystem.GetDatafile("HappyHour");
     if (mySave["Users"] != null)
     {
         if (((Dictionary <string, object>)mySave["Users"]).Count != 0)
         {
             Users = (Dictionary <string, object>)mySave["Users"];
         }
     }
     mySaveData();
     MainTimer = Interface.GetMod().GetLibrary <Oxide.Core.Libraries.Timer>("Timer");
     MainTime  = Interface.GetMod().GetLibrary <Time>("Time");
 }
コード例 #4
0
        /// <summary>
        /// Initializes a new instance of the OxideMod class
        /// </summary>
        public void Load()
        {
            RootDirectory = Environment.CurrentDirectory;
            if (RootDirectory.StartsWith(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)))
            {
                RootDirectory = AppDomain.CurrentDomain.BaseDirectory;
            }

            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            JsonConvert.DefaultSettings         = () => new JsonSerializerSettings {
                Culture = CultureInfo.InvariantCulture
            };

            // Create the commandline
            CommandLine = new CommandLine(Environment.GetCommandLineArgs());

            // Load the config
            var oxideConfig = Path.Combine(RootDirectory, "oxide.config.json");

            if (!File.Exists(oxideConfig))
            {
                throw new FileNotFoundException("Could not load the Oxide configuration file", oxideConfig);
            }
            Config = ConfigFile.Load <OxideConfig>(oxideConfig);
            Config.Save();

            // Work out the instance directory
            for (var i = 0; i < Config.InstanceCommandLines.Length; i++)
            {
                string varname, format;
                Config.GetInstanceCommandLineArg(i, out varname, out format);
                if (string.IsNullOrEmpty(varname) || CommandLine.HasVariable(varname))
                {
                    InstanceDirectory = Path.Combine(RootDirectory, Utility.CleanPath(string.Format(format, CommandLine.GetVariable(varname))));
                    break;
                }
            }
            if (InstanceDirectory == null)
            {
                throw new Exception("Could not identify instance directory");
            }

            // Clean and set directory paths
            ExtensionDirectory = Path.Combine(RootDirectory, Utility.CleanPath(Config.ExtensionDirectory));
            PluginDirectory    = Path.Combine(InstanceDirectory, Utility.CleanPath("plugins"));
            DataDirectory      = Path.Combine(InstanceDirectory, Utility.CleanPath("data"));
            LangDirectory      = Path.Combine(InstanceDirectory, Utility.CleanPath("lang"));
            LogDirectory       = Path.Combine(InstanceDirectory, Utility.CleanPath("logs"));
            ConfigDirectory    = Path.Combine(InstanceDirectory, Utility.CleanPath(Config.ConfigDirectory));

            // Create directories if needed
            if (!Directory.Exists(ExtensionDirectory))
            {
                throw new Exception("Could not identify extension directory");
            }
            if (!Directory.Exists(InstanceDirectory))
            {
                Directory.CreateDirectory(InstanceDirectory);
            }
            if (!Directory.Exists(PluginDirectory))
            {
                Directory.CreateDirectory(PluginDirectory);
            }
            if (!Directory.Exists(DataDirectory))
            {
                Directory.CreateDirectory(DataDirectory);
            }
            if (!Directory.Exists(LangDirectory))
            {
                Directory.CreateDirectory(LangDirectory);
            }
            if (!Directory.Exists(LogDirectory))
            {
                Directory.CreateDirectory(LogDirectory);
            }
            if (!Directory.Exists(ConfigDirectory))
            {
                Directory.CreateDirectory(ConfigDirectory);
            }

            // Register the library path
            RegisterLibrarySearchPath(Path.Combine(ExtensionDirectory, IntPtr.Size == 8 ? "x64" : "x86"));

            // Set the default group
            DefaultGroup = Config.DefaultGroup;

            // Create the loggers
            RootLogger = new CompoundLogger();
            RootLogger.AddLogger(new RotatingFileLogger {
                Directory = LogDirectory
            });
            if (debugCallback != null)
            {
                RootLogger.AddLogger(new CallbackLogger(debugCallback));
            }

            // Log Oxide core loading
            LogInfo("Loading Oxide Core v{0}...", Version);

            // Create the managers
            RootPluginManager = new PluginManager(RootLogger)
            {
                ConfigPath = ConfigDirectory
            };
            extensionManager = new ExtensionManager(RootLogger);

            // Initialize other things
            DataFileSystem = new DataFileSystem(DataDirectory);

            // Register core libraries
            extensionManager.RegisterLibrary("Covalence", covalence = new Covalence());
            extensionManager.RegisterLibrary("Global", new Global());
            extensionManager.RegisterLibrary("Lang", new Lang());
            extensionManager.RegisterLibrary("Permission", new Permission());
            extensionManager.RegisterLibrary("Plugins", new Libraries.Plugins(RootPluginManager));
            extensionManager.RegisterLibrary("Time", new Time());
            extensionManager.RegisterLibrary("Timer", libtimer = new Timer());
            extensionManager.RegisterLibrary("WebRequests", new WebRequests());

            // Load all extensions
            LogInfo("Loading extensions...");
            extensionManager.LoadAllExtensions(ExtensionDirectory);

            // Initialize covalence library after extensions (as it depends on things from within an ext)
            covalence.Initialize();

            // Remove old files
            Cleanup.Add(Path.Combine(Interface.Oxide.RootDirectory, "oxide.root.json"));
            Cleanup.Run();

            // If no clock has been defined, make our own unreliable clock
            if (getTimeSinceStartup == null)
            {
                timer = new Stopwatch();
                timer.Start();
                getTimeSinceStartup = () => (float)timer.Elapsed.TotalSeconds;
                LogWarning("A reliable clock is not available, falling back to a clock which may be unreliable on certain hardware");
            }

            // Load all watchers
            foreach (var ext in extensionManager.GetAllExtensions())
            {
                ext.LoadPluginWatchers(PluginDirectory);
            }

            // Load all plugins
            LogInfo("Loading plugins...");
            LoadAllPlugins(true);

            // Hook all watchers
            foreach (var watcher in extensionManager.GetPluginChangeWatchers())
            {
                watcher.OnPluginSourceChanged += watcher_OnPluginSourceChanged;
                watcher.OnPluginAdded         += watcher_OnPluginAdded;
                watcher.OnPluginRemoved       += watcher_OnPluginRemoved;
            }

            // Check for 'load' variable and warn
            if (CommandLine.HasVariable("load"))
            {
                LogWarning("The 'load' variable is unused and can be removed");
            }

            // Check for 'nolog' variable and warn
            if (CommandLine.HasVariable("nolog"))
            {
                LogWarning("Usage of the 'nolog' variable will prevent logging");
            }
        }
コード例 #5
0
ファイル: OxideMod.cs プロジェクト: rostov114/Oxide.Core
        /// <summary>
        /// Initializes a new instance of the OxideMod class
        /// </summary>
        public void Load()
        {
            RootDirectory = Environment.CurrentDirectory;
            if (RootDirectory.StartsWith(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)))
            {
                RootDirectory = AppDomain.CurrentDomain.BaseDirectory;
            }

            if (RootDirectory == null)
            {
                throw new Exception("RootDirectory is null");
            }

            InstanceDirectory = Path.Combine(RootDirectory, "oxide");
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            JsonConvert.DefaultSettings         = () => new JsonSerializerSettings {
                Culture = CultureInfo.InvariantCulture
            };
            CommandLine = new CommandLine(Environment.GetCommandLineArgs());

            if (CommandLine.HasVariable("oxide.directory"))
            {
                CommandLine.GetArgument("oxide.directory", out string var, out string format);
                if (string.IsNullOrEmpty(var) || CommandLine.HasVariable(var))
                {
                    InstanceDirectory = Path.Combine(RootDirectory, Utility.CleanPath(string.Format(format, CommandLine.GetVariable(var))));
                }
            }

            ExtensionDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            if (ExtensionDirectory == null || !Directory.Exists(ExtensionDirectory))
            {
                throw new Exception("Could not identify extension directory");
            }

            if (!Directory.Exists(InstanceDirectory))
            {
                Directory.CreateDirectory(InstanceDirectory);
            }

            ConfigDirectory = Path.Combine(InstanceDirectory, Utility.CleanPath("config"));
            if (!Directory.Exists(ConfigDirectory))
            {
                Directory.CreateDirectory(ConfigDirectory);
            }

            DataDirectory = Path.Combine(InstanceDirectory, Utility.CleanPath("data"));
            if (!Directory.Exists(DataDirectory))
            {
                Directory.CreateDirectory(DataDirectory);
            }

            LangDirectory = Path.Combine(InstanceDirectory, Utility.CleanPath("lang"));
            if (!Directory.Exists(LangDirectory))
            {
                Directory.CreateDirectory(LangDirectory);
            }

            LogDirectory = Path.Combine(InstanceDirectory, Utility.CleanPath("logs"));
            if (!Directory.Exists(LogDirectory))
            {
                Directory.CreateDirectory(LogDirectory);
            }

            PluginDirectory = Path.Combine(InstanceDirectory, Utility.CleanPath("plugins"));
            if (!Directory.Exists(PluginDirectory))
            {
                Directory.CreateDirectory(PluginDirectory);
            }

            RegisterLibrarySearchPath(Path.Combine(ExtensionDirectory, IntPtr.Size == 8 ? "x64" : "x86"));

            string config = Path.Combine(InstanceDirectory, "oxide.config.json");

            if (File.Exists(config))
            {
                Config = ConfigFile.Load <OxideConfig>(config);
            }
            else
            {
                Config = new OxideConfig(config);
                Config.Save();
            }

            if (CommandLine.HasVariable("web.ip"))
            {
                Config.Options.WebRequestIP = CommandLine.GetVariable("web.ip");
            }

            if (CommandLine.HasVariable("rcon.port"))
            {
                Config.Rcon.Port = Utility.GetNumbers(CommandLine.GetVariable("rcon.port"));
            }

            if (CommandLine.HasVariable("rcon.password"))
            {
                Config.Rcon.Password = CommandLine.GetVariable("rcon.password");
            }

            RootLogger = new CompoundLogger();
            RootLogger.AddLogger(new RotatingFileLogger {
                Directory = LogDirectory
            });
            if (debugCallback != null)
            {
                RootLogger.AddLogger(new CallbackLogger(debugCallback));
            }

            if (CommandLine.HasVariable("nolog"))
            {
                LogWarning("Usage of the 'nolog' variable will prevent logging");
            }

            LogInfo("Loading Oxide Core v{0}...", Version);

            RootPluginManager = new PluginManager(RootLogger)
            {
                ConfigPath = ConfigDirectory
            };
            extensionManager = new ExtensionManager(RootLogger);
            DataFileSystem   = new DataFileSystem(DataDirectory);

            extensionManager.RegisterLibrary("Covalence", covalence = new Covalence());
            extensionManager.RegisterLibrary("Global", new Global());
            extensionManager.RegisterLibrary("Lang", new Lang());
            extensionManager.RegisterLibrary("Permission", libperm = new Permission());
            extensionManager.RegisterLibrary("Plugins", new Libraries.Plugins(RootPluginManager));
            extensionManager.RegisterLibrary("Time", new Time());
            extensionManager.RegisterLibrary("Timer", libtimer = new Timer());
            extensionManager.RegisterLibrary("WebRequests", new WebRequests());

            LogInfo("Loading extensions...");
            extensionManager.LoadAllExtensions(ExtensionDirectory);

            Cleanup.Run();
            covalence.Initialize();
            RemoteConsole = new RemoteConsole.RemoteConsole();
            RemoteConsole?.Initalize();

            if (getTimeSinceStartup == null)
            {
                timer = new Stopwatch();
                timer.Start();
                getTimeSinceStartup = () => (float)timer.Elapsed.TotalSeconds;
                LogWarning("A reliable clock is not available, falling back to a clock which may be unreliable on certain hardware");
            }

            foreach (Extension ext in extensionManager.GetAllExtensions())
            {
                ext.LoadPluginWatchers(PluginDirectory);
            }

            LogInfo("Loading plugins...");
            LoadAllPlugins(true);

            foreach (PluginChangeWatcher watcher in extensionManager.GetPluginChangeWatchers())
            {
                watcher.OnPluginSourceChanged += watcher_OnPluginSourceChanged;
                watcher.OnPluginAdded         += watcher_OnPluginAdded;
                watcher.OnPluginRemoved       += watcher_OnPluginRemoved;
            }
        }
コード例 #6
0
 void Init()
 {
     LoadConfig();
     CleanupConfig();
     MainTimer = Interface.GetMod().GetLibrary<Oxide.Core.Libraries.Timer>("Timer");
 }
コード例 #7
0
 void Init()
 {
     LoadConfig();
     CleanupConfig();
     MainTimer = Interface.GetMod().GetLibrary <Oxide.Core.Libraries.Timer>("Timer");
 }
コード例 #8
0
ファイル: OxideMod.cs プロジェクト: LordCherry/Oxide
        /// <summary>
        /// Initializes a new instance of the OxideMod class
        /// </summary>
        public void Load()
        {
            RootDirectory = Environment.CurrentDirectory;
            if (RootDirectory.StartsWith(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)))
            {
                RootDirectory = AppDomain.CurrentDomain.BaseDirectory;
            }

            // Create the commandline
            commandline = new CommandLine(Environment.GetCommandLineArgs());

            // Load the config
            var oxideConfig = Path.Combine(RootDirectory, "oxide.root.json");

            if (!File.Exists(oxideConfig))
            {
                throw new FileNotFoundException("Could not load Oxide root configuration", oxideConfig);
            }
            rootconfig = ConfigFile.Load <OxideConfig>(oxideConfig);

            // Work out the instance directory
            for (int i = 0; i < rootconfig.InstanceCommandLines.Length; i++)
            {
                string varname, format;
                rootconfig.GetInstanceCommandLineArg(i, out varname, out format);
                if (string.IsNullOrEmpty(varname) || commandline.HasVariable(varname))
                {
                    InstanceDirectory = Path.Combine(RootDirectory, CleanPath(string.Format(format, commandline.GetVariable(varname))));
                    break;
                }
            }
            if (InstanceDirectory == null)
            {
                throw new Exception("Could not identify instance directory");
            }
            ExtensionDirectory = Path.Combine(RootDirectory, CleanPath(rootconfig.ExtensionDirectory));
            PluginDirectory    = Path.Combine(InstanceDirectory, CleanPath(rootconfig.PluginDirectory));
            DataDirectory      = Path.Combine(InstanceDirectory, CleanPath(rootconfig.DataDirectory));
            LangDirectory      = Path.Combine(InstanceDirectory, CleanPath(rootconfig.LangDirectory));
            LogDirectory       = Path.Combine(InstanceDirectory, CleanPath(rootconfig.LogDirectory));
            ConfigDirectory    = Path.Combine(InstanceDirectory, CleanPath(rootconfig.ConfigDirectory));
            if (!Directory.Exists(ExtensionDirectory))
            {
                throw new Exception("Could not identify extension directory");
            }
            if (!Directory.Exists(InstanceDirectory))
            {
                Directory.CreateDirectory(InstanceDirectory);
            }
            if (!Directory.Exists(PluginDirectory))
            {
                Directory.CreateDirectory(PluginDirectory);
            }
            if (!Directory.Exists(DataDirectory))
            {
                Directory.CreateDirectory(DataDirectory);
            }
            if (!Directory.Exists(LangDirectory))
            {
                Directory.CreateDirectory(LangDirectory);
            }
            if (!Directory.Exists(LogDirectory))
            {
                Directory.CreateDirectory(LogDirectory);
            }
            if (!Directory.Exists(ConfigDirectory))
            {
                Directory.CreateDirectory(ConfigDirectory);
            }

            RegisterLibrarySearchPath(Path.Combine(ExtensionDirectory, IntPtr.Size == 8 ? "x64" : "x86"));

            // Create the loggers
            RootLogger = new CompoundLogger();
            RootLogger.AddLogger(new RotatingFileLogger {
                Directory = LogDirectory
            });
            if (debugCallback != null)
            {
                RootLogger.AddLogger(new CallbackLogger(debugCallback));
            }

            // Log Oxide core loading
            LogInfo("Loading Oxide Core v{0}...", Version);

            // Create the managers
            RootPluginManager = new PluginManager(RootLogger)
            {
                ConfigPath = ConfigDirectory
            };
            extensionmanager = new ExtensionManager(RootLogger);

            // Initialize other things
            DataFileSystem = new DataFileSystem(DataDirectory);

            // Register core libraries
            extensionmanager.RegisterLibrary("Global", new Global());
            extensionmanager.RegisterLibrary("Time", new Time());
            extensionmanager.RegisterLibrary("Timer", libtimer = new Timer());
            extensionmanager.RegisterLibrary("Permission", new Permission());
            extensionmanager.RegisterLibrary("Plugins", new Libraries.Plugins(RootPluginManager));
            extensionmanager.RegisterLibrary("WebRequests", new WebRequests());
            extensionmanager.RegisterLibrary("Lang", new Lang());
            extensionmanager.RegisterLibrary("Covalence", covalence = new Covalence());

            // Load all extensions
            LogInfo("Loading extensions...");
            extensionmanager.LoadAllExtensions(ExtensionDirectory);

            // Remove old files
            Cleanup.Run();

            // Initialize covalence library after extensions (as it depends on things from within an ext)
            covalence.Initialize();

            // If no clock has been defined, make our own
            if (getTimeSinceStartup == null)
            {
                timer = new Stopwatch();
                timer.Start();
                getTimeSinceStartup = () => (float)timer.Elapsed.TotalSeconds;
            }

            // Load all watchers
            foreach (var ext in extensionmanager.GetAllExtensions())
            {
                ext.LoadPluginWatchers(PluginDirectory);
            }

            // Load all plugins
            LogInfo("Loading plugins...");
            LoadAllPlugins();

            // Hook all watchers
            foreach (var watcher in extensionmanager.GetPluginChangeWatchers())
            {
                watcher.OnPluginSourceChanged += watcher_OnPluginSourceChanged;
                watcher.OnPluginAdded         += watcher_OnPluginAdded;
                watcher.OnPluginRemoved       += watcher_OnPluginRemoved;
            }
        }
コード例 #9
0
 static CompilableFile()
 {
     CompilableFile.timer       = Interface.Oxide.GetLibrary <Oxide.Core.Libraries.Timer>(null);
     CompilableFile.compileLock = new object();
 }
コード例 #10
0
        public void Load()
        {
            string str;
            string str1;

            this.RootDirectory = Environment.CurrentDirectory;
            if (this.RootDirectory.StartsWith(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)))
            {
                this.RootDirectory = AppDomain.CurrentDomain.BaseDirectory;
            }
            if (this.RootDirectory == null)
            {
                throw new Exception("RootDirectory is null");
            }
            this.InstanceDirectory = Path.Combine(this.RootDirectory, "oxide");
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            JsonConvert.DefaultSettings         = () => new JsonSerializerSettings()
            {
                Culture = CultureInfo.InvariantCulture
            };
            this.CommandLine = new Oxide.Core.CommandLine(Environment.GetCommandLineArgs());
            if (this.CommandLine.HasVariable("oxide.directory"))
            {
                this.CommandLine.GetArgument("oxide.directory", out str, out str1);
                if (string.IsNullOrEmpty(str) || this.CommandLine.HasVariable(str))
                {
                    this.InstanceDirectory = Path.Combine(this.RootDirectory, Utility.CleanPath(string.Format(str1, this.CommandLine.GetVariable(str))));
                }
            }
            this.ExtensionDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            if (this.ExtensionDirectory == null || !Directory.Exists(this.ExtensionDirectory))
            {
                throw new Exception("Could not identify extension directory");
            }
            if (!Directory.Exists(this.InstanceDirectory))
            {
                Directory.CreateDirectory(this.InstanceDirectory);
            }
            this.ConfigDirectory = Path.Combine(this.InstanceDirectory, Utility.CleanPath("config"));
            if (!Directory.Exists(this.ConfigDirectory))
            {
                Directory.CreateDirectory(this.ConfigDirectory);
            }
            this.DataDirectory = Path.Combine(this.InstanceDirectory, Utility.CleanPath("data"));
            if (!Directory.Exists(this.DataDirectory))
            {
                Directory.CreateDirectory(this.DataDirectory);
            }
            this.LangDirectory = Path.Combine(this.InstanceDirectory, Utility.CleanPath("lang"));
            if (!Directory.Exists(this.LangDirectory))
            {
                Directory.CreateDirectory(this.LangDirectory);
            }
            this.LogDirectory = Path.Combine(this.InstanceDirectory, Utility.CleanPath("logs"));
            if (!Directory.Exists(this.LogDirectory))
            {
                Directory.CreateDirectory(this.LogDirectory);
            }
            this.PluginDirectory = Path.Combine(this.InstanceDirectory, Utility.CleanPath("plugins"));
            if (!Directory.Exists(this.PluginDirectory))
            {
                Directory.CreateDirectory(this.PluginDirectory);
            }
            OxideMod.RegisterLibrarySearchPath(Path.Combine(this.ExtensionDirectory, (IntPtr.Size == 8 ? "x64" : "x86")));
            string str2 = Path.Combine(this.InstanceDirectory, "oxide.config.json");

            if (!File.Exists(str2))
            {
                this.Config = new OxideConfig(str2);
                this.Config.Save(null);
            }
            else
            {
                this.Config = ConfigFile.Load <OxideConfig>(str2);
            }
            if (this.CommandLine.HasVariable("nolog"))
            {
                this.LogWarning("Usage of the 'nolog' variable will prevent logging", Array.Empty <object>());
            }
            if (this.CommandLine.HasVariable("rcon.port"))
            {
                this.Config.Rcon.Port = Utility.GetNumbers(this.CommandLine.GetVariable("rcon.port"));
            }
            if (this.CommandLine.HasVariable("rcon.password"))
            {
                this.Config.Rcon.Password = this.CommandLine.GetVariable("rcon.password");
            }
            this.RootLogger = new CompoundLogger();
            this.RootLogger.AddLogger(new RotatingFileLogger()
            {
                Directory = this.LogDirectory
            });
            if (this.debugCallback != null)
            {
                this.RootLogger.AddLogger(new CallbackLogger(this.debugCallback));
            }
            this.LogInfo("Loading Oxide Core v{0}...", new object[] { OxideMod.Version });
            this.RootPluginManager = new PluginManager(this.RootLogger)
            {
                ConfigPath = this.ConfigDirectory
            };
            this.extensionManager = new ExtensionManager(this.RootLogger);
            this.DataFileSystem   = new Oxide.Core.DataFileSystem(this.DataDirectory);
            ExtensionManager extensionManager = this.extensionManager;
            Covalence        covalence        = new Covalence();
            Covalence        covalence1       = covalence;

            this.covalence = covalence;
            extensionManager.RegisterLibrary("Covalence", covalence1);
            this.extensionManager.RegisterLibrary("Global", new Global());
            this.extensionManager.RegisterLibrary("Lang", new Lang());
            ExtensionManager extensionManager1 = this.extensionManager;
            Permission       permission        = new Permission();
            Permission       permission1       = permission;

            this.libperm = permission;
            extensionManager1.RegisterLibrary("Permission", permission1);
            this.extensionManager.RegisterLibrary("Plugins", new Oxide.Core.Libraries.Plugins(this.RootPluginManager));
            this.extensionManager.RegisterLibrary("Time", new Time());
            ExtensionManager extensionManager2 = this.extensionManager;

            Oxide.Core.Libraries.Timer timer  = new Oxide.Core.Libraries.Timer();
            Oxide.Core.Libraries.Timer timer1 = timer;
            this.libtimer = timer;
            extensionManager2.RegisterLibrary("Timer", timer1);
            this.extensionManager.RegisterLibrary("WebRequests", new WebRequests());
            this.LogInfo("Loading extensions...", Array.Empty <object>());
            this.extensionManager.LoadAllExtensions(this.ExtensionDirectory);
            Cleanup.Run();
            this.covalence.Initialize();
            this.RemoteConsole = new Oxide.Core.RemoteConsole.RemoteConsole();
            Oxide.Core.RemoteConsole.RemoteConsole remoteConsole = this.RemoteConsole;
            if (remoteConsole != null)
            {
                remoteConsole.Initalize();
            }
            else
            {
            }
            if (this.getTimeSinceStartup == null)
            {
                this.timer = new Stopwatch();
                this.timer.Start();
                this.getTimeSinceStartup = () => (float)this.timer.Elapsed.TotalSeconds;
                this.LogWarning("A reliable clock is not available, falling back to a clock which may be unreliable on certain hardware", Array.Empty <object>());
            }
            foreach (Extension allExtension in this.extensionManager.GetAllExtensions())
            {
                allExtension.LoadPluginWatchers(this.PluginDirectory);
            }
            this.LogInfo("Loading plugins...", Array.Empty <object>());
            this.LoadAllPlugins(true);
            foreach (PluginChangeWatcher pluginChangeWatcher in this.extensionManager.GetPluginChangeWatchers())
            {
                pluginChangeWatcher.OnPluginSourceChanged += new PluginChangeEvent(this.watcher_OnPluginSourceChanged);
                pluginChangeWatcher.OnPluginAdded         += new PluginAddEvent(this.watcher_OnPluginAdded);
                pluginChangeWatcher.OnPluginRemoved       += new PluginRemoveEvent(this.watcher_OnPluginRemoved);
            }
        }