public void UpdateJunks() { try { CommonFolder.Refresh(); if (CommonFolder.Exists) { foreach (DirectoryInfo DirInfo in CommonFolder.GetDirectories().ToList().Where( x => Apps.Count(y => string.Equals(y.InstallationDirectory.Name, x.Name, StringComparison.InvariantCultureIgnoreCase)) == 0 && x.Name != "241100" && // Steam controller configs Framework.TaskManager.TaskList.Count( z => string.Equals(z.SteamApp.InstallationDirectory.Name, x.Name, StringComparison.InvariantCultureIgnoreCase) && z.TargetLibrary == Library ) == 0 ).OrderByDescending(x => Functions.FileSystem.GetDirectorySize(x, true))) { List.JunkInfo Junk = new List.JunkInfo { FSInfo = DirInfo, Size = Functions.FileSystem.GetDirectorySize(DirInfo, true), Library = Library }; if (List.LCItems.ToList().Count(x => x.FSInfo.FullName == Junk.FSInfo.FullName) == 0) { List.LCItems.Add(Junk); } } } WorkshopFolder.Refresh(); if (WorkshopFolder.Exists) { foreach (FileInfo FileDetails in WorkshopFolder.EnumerateFiles("appworkshop_*.acf", SearchOption.TopDirectoryOnly).ToList().Where( x => Apps.Count(y => x.Name == y.WorkShopAcfName) == 0 && !string.Equals(x.Name, "appworkshop_241100.acf" // Steam Controller Configs , StringComparison.InvariantCultureIgnoreCase) && // Steam Controller Configs Framework.TaskManager.TaskList.Count( z => string.Equals(z.SteamApp.WorkShopAcfName, x.Name , StringComparison.InvariantCultureIgnoreCase) && z.TargetLibrary == Library ) == 0 )) { List.JunkInfo Junk = new List.JunkInfo { FSInfo = FileDetails, Size = FileDetails.Length, Library = Library }; if (List.LCItems.ToList().Count(x => x.FSInfo.FullName == Junk.FSInfo.FullName) == 0) { List.LCItems.Add(Junk); } } if (Directory.Exists(Path.Combine(WorkshopFolder.FullName, "content"))) { 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 => string.Equals(z.SteamApp.WorkShopPath.Name, x.Name , StringComparison.InvariantCultureIgnoreCase) && z.TargetLibrary == Library ) == 0 ).OrderByDescending(x => Functions.FileSystem.GetDirectorySize(x, true))) { List.JunkInfo Junk = new List.JunkInfo { FSInfo = DirInfo, Size = Functions.FileSystem.GetDirectorySize(DirInfo, true), Library = Library }; if (List.LCItems.ToList().Count(x => x.FSInfo.FullName == Junk.FSInfo.FullName) == 0) { List.LCItems.Add(Junk); } } } if (Directory.Exists(Path.Combine(WorkshopFolder.FullName, "downloads"))) { 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 )) { List.JunkInfo Junk = new List.JunkInfo { FSInfo = FileDetails, Size = FileDetails.Length, Library = Library }; if (List.LCItems.ToList().Count(x => x.FSInfo.FullName == Junk.FSInfo.FullName) == 0) { List.LCItems.Add(Junk); } } } } } catch (Exception ex) { logger.Fatal(ex); SLM.RavenClient.Capture(new SharpRaven.Data.SentryEvent(ex)); } }