blob: b62a11c77627a9e5163524e5bb8c4443d329b88a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
using System;
using System.IO;
namespace StardewModdingAPI
{
public class Mod
{
/// <summary>
/// The name of your mod.
/// NOTE: THIS IS DEPRECATED AND WILL BE REMOVED IN THE NEXT VERSION OF SMAPI
/// </summary>
[Obsolete]
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>
[Obsolete]
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>
[Obsolete]
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>
[Obsolete]
public virtual string Description { get; set; }
/// <summary>
/// The mod's manifest
/// </summary>
public Manifest Manifest { get; internal set; }
/// <summary>
/// Where the mod is located on the disk.
/// </summary>
public string PathOnDisk { get; internal set; }
/// <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") : "";
/// <summary>
/// A basic method that is the entry-point of your mod. It will always be called once when the mod loads.
/// </summary>
public virtual void Entry(params object[] objects)
{
}
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 "";
}
}
}
|