Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation history tab #3834

Merged
merged 5 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
techman83 marked this conversation as resolved.
Show resolved Hide resolved
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