Exemplo n.º 1
0
 public static object Create(
     KnownException knownError,
     string correlationId)
 {
     return(new
     {
         CorrelationId = correlationId,
         knownError.ErrorCode,
         Data = knownError.GetData(),
         Error = knownError.ToString()
     });
 }
Exemplo n.º 2
0
            /// <summary>
            /// Loads the current configuration synchronously.
            /// </summary>
            public ConfigT Load(bool silent = false)
            {
                ConfigT        cfg           = null;
                KnownException loadException = null;

                if (!SaveInProgress)
                {
                    SaveInProgress = true;

                    if (!silent)
                    {
                        ExceptionHandler.SendChatMessage("Loading configuration...");
                    }

                    if (cfgFile.FileExists)
                    {
                        loadException = TryLoad(out cfg);
                        cfg           = ValidateConfig(cfg);
                    }
                    else
                    {
                        cfg = Defaults;
                    }

                    TrySave(cfg);

                    if (loadException != null)
                    {
                        ExceptionHandler.WriteToLog(loadException.ToString());
                    }
                    else if (!silent)
                    {
                        ExceptionHandler.SendChatMessage("Configuration loaded.");
                    }
                }
                else
                {
                    ExceptionHandler.SendChatMessage("Save operation already in progress.");
                }

                SaveInProgress = false;
                return(cfg);
            }