Beispiel #1
0
        protected ServerAssemblyWrapper()
        {
            m_instance = this;

            m_assembly = Assembly.UnsafeLoadFrom("SpaceEngineersDedicated.exe");

            Console.WriteLine("Finished loading ServerAssemblyWrapper");
        }
        protected ServerAssemblyWrapper()
        {
            m_instance = this;

            m_assembly = Assembly.UnsafeLoadFrom("SpaceEngineersDedicated.exe");

            Console.WriteLine("Finished loading ServerAssemblyWrapper");
        }
		protected ServerAssemblyWrapper()
		{
			m_instance = this;

			string assemblyPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SpaceEngineersDedicated.exe");
			m_assembly = Assembly.UnsafeLoadFrom(assemblyPath);

			Console.WriteLine("Finished loading ServerAssemblyWrapper");
		}
Beispiel #4
0
        protected ServerAssemblyWrapper()
        {
            m_instance = this;

            string assemblyPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SpaceEngineersDedicated.exe");

            m_assembly = Assembly.UnsafeLoadFrom(assemblyPath);

            Console.WriteLine("Finished loading ServerAssemblyWrapper");
        }
        /// <exception cref="SecurityException">A codebase that does not start with "file://" was specified without the required <see cref="T:System.Net.WebPermission" />. </exception>
        /// <exception cref="BadImageFormatException">Not a valid assembly. -or- assembly was compiled with a later version of the common language runtime than the version that is currently loaded.</exception>
        /// <exception cref="FileLoadException">A file that was found could not be loaded. </exception>
        /// <exception cref="FileNotFoundException">Assembly is not found, or the module you are trying to load does not specify a filename extension. </exception>
        /// <exception cref="PathTooLongException">The assembly name is longer than MAX_PATH characters.</exception>
        /// <exception cref="AppDomainUnloadedException">The operation is attempted on an unloaded application domain. </exception>
        protected ServerAssemblyWrapper( )
        {
            _instance = this;

            string assemblyPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SpaceEngineersDedicated.exe");

            _assembly = Assembly.UnsafeLoadFrom(assemblyPath);

            ApplicationLog.BaseLog.Info("Finished loading ServerAssemblyWrapper");
        }
		protected ServerAssemblyWrapper( )
		{
			m_instance = this;

			string assemblyPath = Path.Combine( AppDomain.CurrentDomain.BaseDirectory, "SpaceEngineersDedicated.exe" );
			m_assembly = Assembly.UnsafeLoadFrom( assemblyPath );

			/*
			byte[] b = File.ReadAllBytes(assemblyPath);
			Assembly rawServerAssembly = Assembly.Load(b);
			m_domain = AppDomain.CreateDomain("Server Domain");
			m_assembly = m_domain.Load(rawServerAssembly.GetName());
			*/

			Console.WriteLine( "Finished loading ServerAssemblyWrapper" );
		}
Beispiel #7
0
        protected ServerAssemblyWrapper( )
        {
            m_instance = this;

            string assemblyPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SpaceEngineersDedicated.exe");

            m_assembly = Assembly.UnsafeLoadFrom(assemblyPath);

            /*
             * byte[] b = File.ReadAllBytes(assemblyPath);
             * Assembly rawServerAssembly = Assembly.Load(b);
             * m_domain = AppDomain.CreateDomain("Server Domain");
             * m_assembly = m_domain.Load(rawServerAssembly.GetName());
             */

            Console.WriteLine("Finished loading ServerAssemblyWrapper");
        }
		private bool SetupManagers()
		{
			m_serverWrapper = ServerAssemblyWrapper.Instance;
			m_pluginManager = PluginManager.Instance;
			m_gameAssemblyWrapper = SandboxGameAssemblyWrapper.Instance;
			m_factionsManager = FactionsManager.Instance;
			m_logManager = LogManager.Instance;
			m_entityEventManager = EntityEventManager.Instance;
			m_chatManager = ChatManager.Instance;

			return true;
		}
Beispiel #9
0
		private void RunServer()
		{
			if ( _restartLimit < 0 )
				return;

			try
			{
				SandboxGameAssemblyWrapper.InstanceName = InstanceName;
				_serverWrapper = ServerAssemblyWrapper.Instance;
				bool result = _serverWrapper.StartServer( _commandLineArgs.InstanceName, _commandLineArgs.Path, !_commandLineArgs.NoConsole );
				Console.WriteLine("Server has stopped running");

				_isServerRunning = false;

				_pluginMainLoop.Stop( );
				_autosaveTimer.Stop( );

				_pluginManager.Shutdown( );

				if ( !result && _commandLineArgs.CloseOnCrash )
				{
					Thread.Sleep(5000);
					Environment.Exit(1);
				}

				if ( !result && _commandLineArgs.RestartOnCrash )
				{
					Thread.Sleep(5000);

					string restartText = "timeout /t 20\r\n";
					restartText += string.Format( "cd /d \"{0}\"\r\n", System.IO.Path.GetDirectoryName( Application.ExecutablePath ) );
					restartText += string.Format( "{0} {1}\r\n", System.IO.Path.GetFileName( Application.ExecutablePath ), _commandLineArgs.Args );

					File.WriteAllText("RestartApp.bat", restartText);
					Process.Start( "RestartApp.bat" );
					Environment.Exit(1);
				}

				/*
				if (!result)
				{
					LogManager.APILog.WriteLineAndConsole("Server crashed, attempting auto-restart ...");

					TimeSpan timeSinceLastRestart = DateTime.Now - m_lastRestart;

					//Reset the restart limit if the server has been running for more than 5 minutes before the crash
					if (timeSinceLastRestart.TotalMinutes > 5)
						_restartLimit = 3;

					_restartLimit--;

					_isServerRunning = true;
					SectorObjectManager.Instance.IsShutDown = false;

					_runServerThread = new Thread(new ThreadStart(this.RunServer));
					_runServerThread.Start();
				}*/
			}
			catch (Exception ex)
			{
				Console.WriteLine("Uncaught");
				LogManager.ErrorLog.WriteLine(ex);
			}
			finally
			{
				_serverWrapper = null;
			}
		}