Skip to content

Commit

Permalink
Merge branch 'develop' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
Pathoschild committed Mar 1, 2019
2 parents 84b9f43 + 460b440 commit 10c7192
Show file tree
Hide file tree
Showing 18 changed files with 327 additions and 234 deletions.
4 changes: 2 additions & 2 deletions build/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;

[assembly: AssemblyProduct("SMAPI")]
[assembly: AssemblyVersion("2.10.2")]
[assembly: AssemblyFileVersion("2.10.2")]
[assembly: AssemblyVersion("2.11.0")]
[assembly: AssemblyFileVersion("2.11.0")]
16 changes: 15 additions & 1 deletion docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
# Release notes
## 2.11
Released 01 March 2019 for Stardew Valley 1.3.36.

* For players:
* Updated for Stardew Valley 1.3.36.

* For modders:
* Bumped all deprecation levels to _pending removal_.

* For the web UI:
* The log parser now shows available updates in a section at the top.
* The mod compatibility page now crosses out mod links if they're outdated to avoid confusion.
* Fixed smapi.io linking to an archived download in rare cases.

## 2.10.2
Released 08 January 2019 for Stardew Valley 1.3.32–33.
Released 09 January 2019 for Stardew Valley 1.3.32–33.

* For players:
* SMAPI now keeps the first save backup created for the day, instead of the last one.
Expand Down
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.ConsoleCommands/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
"Version": "2.10.2",
"Version": "2.11.0",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
"MinimumApiVersion": "2.10.2"
"MinimumApiVersion": "2.11.0"
}
4 changes: 2 additions & 2 deletions src/SMAPI.Mods.SaveBackup/manifest.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"Name": "Save Backup",
"Author": "SMAPI",
"Version": "2.10.2",
"Version": "2.11.0",
"Description": "Automatically backs up all your saves once per day into its folder.",
"UniqueID": "SMAPI.SaveBackup",
"EntryDll": "SaveBackup.dll",
"MinimumApiVersion": "2.10.2"
"MinimumApiVersion": "2.11.0"
}
3 changes: 3 additions & 0 deletions src/SMAPI.Web/Controllers/IndexController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ private IEnumerable<ReleaseVersion> ParseReleaseVersions(GitRelease release)

foreach (GitAsset asset in release.Assets)
{
if (asset.FileName.StartsWith("Z_OLD"))
continue;

Match match = Regex.Match(asset.FileName, @"SMAPI-(?<version>[\d\.]+(?:-.+)?)-installer(?<forDevs>-for-developers)?.zip");
if (!match.Success || !SemanticVersion.TryParse(match.Groups["version"].Value, out ISemanticVersion version))
continue;
Expand Down
51 changes: 45 additions & 6 deletions src/SMAPI.Web/Framework/LogParsing/LogParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ public class LogParser
/// <summary>A regex pattern matching an entry in SMAPI's content pack list.</summary>
private readonly Regex ContentPackListEntryPattern = new Regex(@"^ (?<name>.+) (?<version>.+) by (?<author>.+) \| for (?<for>.+?)(?: \| (?<description>.+))?$", RegexOptions.Compiled | RegexOptions.IgnoreCase);

/// <summary>A regex pattern matching the start of SMAPI's mod update list.</summary>
private readonly Regex ModUpdateListStartPattern = new Regex(@"^You can update \d+ mods?:$", RegexOptions.Compiled | RegexOptions.IgnoreCase);

/// <summary>A regex pattern matching an entry in SMAPI's mod update list.</summary>
private readonly Regex ModUpdateListEntryPattern = new Regex(@"^ (?<name>.+?) (?<version>" + SemanticVersion.UnboundedVersionPattern + @"): (?<link>.+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase);

/// <summary>A regex pattern matching SMAPI's update line.</summary>
private readonly Regex SMAPIUpdatePattern = new Regex(@"^You can update SMAPI to (?<version>" + SemanticVersion.UnboundedVersionPattern + @"): (?<link>.+)$", RegexOptions.Compiled | RegexOptions.IgnoreCase);


/*********
** Public methods
Expand Down Expand Up @@ -69,11 +78,12 @@ public ParsedLog Parse(string logText)
};

// parse log messages
LogModInfo smapiMod = new LogModInfo { Name = "SMAPI", Author = "Pathoschild", Description = "" };
LogModInfo gameMod = new LogModInfo { Name = "game", Author = "", Description = "" };
LogModInfo smapiMod = new LogModInfo { Name = "SMAPI", Author = "Pathoschild", Description = "", Loaded = true };
LogModInfo gameMod = new LogModInfo { Name = "game", Author = "", Description = "", Loaded = true };
IDictionary<string, LogModInfo> mods = new Dictionary<string, LogModInfo>();
bool inModList = false;
bool inContentPackList = false;
bool inModUpdateList = false;
foreach (LogMessage message in log.Messages)
{
// collect stats
Expand All @@ -90,11 +100,9 @@ public ParsedLog Parse(string logText)
break;

default:
{
if (mods.ContainsKey(message.Mod))
mods[message.Mod].Errors++;
break;
}
}
}

Expand All @@ -106,6 +114,8 @@ public ParsedLog Parse(string logText)
inModList = false;
if (inContentPackList && !this.ContentPackListEntryPattern.IsMatch(message.Text))
inContentPackList = false;
if (inModUpdateList && !this.ModUpdateListEntryPattern.IsMatch(message.Text))
inModUpdateList = false;

// mod list
if (!inModList && message.Level == LogLevel.Info && this.ModListStartPattern.IsMatch(message.Text))
Expand All @@ -117,7 +127,7 @@ public ParsedLog Parse(string logText)
string version = match.Groups["version"].Value;
string author = match.Groups["author"].Value;
string description = match.Groups["description"].Value;
mods[name] = new LogModInfo { Name = name, Author = author, Version = version, Description = description };
mods[name] = new LogModInfo { Name = name, Author = author, Version = version, Description = description, Loaded = true };
}

// content pack list
Expand All @@ -131,7 +141,36 @@ public ParsedLog Parse(string logText)
string author = match.Groups["author"].Value;
string description = match.Groups["description"].Value;
string forMod = match.Groups["for"].Value;
mods[name] = new LogModInfo { Name = name, Author = author, Version = version, Description = description, ContentPackFor = forMod };
mods[name] = new LogModInfo { Name = name, Author = author, Version = version, Description = description, ContentPackFor = forMod, Loaded = true };
}

// mod update list
else if (!inModUpdateList && message.Level == LogLevel.Alert && this.ModUpdateListStartPattern.IsMatch(message.Text))
inModUpdateList = true;
else if (inModUpdateList)
{
Match match = this.ModUpdateListEntryPattern.Match(message.Text);
string name = match.Groups["name"].Value;
string version = match.Groups["version"].Value;
string link = match.Groups["link"].Value;
if (mods.ContainsKey(name))
{
mods[name].UpdateLink = link;
mods[name].UpdateVersion = version;
}
else
{
mods[name] = new LogModInfo { Name = name, UpdateVersion = version, UpdateLink = link, Loaded = false };
}
}

else if (message.Level == LogLevel.Alert && this.SMAPIUpdatePattern.IsMatch(message.Text))
{
Match match = this.SMAPIUpdatePattern.Match(message.Text);
string version = match.Groups["version"].Value;
string link = match.Groups["link"].Value;
smapiMod.UpdateVersion = version;
smapiMod.UpdateLink = link;
}

// platform info line
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ public class LogModInfo
/// <summary>The mod author.</summary>
public string Author { get; set; }

/// <summary>The update version.</summary>
public string UpdateVersion { get; set; }

/// <summary>The update link.</summary>
public string UpdateLink { get; set; }

/// <summary>The mod version.</summary>
public string Version { get; set; }

Expand All @@ -23,5 +29,11 @@ public class LogModInfo

/// <summary>The number of errors logged by this mod.</summary>
public int Errors { get; set; }

/// <summary>Whether the mod was loaded into the game.</summary>
public bool Loaded { get; set; }

/// <summary>Whether the mod has an update available.</summary>
public bool HasUpdate => this.UpdateVersion != null && this.Version != this.UpdateVersion;
}
}
64 changes: 58 additions & 6 deletions src/SMAPI.Web/Views/LogParser/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
{
<meta name="robots" content="noindex" />
}
<link rel="stylesheet" href="~/Content/css/log-parser.css?r=20180627" />
<link rel="stylesheet" href="~/Content/css/log-parser.css?r=20190221" />
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery@3.3.1/dist/jquery.min.js" crossorigin="anonymous"></script>
<script src="~/Content/js/log-parser.js?r=20180627"></script>
<script src="~/Content/js/log-parser.js?r=20190221"></script>
<script>
$(function() {
smapi.logParser({
Expand Down Expand Up @@ -117,9 +117,61 @@ else if (Model.ParsedLog?.IsValid == true)
@* parsed log *@
@if (Model.ParsedLog?.IsValid == true)
{
<h2>Log info</h2>
<div id="output">
<table id="metadata">
@if (Model.ParsedLog.Mods.Any(mod => mod.HasUpdate))
{
<h2>Suggested fixes</h2>
<ul id="fix-list">
<li>
Consider updating these mods to fix problems:
<table id="updates" class="table">
@foreach (LogModInfo mod in Model.ParsedLog.Mods.Where(mod => (mod.HasUpdate && mod.ContentPackFor == null) || (contentPacks != null && contentPacks.TryGetValue(mod.Name, out LogModInfo[] contentPackList) && contentPackList.Any(pack => pack.HasUpdate))))
{
<tr class="mod-entry">
<td>
<strong class=@(!mod.HasUpdate ? "hidden" : "")>@mod.Name</strong>
@if (contentPacks != null && contentPacks.TryGetValue(mod.Name, out LogModInfo[] contentPackList))
{
<div class="content-packs">
@foreach (LogModInfo contentPack in contentPackList.Where(pack => pack.HasUpdate))
{
<text>+ @contentPack.Name</text><br/>
}
</div>
}
</td>
<td>
@if (mod.HasUpdate)
{
<a href="@mod.UpdateLink" target="_blank">
@(mod.Version == null ? @mod.UpdateVersion : $"{mod.Version} → {mod.UpdateVersion}")
</a>
}
else
{
<text>&nbsp;</text>
}
@if (contentPacks != null && contentPacks.TryGetValue(mod.Name, out contentPackList))
{
<div>
@foreach (LogModInfo contentPack in contentPackList.Where(pack => pack.HasUpdate))
{
<a href="@contentPack.UpdateLink" target="_blank">@contentPack.Version → @contentPack.UpdateVersion</a><br/>
}
</div>
}
</td>
</tr>
}
</table>
</li>
</ul>
}
<h2>Log info</h2>
<table id="metadata" class="table">
<caption>Game info:</caption>
<tr>
<th>Stardew Valley:</th>
Expand All @@ -139,7 +191,7 @@ else if (Model.ParsedLog?.IsValid == true)
</tr>
</table>
<br />
<table id="mods" class="@(Model.ShowRaw ? "filters-disabled" : null)">
<table id="mods" class="@(Model.ShowRaw ? "filters-disabled" : null) table">
<caption>
Installed mods:
@if (!Model.ShowRaw)
Expand All @@ -149,7 +201,7 @@ else if (Model.ParsedLog?.IsValid == true)
<span class="notice btn txt" v-on:click="hideAllMods" v-bind:class="{ invisible: !anyModsShown || !anyModsHidden }">hide all</span>
}
</caption>
@foreach (var mod in Model.ParsedLog.Mods.Where(p => p.ContentPackFor == null))
@foreach (var mod in Model.ParsedLog.Mods.Where(p => p.Loaded && p.ContentPackFor == null))
{
<tr v-on:click="toggleMod('@Model.GetSlug(mod.Name)')" class="mod-entry" v-bind:class="{ hidden: !showMods['@Model.GetSlug(mod.Name)'] }">
<td><input type="checkbox" v-bind:checked="showMods['@Model.GetSlug(mod.Name)']" v-bind:class="{ invisible: !anyModsHidden }" /></td>
Expand Down
37 changes: 27 additions & 10 deletions src/SMAPI.Web/wwwroot/Content/css/log-parser.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ caption {
#output {
padding: 10px;
overflow: auto;
}

#output h2 {
margin: -10px 0 10px -10px;
}

#output table {
font-family: monospace;
}

Expand Down Expand Up @@ -43,7 +50,7 @@ table caption {
/*********
** Log metadata & filters
*********/
#metadata, #mods, #filters {
.table, #filters {
border-bottom: 1px dashed #888888;
margin-bottom: 5px;
}
Expand All @@ -53,7 +60,7 @@ table caption {
padding-right: 0.7em;
}

table#metadata, table#mods {
.table {
border: 1px solid #000000;
background: #ffffff;
border-radius: 5px;
Expand All @@ -63,8 +70,20 @@ table#metadata, table#mods {
box-shadow: 1px 1px 1px 1px #dddddd;
}

.invisible {
visibility: hidden;
.mod-entry {
height: 1.8em;
}

.table > caption {
min-height: 1.3em;
}

#fix-list {
margin-bottom: 2em;
}

#updates {
min-width: 10em;
}

#mods {
Expand All @@ -87,8 +106,7 @@ table#metadata, table#mods {
cursor: default;
}

#metadata tr,
#mods tr {
.table tr {
background: #eee
}

Expand All @@ -114,11 +132,11 @@ table#metadata, table#mods {
display: inline-block;
}

#mods .mod-entry.hidden {
.table .hidden {
opacity: 0.5;
}

#mods .content-packs {
.table .content-packs {
margin-left: 1em;
font-size: 0.9em;
font-style: italic;
Expand All @@ -128,8 +146,7 @@ table#metadata, table#mods {
padding-right: 5px;
}

#metadata tr:nth-child(even),
#mods tr:nth-child(even) {
.table tr:nth-child(even) {
background: #fff
}

Expand Down
10 changes: 6 additions & 4 deletions src/SMAPI.Web/wwwroot/Content/css/mods.css
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ table.wikitable > caption {
opacity: 0.7;
}

#mod-list .mod-closed-source {
color: red;
font-size: 0.8em;
opacity: 0.5;
#mod-list tr[data-status="abandoned"] .mod-page-links,
#mod-list tr[data-status="broken"] .mod-page-links,
#mod-list tr[data-status="obsolete"] .mod-page-links,
#mod-list tr[data-status="unofficial"] .mod-page-links,
#mod-list tr[data-status="workaround"] .mod-page-links {
text-decoration: line-through;
}
Loading

0 comments on commit 10c7192

Please sign in to comment.