Exemplo n.º 1
0
        /// <summary>
        /// Loads all resources into the server instance.
        /// </summary>
        /// <param name="rootdir">Directory of the server</param>
        /// <param name="prop">Server Properties</param>
        public void Load(String rootdir, ServerProperties prop)
        {
            if (Loaded)
            {
                LogOutput("Server is already loaded!", this.ID);
            }
            try {
                Properties     = prop;
                RootDirectory += rootdir;
                Loaded         = true;

                //Restart timer will only react in 5 seconds.
                _restartTimer.Interval = 5000;
                _restartTimer.Elapsed += _restartTimer_Elapsed;
            } catch (Exception e) {
                //not the best solution as of now, but it will do.
                //ReportError(e, this.ID);
                throw e;
            }
        }
Exemplo n.º 2
0
        public void Unload(Boolean force = false)
        {
            if (!Loaded)
            {
                ErrorOutput("Server is not loaded!", this.ID);
            }

            //If Running, check if you want to force the server to close, THIS WILL ALWAYS KILL THE SERVER!
            if (IsRunning)
            {
                if (!force)
                {
                    return;
                }
                else
                {
                    Shutdown(true);
                }
            }
            //Lets start fresh
            Loaded     = false;
            Properties = new ServerProperties();
        }