Skip to content

Commit

Permalink
tweak(Studio): Only show latest changelog after migrating
Browse files Browse the repository at this point in the history
The user might miss some changes, but getting 10s of changelogs on startup if someone hasn't used Studio in a while isn't great either..
Also, this is easier to integrate with automatic changelogs
  • Loading branch information
psyGamer committed Oct 27, 2024
1 parent 1bf113a commit 95115ba
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 183 deletions.
8 changes: 0 additions & 8 deletions Studio/CelesteStudio/Assets/Changelog.md

This file was deleted.

117 changes: 0 additions & 117 deletions Studio/CelesteStudio/Assets/Changelogs/v3.0.0.md

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
31 changes: 0 additions & 31 deletions Studio/CelesteStudio/Assets/Changelogs/v3.2.0.md

This file was deleted.

2 changes: 0 additions & 2 deletions Studio/CelesteStudio/Assets/VersionInfo.txt

This file was deleted.

7 changes: 1 addition & 6 deletions Studio/CelesteStudio/CelesteStudio.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,10 @@
<EmbeddedResource Include="Assets\JetBrainsMono\JetBrainsMonoNL-BoldItalic.otf" LogicalName="JetBrainsMono/JetBrainsMono-BoldItalic"/>
</ItemGroup>

<!-- Changelogs -->
<!-- Changelog (generated during Release action) -->
<ItemGroup>
<EmbeddedResource Condition="Exists('Assets\VersionInfo.txt')" Include="Assets\VersionInfo.txt" LogicalName="VersionInfo.txt"/>
<EmbeddedResource Condition="Exists('Assets\Changelog.md')" Include="Assets\Changelog.md" LogicalName="Changelog.md"/>

<EmbeddedResource Include="Assets\Changelogs\v3.0.0.md" LogicalName="Changelogs/v3.0.0.md"/>
<EmbeddedResource Include="Assets\Changelogs\v3.0.0\*.png" LogicalName="Changelogs/v3.0.0/%(Filename).png"/>

<EmbeddedResource Include="Assets\Changelogs\v3.2.0.md" LogicalName="Changelogs/v3.2.0.md"/>
</ItemGroup>

</Project>
12 changes: 9 additions & 3 deletions Studio/CelesteStudio/Dialog/ChangelogDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ private ChangelogDialog(string title, IEnumerable<string> changelogLines) {
}

public static void Show() {
using var versionInfoData = Assembly.GetExecutingAssembly().GetManifestResourceStream("VersionInfo.txt");
using var changelogData = Assembly.GetExecutingAssembly().GetManifestResourceStream("Changelog.md");
var asm = Assembly.GetExecutingAssembly();
using var versionInfoData = asm.GetManifestResourceStream("VersionInfo.txt");
using var changelogData = asm.GetManifestResourceStream("Changelog.md");
if (versionInfoData == null || changelogData == null) {
return;
}
Expand All @@ -142,8 +143,13 @@ public static void Show() {
using var changelogReader = new StreamReader(changelogData);

string[] versions = versionInfoReader.ReadToEnd().SplitLines().ToArray();
string[] changelogLines = changelogReader.ReadToEnd().SplitLines().ToArray();
string title = $"CelesteTAS {versions[0]} / Studio {versions[1]}";

new ChangelogDialog(title, changelogReader.ReadToEnd().SplitLines()).ShowModal();
if (changelogLines.Length == 0) {
return;
}

new ChangelogDialog(title, changelogLines).ShowModal();
}
}
10 changes: 1 addition & 9 deletions Studio/CelesteStudio/Migration/Migrator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,11 @@ The settings file should've opened itself.
throw new ArgumentOutOfRangeException();
}
}

string versionName = version.ToString(3);
if (asm.GetManifestResourceStream($"Changelogs/v{versionName}.md") is { } stream) {
changelogs.Add((versionName, stream));
}
}
}

Studio.Instance.Shown += (_, _) => {
foreach ((string? versionName, var stream) in changelogs) {
WhatsNewDialog.Show($"Whats new in Studio v{versionName}?", new StreamReader(stream).ReadToEnd());
stream.Dispose();
}
ChangelogDialog.Show();
};
}

Expand Down
9 changes: 2 additions & 7 deletions Studio/CelesteStudio/Studio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -749,13 +749,8 @@ private MenuBar CreateMenu() {
var quitItem = MenuEntry.File_Quit.ToAction(Application.Instance.Quit);
var homeItem = MenuUtils.CreateAction("Open README...", Keys.None, () => ProcessHelper.OpenInDefaultApp("https://github.com/EverestAPI/CelesteTAS-EverestInterop"));
var wikiItem = MenuUtils.CreateAction("Open wiki...", Keys.None, () => ProcessHelper.OpenInDefaultApp("https://github.com/EverestAPI/CelesteTAS-EverestInterop/wiki"));
var whatsNewItem = MenuUtils.CreateAction("What's new?", Keys.None, () => {
var asm = Assembly.GetExecutingAssembly();
// TODO: Don't hardcode the current changelog
if (asm.GetManifestResourceStream("Changelogs/v3.2.0.md") is { } stream) {
WhatsNewDialog.Show("What's new in Studio v3.2.0?", new StreamReader(stream).ReadToEnd());
}
});
var whatsNewItem = MenuUtils.CreateAction("What's new?", Keys.None, ChangelogDialog.Show);
whatsNewItem.Enabled = Assembly.GetExecutingAssembly().GetManifestResourceInfo("Changelog.md") != null;
var aboutItem = MenuUtils.CreateAction("About...", Keys.None, () => {
ShowAboutDialog(new AboutDialog {
ProgramName = "Celeste Studio",
Expand Down

0 comments on commit 95115ba

Please sign in to comment.