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

@ -35,8 +35,6 @@ namespace StardewModdingApi.Installer
"SMAPI.ConsoleCommands"
};
/// <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="modsDir">The folder for SMAPI mods.</param>
@ -84,6 +82,7 @@ namespace StardewModdingApi.Installer
foreach (DirectoryInfo modDir in modsDir.EnumerateDirectories())
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
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -43,7 +43,7 @@ using StardewModdingAPI.Toolkit.Serialization;
using StardewModdingAPI.Toolkit.Utilities;
using StardewModdingAPI.Utilities;
using StardewValley;
using Object = StardewValley.Object;
using SObject = StardewValley.Object;
namespace StardewModdingAPI.Framework
{
@ -524,6 +524,7 @@ namespace StardewModdingAPI.Framework
Game1.currentLoader = null;
this.Monitor.Log("Game loader done.");
}
if (SGame.NewDayTask?.Status == TaskStatus.Created)
{
this.Monitor.Log("New day task synchronizing...");
@ -700,6 +701,7 @@ namespace StardewModdingAPI.Framework
this.OnLoadStageChanged(LoadStage.CreatedSaveFile);
events.SaveCreated.RaiseEmpty();
}
if (this.IsBetweenSaveEvents)
{
// raise after-save
@ -731,6 +733,7 @@ namespace StardewModdingAPI.Framework
}
else
context += " Single-player.";
this.Monitor.Log(context);
// raise events
@ -1111,7 +1114,7 @@ namespace StardewModdingAPI.Framework
// require core fields
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");
hasObjectIssues = true;
@ -1119,10 +1122,10 @@ namespace StardewModdingAPI.Framework
}
// check min length for specific types
switch (fields[Object.objectInfoTypeIndex].Split(new[] { ' ' }, 2)[0])
switch (fields[SObject.objectInfoTypeIndex].Split(new[] { ' ' }, 2)[0])
{
case "Cooking":
if (fields.Length < Object.objectInfoBuffDurationIndex + 1)
if (fields.Length < SObject.objectInfoBuffDurationIndex + 1)
{
LogIssue(entry.Key, "too few fields for a cooking item");
hasObjectIssues = true;
@ -1316,6 +1319,7 @@ namespace StardewModdingAPI.Framework
}
}
}
IModMetadata[] loaded = this.ModRegistry.GetAll().ToArray();
IModMetadata[] loadedContentPacks = 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)
? itemChanges
: this.EmptyItemListDiff;
}
}
}

View File

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

View File

@ -269,7 +269,6 @@ namespace StardewModdingAPI.Utilities
this.Year = year;
this.DayOfWeek = this.GetDayOfWeek(day);
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>