2016-02-28 19:55:35 +08:00
|
|
|
|
using System;
|
2016-03-23 08:36:04 +08:00
|
|
|
|
using System.IO;
|
2016-02-28 19:55:35 +08:00
|
|
|
|
|
|
|
|
|
namespace StardewModdingAPI
|
|
|
|
|
{
|
|
|
|
|
public class Mod
|
|
|
|
|
{
|
2016-03-21 05:45:45 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The name of your mod.
|
|
|
|
|
/// NOTE: THIS IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION OF SMAPI
|
|
|
|
|
/// </summary>
|
2016-03-22 02:33:10 +08:00
|
|
|
|
[Obsolete]
|
2016-03-21 05:45:45 +08:00
|
|
|
|
public virtual string Name { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The name of the mod's authour.
|
|
|
|
|
/// NOTE: THIS IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION OF SMAPI
|
|
|
|
|
/// </summary>
|
2016-03-22 02:33:10 +08:00
|
|
|
|
[Obsolete]
|
2016-03-21 05:45:45 +08:00
|
|
|
|
public virtual string Authour { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The version of the mod.
|
|
|
|
|
/// NOTE: THIS IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION OF SMAPI
|
|
|
|
|
/// </summary>
|
2016-03-22 02:33:10 +08:00
|
|
|
|
[Obsolete]
|
2016-03-21 05:45:45 +08:00
|
|
|
|
public virtual string Version { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A description of the mod.
|
|
|
|
|
/// NOTE: THIS IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION OF SMAPI
|
|
|
|
|
/// </summary>
|
2016-03-22 02:33:10 +08:00
|
|
|
|
[Obsolete]
|
2016-03-21 05:45:45 +08:00
|
|
|
|
public virtual string Description { get; set; }
|
|
|
|
|
|
2016-02-28 19:55:35 +08:00
|
|
|
|
/// <summary>
|
2016-03-21 05:19:02 +08:00
|
|
|
|
/// The mod's manifest
|
2016-02-28 19:55:35 +08:00
|
|
|
|
/// </summary>
|
2016-03-21 05:19:02 +08:00
|
|
|
|
public Manifest Manifest { get; internal set; }
|
2016-02-28 19:55:35 +08:00
|
|
|
|
|
2016-03-21 03:43:31 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Where the mod is located on the disk.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string PathOnDisk { get; internal set; }
|
|
|
|
|
|
2016-03-23 08:36:04 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// A basic path to store your mod's config at.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string BaseConfigPath => PathOnDisk + "\\config.json";
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A basic path to where per-save configs are stored
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string PerSaveConfigFolder => GetPerSaveConfigFolder();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// A basic path to store your mod's config at, dependent on the current save.
|
|
|
|
|
/// The Manifest must allow for per-save configs. This is to keep from having an
|
|
|
|
|
/// empty directory in every mod folder.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string PerSaveConfigPath => Constants.CurrentSavePathExists ? Path.Combine(PerSaveConfigFolder, Constants.SaveFolderName + ".json") : "";
|
|
|
|
|
|
2016-02-28 19:55:35 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// A basic method that is the entry-point of your mod. It will always be called once when the mod loads.
|
|
|
|
|
/// </summary>
|
2016-03-04 03:01:32 +08:00
|
|
|
|
public virtual void Entry(params object[] objects)
|
2016-02-28 19:55:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
2016-03-23 08:36:04 +08:00
|
|
|
|
|
|
|
|
|
private string GetPerSaveConfigFolder()
|
|
|
|
|
{
|
|
|
|
|
if (Manifest.PerSaveConfigs)
|
|
|
|
|
{
|
|
|
|
|
return Path.Combine(PathOnDisk, "psconfigs");
|
|
|
|
|
}
|
|
|
|
|
Log.Error("The mod [{0}] is not configured to use per-save configs.", Manifest.Name);
|
|
|
|
|
return "";
|
|
|
|
|
}
|
2016-02-28 19:55:35 +08:00
|
|
|
|
}
|
|
|
|
|
}
|