Exemple #1
0
        /// <summary>
        ///     Load all tabpages to the mainform
        /// </summary>
        private void LoadTabs()
        {
            if (!AddonManager.AddonsLoaded)
            {
                AddonManager.LoadAddons();
            }

            foreach (
                KeyValuePair <IAddon, UserControl> pair in
                AddonManager.TabsDictionary.OrderBy(i => GetTabDisplayId(i.Key.Name)))
            {
                // Create a new tabpage. We'll dock the control to fill the tabpage
                TabPage tp = new TabPage(pair.Key.Name)
                {
                    Name = pair.Key.Name
                };
                // Add and dock the control
                tp.Controls.Add(pair.Value);
                tp.Controls[0].Dock = DockStyle.Fill;

                // Add the tabpage
                TabCtrlAddons.TabPages.Add(tp);

                Logger.Log(LogLevel.Info, "mainform", "added addon tabpage", pair.Key.Name);
            }
            AddonManager.GetRequiredAddon(RequiredAddon.Settings).Initialize();
        }
Exemple #2
0
        public ConsoleServerManager(
            NetServer netServer,
            GameSettings gameSettings,
            PacketManager packetManager
            ) : base(netServer, gameSettings, packetManager)
        {
            // Start loading addons
            AddonManager.LoadAddons();

            // Register a callback for when the application is closed to stop the server
            AppDomain.CurrentDomain.ProcessExit += (sender, args) => {
                if (Environment.ExitCode == 5)
                {
                    return;
                }

                Stop();
            };
        }