commit
5c158db4de
|
@ -165,12 +165,12 @@ namespace StardewModdingAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Re-reads the json blob on the disk and merges its values with a default config
|
/// Re-reads the json blob on the disk and merges its values with a default config.
|
||||||
/// NOTE: You MUST set your config EQUAL to the return of this method!
|
/// NOTE: You MUST set your config EQUAL to the return of this method!
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static T ReloadConfig<T>(this T baseConfig) where T : Config
|
public static T ReloadConfig<T>(this T baseConfig) where T : Config
|
||||||
{
|
{
|
||||||
return baseConfig.UpdateConfig<T>();
|
return baseConfig.LoadConfig<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,8 +12,6 @@ namespace StardewModdingAPI.Events
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static event EventHandler Resize = delegate { };
|
public static event EventHandler Resize = delegate { };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Occurs before anything is drawn.
|
/// Occurs before anything is drawn.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -87,7 +85,10 @@ namespace StardewModdingAPI.Events
|
||||||
OnPostRenderEvent.Invoke(sender, e);
|
OnPostRenderEvent.Invoke(sender, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static void InvokeResize(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Resize.Invoke(sender, e);
|
||||||
|
}
|
||||||
|
|
||||||
#region To Remove
|
#region To Remove
|
||||||
|
|
||||||
|
@ -116,12 +117,6 @@ namespace StardewModdingAPI.Events
|
||||||
DrawInRenderTargetTick.Invoke(null, EventArgs.Empty);
|
DrawInRenderTargetTick.Invoke(null, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("Should not be used.")]
|
|
||||||
public static void InvokeResize(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
Resize.Invoke(sender, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1245,6 +1245,8 @@ namespace StardewModdingAPI.Inheritance
|
||||||
{
|
{
|
||||||
farmEvent?.drawAboveEverything(spriteBatch);
|
farmEvent?.drawAboveEverything(spriteBatch);
|
||||||
}
|
}
|
||||||
|
GraphicsEvents.InvokeDrawTick();
|
||||||
|
GraphicsEvents.InvokeDrawInRenderTargetTick();
|
||||||
GraphicsEvents.InvokeOnPostRenderEvent(null, EventArgs.Empty);
|
GraphicsEvents.InvokeOnPostRenderEvent(null, EventArgs.Empty);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
if (!ZoomLevelIsOne)
|
if (!ZoomLevelIsOne)
|
||||||
|
|
|
@ -21,19 +21,7 @@ namespace StardewModdingAPI
|
||||||
_writer.WriteToLog(li);
|
_writer.WriteToLog(li);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Sync Logging
|
#region Exception Logging
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// NOTICE: Sync logging is discouraged. Please use Async instead.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="message">Message to log</param>
|
|
||||||
/// <param name="colour">Colour of message</param>
|
|
||||||
public static void SyncColour(object message, ConsoleColor colour)
|
|
||||||
{
|
|
||||||
PrintLog(new LogInfo(message?.ToString(), colour));
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Catch unhandled exception from the application
|
/// Catch unhandled exception from the application
|
||||||
|
@ -55,6 +43,22 @@ namespace StardewModdingAPI
|
||||||
File.WriteAllText(Constants.LogDir + "\\MODDED_ErrorLog.Log_" + Extensions.Random.Next(100000000, 999999999) + ".txt", e.Exception.ToString());
|
File.WriteAllText(Constants.LogDir + "\\MODDED_ErrorLog.Log_" + Extensions.Random.Next(100000000, 999999999) + ".txt", e.Exception.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Sync Logging
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// NOTICE: Sync logging is discouraged. Please use Async instead.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="message">Message to log</param>
|
||||||
|
/// <param name="colour">Colour of message</param>
|
||||||
|
public static void SyncColour(object message, ConsoleColor colour)
|
||||||
|
{
|
||||||
|
PrintLog(new LogInfo(message?.ToString(), colour));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region Async Logging
|
#region Async Logging
|
||||||
|
|
||||||
public static void AsyncColour(object message, ConsoleColor colour)
|
public static void AsyncColour(object message, ConsoleColor colour)
|
||||||
|
@ -97,6 +101,26 @@ namespace StardewModdingAPI
|
||||||
AsyncColour(message?.ToString(), ConsoleColor.Magenta);
|
AsyncColour(message?.ToString(), ConsoleColor.Magenta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void Error(object message)
|
||||||
|
{
|
||||||
|
AsyncR("[ERROR] " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Success(object message)
|
||||||
|
{
|
||||||
|
AsyncG("[SUCCESS] " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Info(object message)
|
||||||
|
{
|
||||||
|
AsyncY("[INFO] " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void Out(object message)
|
||||||
|
{
|
||||||
|
Async("[OUT] " + message);
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ToRemove
|
#region ToRemove
|
||||||
|
@ -157,7 +181,7 @@ namespace StardewModdingAPI
|
||||||
}
|
}
|
||||||
|
|
||||||
[Obsolete("Parameter 'values' is no longer supported. Format before logging.")]
|
[Obsolete("Parameter 'values' is no longer supported. Format before logging.")]
|
||||||
public static void AsyncR(object message, params object[] values)
|
public static void Error(object message, params object[] values)
|
||||||
{
|
{
|
||||||
AsyncR(message);
|
AsyncR(message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue