ACR_ServerCommunicator.ACR_ServerCommunicator.SendInfrastructureDiagnosticIrcMessage C# (CSharp) Method

SendInfrastructureDiagnosticIrcMessage() public method

Send an infrastructure diagnostic notification message to the default IRC gateway and default error notify IRC recipient.
public SendInfrastructureDiagnosticIrcMessage ( string Message ) : void
Message string Supplies the message to send.
return void
        public void SendInfrastructureDiagnosticIrcMessage(string Message)
        {
            string Recipient = WorldManager.Configuration.ErrorNotifyIrcRecipient;

            if (String.IsNullOrEmpty(Recipient))
            {
                return;
            }

            SendIrcMessage(WorldManager.Configuration.DefaultIrcGatewayId,
                Recipient,
                OBJECT_INVALID,
                Message);
        }

Usage Example

Example #1
0
        /// <summary>
        /// Recompile all scripts in the module.
        /// </summary>
        /// <param name="Script">Supplies the main script object.</param>
        /// <param name="Database">Supplies the database connection.</param>
        private static void CompileModuleScripts(ACR_ServerCommunicator Script, ALFA.Database Database)
        {
            ALFA.ScriptCompiler.CompilerResult Result;
            string        CompilerOptions = Script.GetLocalString(Script.GetModule(), "ACR_MOD_COMPILER_OPTIONS");
            List <string> CompilerOutput  = new List <string>();

            Script.WriteTimestampedLogEntry(String.Format(
                                                "ModuleContentPatcher.CompileModuleScripts: Compiling module scripts with compiler options '{0}'...", CompilerOptions));
            Script.SendInfrastructureDiagnosticIrcMessage(String.Format(
                                                              "Server '{0}' is recompiling module scripts.",
                                                              Script.GetName(Script.GetModule())));

            Result = ALFA.ScriptCompiler.CompileScript("*.nss", CompilerOptions, delegate(string Line)
            {
                if (!String.IsNullOrWhiteSpace(Line))
                {
                    Script.WriteTimestampedLogEntry(Line);
                }
                return(false);
            });

            foreach (string Message in Result.Warnings)
            {
                try
                {
                    CompilerOutput.Add(Message);
                }
                catch (Exception)
                {
                }
            }

            if (Result.Compiled)
            {
                Script.WriteTimestampedLogEntry("ModuleContentPatcher.CompileModuleScripts: Module successfully recompiled.");
                Database.ACR_IncrementStatistic("CONTENT_PATCH_RECOMPILE");

                Script.SendInfrastructureDiagnosticIrcMessage(String.Format(
                                                                  "Server '{0}' successfully recompiled module with {1} warning(s) for content patch deployment.",
                                                                  Script.GetName(Script.GetModule()),
                                                                  Result.Warnings.Count));
            }
            else
            {
                Script.WriteTimestampedLogEntry(String.Format(
                                                    "ModuleContentPatcher.CompileModuleScripts: {0} error(s) compiling module!", Result.Errors.Count));

                Script.SendInfrastructureDiagnosticIrcMessage(String.Format(
                                                                  "Server '{0}' had {1} error(s), {2} warning(s) recompiling module for content patch deployment.",
                                                                  Script.GetName(Script.GetModule()),
                                                                  Result.Errors.Count,
                                                                  Result.Warnings.Count));

                foreach (string Message in Result.Errors)
                {
                    Script.WriteTimestampedLogEntry(String.Format(
                                                        "ModuleContentPatcher.CompileModuleScripts: Error '{0}'.", Message));

                    try
                    {
                        CompilerOutput.Add(Message);
                    }
                    catch (Exception)
                    {
                    }
                }

                Database.ACR_IncrementStatistic("CONTENT_PATCH_RECOMPILE_FAILED");
            }

            //
            // Save compiler output to a temporary file for later retrieval.
            //

            try
            {
                string FileName = String.Format("{0}{1}ALFAModuleRecompile.log", Path.GetTempPath(), Path.DirectorySeparatorChar);

                File.WriteAllLines(FileName, CompilerOutput);
            }
            catch (Exception)
            {
            }
        }
All Usage Examples Of ACR_ServerCommunicator.ACR_ServerCommunicator::SendInfrastructureDiagnosticIrcMessage
ACR_ServerCommunicator