Skip to content

Commit

Permalink
v1.5.0.12 - Compress within same library
Browse files Browse the repository at this point in the history
  • Loading branch information
RevoLand committed Aug 12, 2018
1 parent 1153709 commit 2250d06
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 9 deletions.
Binary file modified Binaries/Steam Library Manager.exe
Binary file not shown.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

## [1.5.0.12] - 2018-08-12

### Added

- Compress/Decompress within the same library.
- Support for Origin manifest file version 3.0

## [1.5.0.11] - 2018-06-29

### Added
Expand Down
3 changes: 2 additions & 1 deletion Source/Steam Library Manager/Definitions/Enums/Enums.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public enum GameType
public enum TaskType
{
Copy,
Delete
Delete,
Compress
}

public enum ThemeAccents
Expand Down
24 changes: 18 additions & 6 deletions Source/Steam Library Manager/Definitions/SteamAppInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ public List<FrameworkElement> ContextMenuItems
{
foreach (ContextMenuItem cItem in List.AppCMenuItems.Where(x => x.IsActive && x.LibraryType == Enums.LibraryType.Steam))
{
if (IsCompressed && !cItem.ShowToCompressed)
if (IsCompressed && cItem.ShowToCompressed)
{
continue;
}
else if (!cItem.ShowToNormal)
else if (IsSteamBackup && !cItem.ShowToSteamBackup)
{
continue;
}
Expand Down Expand Up @@ -111,6 +111,18 @@ public async void ParseMenuItemActionAsync(string Action)
Process.Start(string.Format(Action, AppID, SLM.UserSteamID64));
break;

case "compress":
if (Framework.TaskManager.TaskList.ToList().Count(x => x.SteamApp == this && x.TargetLibrary == Library) == 0)
{
Framework.TaskManager.AddTask(new List.TaskInfo
{
SteamApp = this,
TargetLibrary = Library,
TaskType = Enums.TaskType.Compress
});
}
break;

case "disk":
CommonFolder.Refresh();

Expand Down Expand Up @@ -271,9 +283,9 @@ public async Task CopyFilesAsync(List.TaskInfo CurrentTask, CancellationToken ca
logger.Info("File list populated, total files to move: {0} - total size to move: {1}", AppFiles.Count, Functions.FileSystem.FormatBytes(TotalFileSize));

// If the game is not compressed and user would like to compress it
if (!IsCompressed && CurrentTask.Compress)
if (!IsCompressed && (CurrentTask.Compress || CurrentTask.TaskType == Enums.TaskType.Compress))
{
FileInfo CompressedArchive = new FileInfo(CompressedArchiveName.FullName.Replace(Library.Steam.SteamAppsFolder.FullName, CurrentTask.TargetLibrary.Steam.SteamAppsFolder.FullName));
FileInfo CompressedArchive = (CurrentTask.TaskType == Enums.TaskType.Compress) ? CompressedArchiveName : new FileInfo(CompressedArchiveName.FullName.Replace(Library.Steam.SteamAppsFolder.FullName, CurrentTask.TargetLibrary.Steam.SteamAppsFolder.FullName));

if (CompressedArchive.Exists)
{
Expand Down Expand Up @@ -336,13 +348,13 @@ await Main.FormAccessor.AppView.AppPanel.Dispatcher.Invoke(async delegate
}
}
// If the game is compressed and user would like to decompress it
else if (IsCompressed && !CurrentTask.Compress)
else if (IsCompressed && (!CurrentTask.Compress || CurrentTask.TaskType == Enums.TaskType.Compress))
{
foreach (ZipArchiveEntry CurrentFile in ZipFile.OpenRead(CompressedArchiveName.FullName).Entries)
{
CurrentTask.mre.WaitOne();

FileInfo NewFile = new FileInfo(Path.Combine(CurrentTask.TargetLibrary.Steam.SteamAppsFolder.FullName, CurrentFile.FullName));
FileInfo NewFile = new FileInfo(Path.Combine((CurrentTask.TaskType == Enums.TaskType.Compress) ? CurrentTask.SteamApp.Library.Steam.SteamAppsFolder.FullName : CurrentTask.TargetLibrary.Steam.SteamAppsFolder.FullName, CurrentFile.FullName));

if (!NewFile.Directory.Exists)
{
Expand Down
24 changes: 23 additions & 1 deletion Source/Steam Library Manager/Functions/Steam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ public static void PopulateAppCMenuItems()
Action = "steam://run/{0}",
Icon = FontAwesome.WPF.FontAwesomeIcon.Play,
LibraryType = Definitions.Enums.LibraryType.Steam,
ShowToSteamBackup = false,
ShowToCompressed = false
});

Expand All @@ -140,7 +141,27 @@ public static void PopulateAppCMenuItems()
{
ShowToCompressed = false,
LibraryType = Definitions.Enums.LibraryType.Steam,
IsSeparator = true
IsSeparator = true,
ShowToSteamBackup = false
});

// Compress
Definitions.List.AppCMenuItems.Add(new Definitions.ContextMenuItem
{
Header = "(De)Compress",
Action = "Compress",
LibraryType = Definitions.Enums.LibraryType.Steam,
ShowToCompressed = false,
ShowToSteamBackup = false,
Icon = FontAwesome.WPF.FontAwesomeIcon.FileZipOutline
});
// Separator
Definitions.List.AppCMenuItems.Add(new Definitions.ContextMenuItem
{
ShowToCompressed = false,
LibraryType = Definitions.Enums.LibraryType.Steam,
IsSeparator = true,
ShowToSteamBackup = false
});

// Show on disk
Expand All @@ -149,6 +170,7 @@ public static void PopulateAppCMenuItems()
Header = "{0} ({1})",
Action = "Disk",
LibraryType = Definitions.Enums.LibraryType.Steam,
ShowToCompressed = true,
Icon = FontAwesome.WPF.FontAwesomeIcon.FolderOpen
});

Expand Down
2 changes: 1 addition & 1 deletion Source/Steam Library Manager/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.5.0.11")]
[assembly: AssemblyFileVersion("1.5.0.12")]
[assembly: NeutralResourcesLanguage("en")]

0 comments on commit 2250d06

Please sign in to comment.