minor cleanup

This commit is contained in:
Jesse Plamondon-Willard 2020-08-23 20:53:09 -04:00
parent 1ff4a0774e
commit c37280222d
No known key found for this signature in database
GPG Key ID: CF8B1456B3E29F49
21 changed files with 23 additions and 25 deletions

View File

@ -9,4 +9,4 @@
/// <summary>Remove SMAPI from the game directory.</summary> /// <summary>Remove SMAPI from the game directory.</summary>
Uninstall Uninstall
} }
} }

View File

@ -35,8 +35,6 @@ namespace StardewModdingApi.Installer
"SMAPI.ConsoleCommands" "SMAPI.ConsoleCommands"
}; };
/// <summary>Get the absolute file or folder paths to remove when uninstalling SMAPI.</summary> /// <summary>Get the absolute file or folder paths to remove when uninstalling SMAPI.</summary>
/// <param name="installDir">The folder for Stardew Valley and SMAPI.</param> /// <param name="installDir">The folder for Stardew Valley and SMAPI.</param>
/// <param name="modsDir">The folder for SMAPI mods.</param> /// <param name="modsDir">The folder for SMAPI mods.</param>
@ -84,6 +82,7 @@ namespace StardewModdingApi.Installer
foreach (DirectoryInfo modDir in modsDir.EnumerateDirectories()) foreach (DirectoryInfo modDir in modsDir.EnumerateDirectories())
yield return Path.Combine(modDir.FullName, ".cache"); // 1.41.7 yield return Path.Combine(modDir.FullName, ".cache"); // 1.41.7
} }
yield return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "ErrorLogs"); // remove old log files yield return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "ErrorLogs"); // remove old log files
} }

View File

@ -3,8 +3,6 @@ using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
using System.IO.Compression; using System.IO.Compression;
using System.Reflection; using System.Reflection;
using StardewModdingAPI.Internal;
using StardewModdingAPI.Toolkit.Utilities;
namespace StardewModdingApi.Installer namespace StardewModdingApi.Installer
{ {

View File

@ -12,4 +12,4 @@ namespace StardewModdingAPI.Events
/// <summary>The stack size changed.</summary> /// <summary>The stack size changed.</summary>
StackChange StackChange
} }
} }

View File

@ -22,7 +22,6 @@ namespace StardewModdingAPI.Events
public bool IsLocalPlayer => this.Player.IsLocalPlayer; public bool IsLocalPlayer => this.Player.IsLocalPlayer;
/********* /*********
** Public methods ** Public methods
*********/ *********/

View File

@ -119,6 +119,7 @@ namespace StardewModdingAPI.Framework
command.Callback.Invoke(name, arguments); command.Callback.Invoke(name, arguments);
return true; return true;
} }
return false; return false;
} }

View File

@ -9,7 +9,6 @@ using Microsoft.Xna.Framework.Content;
using StardewModdingAPI.Framework.Content; using StardewModdingAPI.Framework.Content;
using StardewModdingAPI.Framework.ContentManagers; using StardewModdingAPI.Framework.ContentManagers;
using StardewModdingAPI.Framework.Reflection; using StardewModdingAPI.Framework.Reflection;
using StardewModdingAPI.Framework.StateTracking.Comparers;
using StardewModdingAPI.Metadata; using StardewModdingAPI.Metadata;
using StardewModdingAPI.Toolkit.Serialization; using StardewModdingAPI.Toolkit.Serialization;
using StardewModdingAPI.Toolkit.Utilities; using StardewModdingAPI.Toolkit.Utilities;

View File

@ -76,7 +76,7 @@ namespace StardewModdingAPI.Framework.ContentManagers
/// <param name="onDisposing">A callback to invoke when the content manager is being disposed.</param> /// <param name="onDisposing">A callback to invoke when the content manager is being disposed.</param>
/// <param name="isNamespaced">Whether this content manager handles managed asset keys (e.g. to load assets from a mod folder).</param> /// <param name="isNamespaced">Whether this content manager handles managed asset keys (e.g. to load assets from a mod folder).</param>
protected BaseContentManager(string name, IServiceProvider serviceProvider, string rootDirectory, CultureInfo currentCulture, ContentCoordinator coordinator, IMonitor monitor, Reflector reflection, Action<BaseContentManager> onDisposing, bool isNamespaced) protected BaseContentManager(string name, IServiceProvider serviceProvider, string rootDirectory, CultureInfo currentCulture, ContentCoordinator coordinator, IMonitor monitor, Reflector reflection, Action<BaseContentManager> onDisposing, bool isNamespaced)
: base(serviceProvider, rootDirectory, currentCulture) : base(serviceProvider, rootDirectory, currentCulture)
{ {
// init // init
this.Name = name; this.Name = name;

View File

@ -12,4 +12,4 @@ namespace StardewModdingAPI.Framework
/// <summary>The code will be removed soon. Deprecation messages should be warnings in the console.</summary> /// <summary>The code will be removed soon. Deprecation messages should be warnings in the console.</summary>
PendingRemoval PendingRemoval
} }
} }

View File

@ -107,6 +107,7 @@ namespace StardewModdingAPI.Framework
} }
} }
} }
this.QueuedWarnings.Clear(); this.QueuedWarnings.Clear();
} }

View File

@ -96,7 +96,6 @@ namespace StardewModdingAPI.Framework.Events
/// <summary>Raised after the in-game clock time changes.</summary> /// <summary>Raised after the in-game clock time changes.</summary>
public event EventHandler<TimeChangedEventArgs> TimeChanged public event EventHandler<TimeChangedEventArgs> TimeChanged
{ {
add => this.EventManager.TimeChanged.Add(value, this.Mod); add => this.EventManager.TimeChanged.Add(value, this.Mod);
remove => this.EventManager.TimeChanged.Remove(value); remove => this.EventManager.TimeChanged.Remove(value);
} }

View File

@ -164,9 +164,9 @@ namespace StardewModdingAPI.Framework
// get field name // get field name
const string fieldName = const string fieldName =
#if SMAPI_FOR_WINDOWS #if SMAPI_FOR_WINDOWS
"inBeginEndPair"; "inBeginEndPair";
#else #else
"_beginCalled"; "_beginCalled";
#endif #endif
// get result // get result

View File

@ -2,7 +2,6 @@ using System;
using System.IO; using System.IO;
using StardewModdingAPI.Events; using StardewModdingAPI.Events;
using StardewModdingAPI.Framework.Input; using StardewModdingAPI.Framework.Input;
using StardewModdingAPI.Toolkit.Serialization;
namespace StardewModdingAPI.Framework.ModHelpers namespace StardewModdingAPI.Framework.ModHelpers
{ {

View File

@ -4,4 +4,4 @@ namespace StardewModdingAPI.Framework
/// <param name="module">The module which requested an immediate exit.</param> /// <param name="module">The module which requested an immediate exit.</param>
/// <param name="reason">The reason provided for the shutdown.</param> /// <param name="reason">The reason provided for the shutdown.</param>
internal delegate void RequestExitDelegate(string module, string reason); internal delegate void RequestExitDelegate(string module, string reason);
} }

View File

@ -43,7 +43,7 @@ using StardewModdingAPI.Toolkit.Serialization;
using StardewModdingAPI.Toolkit.Utilities; using StardewModdingAPI.Toolkit.Utilities;
using StardewModdingAPI.Utilities; using StardewModdingAPI.Utilities;
using StardewValley; using StardewValley;
using Object = StardewValley.Object; using SObject = StardewValley.Object;
namespace StardewModdingAPI.Framework namespace StardewModdingAPI.Framework
{ {
@ -524,6 +524,7 @@ namespace StardewModdingAPI.Framework
Game1.currentLoader = null; Game1.currentLoader = null;
this.Monitor.Log("Game loader done."); this.Monitor.Log("Game loader done.");
} }
if (SGame.NewDayTask?.Status == TaskStatus.Created) if (SGame.NewDayTask?.Status == TaskStatus.Created)
{ {
this.Monitor.Log("New day task synchronizing..."); this.Monitor.Log("New day task synchronizing...");
@ -605,7 +606,7 @@ namespace StardewModdingAPI.Framework
$"{modGroup.Key.DisplayName} (" $"{modGroup.Key.DisplayName} ("
+ string.Join(", ", modGroup.GroupBy(p => p.WasAdded).ToDictionary(p => p.Key, p => p.Count()).Select(p => $"{(p.Key ? "added" : "removed")} {p.Value}")) + string.Join(", ", modGroup.GroupBy(p => p.WasAdded).ToDictionary(p => p.Key, p => p.Count()).Select(p => $"{(p.Key ? "added" : "removed")} {p.Value}"))
+ ")" + ")"
) )
) )
); );
@ -700,6 +701,7 @@ namespace StardewModdingAPI.Framework
this.OnLoadStageChanged(LoadStage.CreatedSaveFile); this.OnLoadStageChanged(LoadStage.CreatedSaveFile);
events.SaveCreated.RaiseEmpty(); events.SaveCreated.RaiseEmpty();
} }
if (this.IsBetweenSaveEvents) if (this.IsBetweenSaveEvents)
{ {
// raise after-save // raise after-save
@ -731,6 +733,7 @@ namespace StardewModdingAPI.Framework
} }
else else
context += " Single-player."; context += " Single-player.";
this.Monitor.Log(context); this.Monitor.Log(context);
// raise events // raise events
@ -1111,7 +1114,7 @@ namespace StardewModdingAPI.Framework
// require core fields // require core fields
string[] fields = entry.Value.Split('/'); string[] fields = entry.Value.Split('/');
if (fields.Length < Object.objectInfoDescriptionIndex + 1) if (fields.Length < SObject.objectInfoDescriptionIndex + 1)
{ {
LogIssue(entry.Key, "too few fields for an object"); LogIssue(entry.Key, "too few fields for an object");
hasObjectIssues = true; hasObjectIssues = true;
@ -1119,10 +1122,10 @@ namespace StardewModdingAPI.Framework
} }
// check min length for specific types // check min length for specific types
switch (fields[Object.objectInfoTypeIndex].Split(new[] { ' ' }, 2)[0]) switch (fields[SObject.objectInfoTypeIndex].Split(new[] { ' ' }, 2)[0])
{ {
case "Cooking": case "Cooking":
if (fields.Length < Object.objectInfoBuffDurationIndex + 1) if (fields.Length < SObject.objectInfoBuffDurationIndex + 1)
{ {
LogIssue(entry.Key, "too few fields for a cooking item"); LogIssue(entry.Key, "too few fields for a cooking item");
hasObjectIssues = true; hasObjectIssues = true;
@ -1316,6 +1319,7 @@ namespace StardewModdingAPI.Framework
} }
} }
} }
IModMetadata[] loaded = this.ModRegistry.GetAll().ToArray(); IModMetadata[] loaded = this.ModRegistry.GetAll().ToArray();
IModMetadata[] loadedContentPacks = loaded.Where(p => p.IsContentPack).ToArray(); IModMetadata[] loadedContentPacks = loaded.Where(p => p.IsContentPack).ToArray();
IModMetadata[] loadedMods = loaded.Where(p => !p.IsContentPack).ToArray(); IModMetadata[] loadedMods = loaded.Where(p => !p.IsContentPack).ToArray();

View File

@ -58,7 +58,6 @@ namespace StardewModdingAPI.Framework.StateTracking.Snapshots
this.Inventory = watcher.TryGetInventoryChanges(out SnapshotItemListDiff itemChanges) this.Inventory = watcher.TryGetInventoryChanges(out SnapshotItemListDiff itemChanges)
? itemChanges ? itemChanges
: this.EmptyItemListDiff; : this.EmptyItemListDiff;
} }
} }
} }

View File

@ -34,7 +34,7 @@
this.Current--; this.Current--;
return true; return true;
} }
/// <summary>Restart the countdown.</summary> /// <summary>Restart the countdown.</summary>
public void Reset() public void Reset()
{ {

View File

@ -23,4 +23,4 @@ namespace StardewModdingAPI
//// <param name="value">The value to set.</param> //// <param name="value">The value to set.</param>
void SetValue(TValue value); void SetValue(TValue value);
} }
} }

View File

@ -24,4 +24,4 @@ namespace StardewModdingAPI
/// <param name="arguments">The method arguments to pass in.</param> /// <param name="arguments">The method arguments to pass in.</param>
void Invoke(params object[] arguments); void Invoke(params object[] arguments);
} }
} }

View File

@ -59,6 +59,7 @@ namespace StardewModdingAPI
if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.OrdinalIgnoreCase)) if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.OrdinalIgnoreCase))
return Assembly.LoadFrom(dll.FullName); return Assembly.LoadFrom(dll.FullName);
} }
return null; return null;
} }
catch (Exception ex) catch (Exception ex)

View File

@ -269,7 +269,6 @@ namespace StardewModdingAPI.Utilities
this.Year = year; this.Year = year;
this.DayOfWeek = this.GetDayOfWeek(day); this.DayOfWeek = this.GetDayOfWeek(day);
this.DaysSinceStart = this.GetDaysSinceStart(day, season, year); this.DaysSinceStart = this.GetDaysSinceStart(day, season, year);
} }
/// <summary>Get whether a date represents 0 spring Y1, which is the date during the in-game intro.</summary> /// <summary>Get whether a date represents 0 spring Y1, which is the date during the in-game intro.</summary>