Skip to content

Commit

Permalink
More bug fixes based on sentry.io reports
Browse files Browse the repository at this point in the history
  • Loading branch information
RevoLand committed Jan 8, 2018
1 parent 280f908 commit d916727
Show file tree
Hide file tree
Showing 12 changed files with 225 additions and 144 deletions.
Binary file modified Binaries/Steam Library Manager.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion Binaries/Version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.5.0.4|Bug fixes
1.5.0.5|Bug fixes
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@ 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.5] - 2018-01-08

### Fixed

- FileNotFoundException happens on file removal which caused by cached file properties.
- InvalidOperationException happens on updating junk list.
- Workshop files for tasked items are being detected by junk cleaner.
- ArgumentException happens on getting disk details for mapped network locations.(Haven't tried mapped location yet, not sure if it works or not)
- ArgumentOutOfRangeException on generating SLM library list.
- Handling of UnauthorizedAccessException on CopyFilesAsync/Steam method.
- InvalidOperationException happens on Updating application list for Steam.

## [1.5.0.4] - 2018-01-06

### Added
Expand Down
7 changes: 5 additions & 2 deletions Source/Steam Library Manager.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2010
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Steam Library Manager", "Steam Library Manager\Steam Library Manager.csproj", "{1E4D6DFF-D115-441D-AEA8-F22F60B2CBE4}"
EndProject
Expand All @@ -19,4 +19,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BAC111FB-A259-47CA-987C-ECC3D96BDA53}
EndGlobalSection
EndGlobal
1 change: 0 additions & 1 deletion Source/Steam Library Manager/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ private void Application_DispatcherUnhandledException(object sender, System.Wind
{
e.Exception.Data.Add(".Net", Functions.SLM.Get45PlusFromRegistry());
MessageBox.Show(e.Exception.ToString(), "Exception Caught", MessageBoxButton.OK, MessageBoxImage.Error);
System.Diagnostics.Debug.WriteLine(e.Exception);
Definitions.SLM.RavenClient.Capture(new SharpRaven.Data.SentryEvent(e.Exception));
e.Handled = true;
}
Expand Down
267 changes: 158 additions & 109 deletions Source/Steam Library Manager/Definitions/AppInfo.cs

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Source/Steam Library Manager/Definitions/Library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,12 @@ public void ParseMenuItemAction(string Action)
}
}

public long FreeSpace => DirectoryInfo.Exists ? Functions.FileSystem.GetAvailableFreeSpace(DirectoryInfo.FullName) : 0;
public long FreeSpace => DirectoryInfo.Exists && !DirectoryInfo.FullName.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) ? Functions.FileSystem.GetAvailableFreeSpace(DirectoryInfo.FullName) : 0;

public long TotalSize => DirectoryInfo.Exists ? Functions.FileSystem.GetAvailableTotalSpace(DirectoryInfo.FullName) : 0;
public long TotalSize => DirectoryInfo.Exists && !DirectoryInfo.FullName.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) ? Functions.FileSystem.GetAvailableTotalSpace(DirectoryInfo.FullName) : 0;

public string PrettyFreeSpace => DirectoryInfo.Exists ? $"{Functions.FileSystem.FormatBytes(FreeSpace)} / {Functions.FileSystem.FormatBytes(TotalSize)}" : "";
public string PrettyFreeSpace => DirectoryInfo.Exists && !DirectoryInfo.FullName.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) ? $"{Functions.FileSystem.FormatBytes(FreeSpace)} / {Functions.FileSystem.FormatBytes(TotalSize)}" : "";

public int FreeSpacePerc => DirectoryInfo.Exists ? 100 - ((int)Math.Round((double)(100 * FreeSpace) / Functions.FileSystem.GetAvailableTotalSpace(DirectoryInfo.FullName))) : 0;
public int FreeSpacePerc => DirectoryInfo.Exists && !DirectoryInfo.FullName.StartsWith(System.IO.Path.DirectorySeparatorChar.ToString()) ? 100 - ((int)Math.Round((double)(100 * FreeSpace) / Functions.FileSystem.GetAvailableTotalSpace(DirectoryInfo.FullName))) : 0;
}
}
21 changes: 13 additions & 8 deletions Source/Steam Library Manager/Definitions/SteamLibrary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void UpdateAppList()
}

// Foreach *.acf file found in library
Parallel.ForEach(SteamAppsFolder.EnumerateFiles("appmanifest_*.acf", SearchOption.TopDirectoryOnly), AcfFile =>
Parallel.ForEach(SteamAppsFolder.EnumerateFiles("appmanifest_*.acf", SearchOption.TopDirectoryOnly).ToList(), AcfFile =>
{
// Define a new value and call KeyValue
Framework.KeyValue KeyValReader = new Framework.KeyValue();
Expand All @@ -83,14 +83,15 @@ public void UpdateAppList()
});

// Do a loop for each *.zip file in library
Parallel.ForEach(Directory.EnumerateFiles(SteamAppsFolder.FullName, "*.zip", SearchOption.TopDirectoryOnly), ArchiveFile =>
Parallel.ForEach(Directory.EnumerateFiles(SteamAppsFolder.FullName, "*.zip", SearchOption.TopDirectoryOnly).ToList(), ArchiveFile =>
{
Functions.App.ReadDetailsFromZip(ArchiveFile, Library);
});

SteamBackupsFolder.Refresh();
if (Library.Type == Enums.LibraryType.SLM && SteamBackupsFolder.Exists)
{
foreach (FileInfo SkuFile in SteamBackupsFolder.EnumerateFiles("*.sis", SearchOption.AllDirectories))
foreach (FileInfo SkuFile in SteamBackupsFolder.EnumerateFiles("*.sis", SearchOption.AllDirectories).ToList())
{
Framework.KeyValue KeyValReader = new Framework.KeyValue();

Expand Down Expand Up @@ -497,7 +498,7 @@ public void UpdateJunks()
{
if (CommonFolder.Exists)
{
foreach (DirectoryInfo DirInfo in CommonFolder.GetDirectories().Where(
foreach (DirectoryInfo DirInfo in CommonFolder.GetDirectories().ToList().Where(
x => Apps.Count(y => y.InstallationPath.Name.ToLowerInvariant() == x.Name.ToLowerInvariant()) == 0
&& x.Name != "241100" // Steam controller configs
&& Framework.TaskManager.TaskList.Count(
Expand All @@ -523,11 +524,11 @@ public void UpdateJunks()

if (WorkshopFolder.Exists)
{
foreach (FileInfo FileDetails in WorkshopFolder.EnumerateFiles("*.acf", SearchOption.TopDirectoryOnly).Where(
foreach (FileInfo FileDetails in WorkshopFolder.EnumerateFiles("appworkshop_*.acf", SearchOption.TopDirectoryOnly).ToList().Where(
x => Apps.Count(y => x.Name == y.WorkShopAcfName) == 0
&& x.Name.ToLowerInvariant() != "appworkshop_241100.acf" // Steam Controller Configs
&& Framework.TaskManager.TaskList.Count(
z => z.App.WorkShopPath.Name.ToLowerInvariant() == x.Name.ToLowerInvariant()
z => z.App.WorkShopAcfName.ToLowerInvariant() == x.Name.ToLowerInvariant()
&& z.TargetLibrary == Library
) == 0
))
Expand All @@ -548,9 +549,13 @@ public void UpdateJunks()

if (Directory.Exists(Path.Combine(WorkshopFolder.FullName, "content")))
{
foreach (DirectoryInfo DirInfo in new DirectoryInfo(Path.Combine(WorkshopFolder.FullName, "content")).GetDirectories().Where(
foreach (DirectoryInfo DirInfo in new DirectoryInfo(Path.Combine(WorkshopFolder.FullName, "content")).GetDirectories().ToList().Where(
x => Apps.Count(y => y.AppID.ToString() == x.Name) == 0
&& x.Name != "241100" // Steam controller configs
&& Framework.TaskManager.TaskList.Count(
z => z.App.WorkShopPath.Name.ToLowerInvariant() == x.Name.ToLowerInvariant()
&& z.TargetLibrary == Library
) == 0
).OrderByDescending(x => Functions.FileSystem.GetDirectorySize(x, true)))
{
List.JunkInfo Junk = new List.JunkInfo
Expand All @@ -570,7 +575,7 @@ public void UpdateJunks()

if (Directory.Exists(Path.Combine(WorkshopFolder.FullName, "downloads")))
{
foreach (FileInfo FileDetails in new DirectoryInfo(Path.Combine(WorkshopFolder.FullName, "downloads")).EnumerateFiles("*.patch", SearchOption.TopDirectoryOnly).Where(
foreach (FileInfo FileDetails in new DirectoryInfo(Path.Combine(WorkshopFolder.FullName, "downloads")).EnumerateFiles("*.patch", SearchOption.TopDirectoryOnly).ToList().Where(
x => Apps.Count(y => x.Name.Contains($"state_{y.AppID}_")) == 0
))
{
Expand Down
9 changes: 5 additions & 4 deletions Source/Steam Library Manager/Forms/Main.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ private void UpdateBindings()
{
try
{
Debug.WriteLine(Functions.SLM.Get45PlusFromRegistry());
Definitions.SLM.RavenClient.Release = Definitions.Updater.CurrentVersion.ToString();
FormAccessor = this;
Properties.Settings.Default.SearchText = "";
Expand Down Expand Up @@ -549,9 +548,12 @@ private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
}
else if (((sender as Grid).DataContext is Definitions.Library))
{
if (((sender as Grid).DataContext as Definitions.Library).Steam.SteamAppsFolder.Exists)
if (((sender as Grid).DataContext as Definitions.Library).Steam != null)
{
Process.Start(((sender as Grid).DataContext as Definitions.Library).Steam.SteamAppsFolder.FullName);
if (((sender as Grid).DataContext as Definitions.Library).Steam.SteamAppsFolder.Exists)
{
Process.Start(((sender as Grid).DataContext as Definitions.Library).Steam.SteamAppsFolder.FullName);
}
}
}
else if (((sender as Grid).DataContext is Definitions.List.JunkInfo))
Expand All @@ -566,7 +568,6 @@ private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
catch (Exception ex)
{
Functions.Logger.LogToFile(Functions.Logger.LogType.SLM, ex.ToString());
Definitions.SLM.RavenClient.Capture(new SharpRaven.Data.SentryEvent(ex));
}
}

Expand Down
38 changes: 24 additions & 14 deletions Source/Steam Library Manager/Functions/SLM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,27 @@ public static void SaveSettings()

public static void OnLoad()
{
if (bool.Parse(Properties.Settings.Default.CheckforUpdatesAtStartup))
try
{
Updater.CheckForUpdates();
}
if (bool.Parse(Properties.Settings.Default.CheckforUpdatesAtStartup))
{
Updater.CheckForUpdates();
}

LoadSteam();
//LoadOrigin();
LoadSteam();
//LoadOrigin();

// SLM Libraries
Library.GenerateLibraryList();
// SLM Libraries
Library.GenerateLibraryList();

if (Properties.Settings.Default.ParallelAfterSize >= 20000000)
if (Properties.Settings.Default.ParallelAfterSize >= 20000000)
{
Properties.Settings.Default.ParallelAfterSize = Properties.Settings.Default.ParallelAfterSize / 1000000;
}
}
catch (Exception ex)
{
Properties.Settings.Default.ParallelAfterSize = Properties.Settings.Default.ParallelAfterSize / 1000000;
Logger.LogToFile(Logger.LogType.Library, ex.ToString());
}
}

Expand Down Expand Up @@ -153,13 +160,16 @@ public static void GenerateLibraryList()
try
{
// If we have a backup library(s)
if (Properties.Settings.Default.backupDirectories != null && Properties.Settings.Default.backupDirectories.Count > 0)
if (Properties.Settings.Default.backupDirectories == null)
return;
if (Properties.Settings.Default.backupDirectories.Count == 0)
return;

// for each backup library we have, do a loop
foreach (string BackupPath in Properties.Settings.Default.backupDirectories)
{
// for each backup library we have do a loop
foreach (string BackupPath in Properties.Settings.Default.backupDirectories)
{
if (!string.IsNullOrEmpty(BackupPath))
AddNewAsync(BackupPath);
}
}
}
catch (Exception ex)
Expand Down
2 changes: 2 additions & 0 deletions Source/Steam Library Manager/Functions/Steam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ public static async void AddNew(string LibraryPath, bool IsMainLibrary = false)
catch (Exception ex)
{
Logger.LogToFile(Logger.LogType.Library, ex.ToString());
ex.Data.Add("LibraryPath", LibraryPath);
ex.Data.Add("CurrentLibraries", Definitions.List.Libraries);
Definitions.SLM.RavenClient.Capture(new SharpRaven.Data.SentryEvent(ex));
}
}
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.4")]
[assembly: AssemblyFileVersion("1.5.0.5")]
[assembly: NeutralResourcesLanguage("en")]

0 comments on commit d916727

Please sign in to comment.