Skip to content

Commit

Permalink
Merge #3834 Installation history tab
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed May 1, 2023
2 parents 3438c3b + 96dc967 commit 73b3086
Show file tree
Hide file tree
Showing 17 changed files with 841 additions and 139 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file.

- [GUI] Allow GUI users to delete registry lockfiles (#3829 by: HebaruSan; reviewed: techman83)
- [GUI] Show unmanaged files in game folder (#3833 by: HebaruSan; reviewed: techman83)
- [GUI] Installation history tab (#3834 by: HebaruSan; reviewed: techman83)

### Bugfixes

Expand Down
20 changes: 4 additions & 16 deletions Core/GameInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,6 @@ private void SetupCkanDirectories(bool scan = true)
User.RaiseMessage(Properties.Resources.GameInstanceCreatingDir, InstallHistoryDir());
txFileMgr.CreateDirectory(InstallHistoryDir());
}

// Clear any temporary files we find. If the directory
// doesn't exist, then no sweat; FilesystemTransaction
// will auto-create it as needed.
// Create our temporary directories, or clear them if they
// already exist.
if (Directory.Exists(TempDir()))
{
var directory = new DirectoryInfo(TempDir());
foreach (FileInfo file in directory.GetFiles())
txFileMgr.Delete(file.FullName);
foreach (DirectoryInfo subDirectory in directory.GetDirectories())
txFileMgr.DeleteDirectory(subDirectory.FullName);
}
log.InfoFormat("Initialised {0}", CkanDir());
}

Expand Down Expand Up @@ -334,8 +320,10 @@ public string DownloadCacheDir()
public string InstallHistoryDir()
=> CKANPathUtils.NormalizePath(Path.Combine(CkanDir(), "history"));

public string TempDir()
=> CKANPathUtils.NormalizePath(Path.Combine(CkanDir(), "temp"));
public IOrderedEnumerable<FileInfo> InstallHistoryFiles()
=> Directory.EnumerateFiles(InstallHistoryDir(), "*.ckan")
.Select(f => new FileInfo(f))
.OrderByDescending(fi => fi.CreationTime);

public GameVersion Version()
{
Expand Down
2 changes: 2 additions & 0 deletions Core/HelpURLs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public static class HelpURLs
public const string Labels = "https://github.com/KSP-CKAN/CKAN/pull/2936";
public const string PlayTime = "https://github.com/KSP-CKAN/CKAN/pull/3543";
public const string DownloadsFailed = "https://github.com/KSP-CKAN/CKAN/pull/3635";
public const string UnmanagedFiles = "https://github.com/KSP-CKAN/CKAN/pull/3833";
public const string InstallationHistory = "https://github.com/KSP-CKAN/CKAN/pull/3834";

public const string Discord = "https://discord.gg/Mb4nXQD";
}
Expand Down
13 changes: 10 additions & 3 deletions Core/Versioning/ModuleVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,16 @@ public ModuleVersion IncrementEpoch()
/// The return value should not be considered safe for use in file paths.
/// </remarks>
public override string ToString()
{
return _string;
}
=> _string;

public string ToString(bool hideEpoch, bool hideV)
=> hideEpoch
? hideV
? ModuleInstaller.StripEpoch(ModuleInstaller.StripV(_string))
: ModuleInstaller.StripEpoch(_string)
: hideV
? ModuleInstaller.StripV(_string)
: _string;
}

public partial class ModuleVersion : IEquatable<ModuleVersion>
Expand Down
12 changes: 12 additions & 0 deletions GUI/CKAN-GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@
<Compile Include="Controls\UnmanagedFiles.Designer.cs">
<DependentUpon>UnmanagedFiles.cs</DependentUpon>
</Compile>
<Compile Include="Controls\InstallationHistory.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Controls\InstallationHistory.Designer.cs">
<DependentUpon>InstallationHistory.cs</DependentUpon>
</Compile>
<Compile Include="Controls\EditModSearches.cs">
<SubType>UserControl</SubType>
</Compile>
Expand Down Expand Up @@ -340,6 +346,9 @@
<Compile Include="Main\MainUnmanaged.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Main\MainHistory.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Main\MainWait.cs">
<SubType>Form</SubType>
</Compile>
Expand Down Expand Up @@ -880,6 +889,9 @@
<EmbeddedResource Include="Controls\UnmanagedFiles.resx">
<DependentUpon>UnmanagedFiles.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\InstallationHistory.resx">
<DependentUpon>InstallationHistory.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Controls\PlayTime.resx">
<DependentUpon>PlayTime.cs</DependentUpon>
</EmbeddedResource>
Expand Down
238 changes: 238 additions & 0 deletions GUI/Controls/InstallationHistory.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 73b3086

Please sign in to comment.