Beispiel #1
0
        /// <summary>
        /// Logs the specified game to the destinations specified in the config file
        /// </summary>
        /// <param name="game">The gamedata to log</param>
        /// <param name="gameID">ASGS's ID of this game</param>
        public static void LogGame(GameData game, int gameID)
        {
            GameDataset Data    = game.GetDataset();
            string      DataXml = Data.GetXml();

            XmlLogger.LogGame(game, gameID);
        }
Beispiel #2
0
        /// <summary>
        /// Posts the specified game to ASGS, and logs it
        /// </summary>
        /// <param name="data">The data to post</param>
        public static void PostGame(object data)
        {
            // Unpackage and prepare data
            GameData    Data          = (GameData)data;
            GameDataset Set           = Data.GetDataset();
            string      Xml           = Set.GetXml();
            string      CompressedXml = Compression.Compress(Xml);

            TagTrace.WriteLine(TraceLevel.Verbose, "Game data ready to post. Sending to stats server...");
            TagTrace.WriteLine(TraceLevel.Verbose, "Use CSS: " + CssConnector.UseCss + ", CSS Url: " + CssConnector.CssUrl);

            // Post game to ASGS
            string PostMessage;
            int    GameID;

            if (CssConnector.UseCss == true)
            {
                GameID = CssConnector.PostGame(CompressedXml, out PostMessage);
            }
            else
            {
                GameID = AsgsConnector.PostGame(CompressedXml, out PostMessage);
            }

            TagTrace.WriteLine(TraceLevel.Info, "Game #{0} Posted: {1}", GameID, PostMessage);

            // Post message to all servers
            GameServer.SendChat(PostMessage);

            // Log games as configured
            XmlLogger.LogGame(Data, GameID);

            // Get rid of this GameData since we no longer need it
            Data.Dispose();
            TagTrace.WriteLine(TraceLevel.Verbose, "Game data disposed");

            // If no games are in progress...
            if (TagUpdate.IsAbleToUpdate())
            {
                TagTrace.WriteLine(TraceLevel.Verbose, "TAG is able to update. No games are in progress");
                // And an update is available...
                if (TagUpdate.UpdateAvailable())
                {
                    TagUpdate.InitiateUpdate();                         // Update!
                }
            }
        }