コード例 #1
0
        /// <summary>
        /// Create a logger using the given filename.
        /// </summary>
        /// <param name="filename">Name of the log file.</param>
        /// <returns>True if the logger was successfully created; false otherwise.</returns>
        public static bool CreateLogger(string filename)
        {
            if (Logger != null)
            {
                throw new InvalidOperationException(
                          "Cannot create two instances of the logger.");
            }

            try
            {
                Logger = new Client.src.service.services.Logger(filename);
                Logger.Info("Started client up at {0}", DateTime.Now);
                return(true);
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("[ERROR] Cannot log messages: {0}", ex);
            }

            return(false);
        }
コード例 #2
0
        /// <summary>
        /// Create a logger using the given filename.
        /// </summary>
        /// <param name="filename">Name of the log file.</param>
        /// <returns>True if the logger was successfully created; false otherwise.</returns>
        public static bool CreateLogger(string filename)
        {
            if (Logger != null)
            {
                throw new InvalidOperationException(
                    "Cannot create two instances of the logger.");
            }

            try
            {
                Logger = new Client.src.service.services.Logger(filename);
                Logger.Info("Started client up at {0}", DateTime.Now);
                return true;
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine("[ERROR] Cannot log messages: {0}", ex);
            }

            return false;
        }
コード例 #3
0
        /// <summary>
        /// Stop all services and dispose of them. This should be called once before the game
        /// exits. It can be called repeatedly to destroy re-created resources.
        /// </summary>
        public static void StopAllServices()
        {
            try
            {
                Game.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Game = null;
            }

            try
            {
                Resources.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Resources = null;
            }

            StateManager = null;
            try
            {
                Echelon.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Echelon = null;
            }

            try
            {
                Theater.Dispose();
            }
            catch (Exception) { }
            finally
            {
                Theater = null;
            }

            try
            {
                AudioManager.Dispose();
            }
            catch (Exception) { }
            finally
            {
                AudioManager = null;
            }

            try
            {
                MP3Player.Dispose();
            }
            catch (Exception) { }
            finally
            {
                MP3Player = null;
            }

            try
            {
                Logger.Close();
            }
            catch (Exception) { }
            finally
            {
                Logger = null;
            }
        }