コード例 #1
0
        public override void UpdateJunks()
        {
            try
            {
                while (IsUpdatingAppList)
                {
                    Task.Delay(5000);
                }

                DirectoryList["Common"].Refresh();
                if (DirectoryList["Common"].Exists)
                {
                    foreach (var dirInfo in DirectoryList["Common"].GetDirectories().ToList().Where(
                                 x => Apps.Count(y => string.Equals(y.InstallationDirectory.Name, x.Name, StringComparison.InvariantCultureIgnoreCase)) == 0 &&
                                 x.Name != "241100" && // Steam controller configs
                                 Functions.TaskManager.TaskList.Count(
                                     z => string.Equals(z.App.InstallationDirectory.Name, x.Name, StringComparison.InvariantCultureIgnoreCase) &&
                                     z.TargetLibrary == this
                                     ) == 0
                                 ).OrderByDescending(x => Functions.FileSystem.GetDirectorySize(x, true)))
                    {
                        var junk = new List.JunkInfo
                        {
                            FSInfo  = dirInfo,
                            Size    = Functions.FileSystem.FormatBytes(Functions.FileSystem.GetDirectorySize(dirInfo, true)),
                            Library = this,
                            Tag     = JunkType.HeadlessFolder
                        };

                        if (List.JunkItems.Count(x => x.FSInfo.FullName == junk.FSInfo.FullName) == 0)
                        {
                            if (List.IgnoredJunkItems.Contains(dirInfo.FullName))
                            {
                                continue;
                            }

                            List.LcProgress.Report(junk);
                        }
                    }
                }

                DirectoryList["Workshop"].Refresh();
                if (DirectoryList["Workshop"].Exists)
                {
                    if (Directory.Exists(Path.Combine(DirectoryList["Workshop"].FullName, "downloads")))
                    {
                        foreach (var fileDetails in new DirectoryInfo(Path.Combine(DirectoryList["Workshop"].FullName, "downloads")).EnumerateFiles("*.patch", SearchOption.TopDirectoryOnly).ToList().Where(
                                     x => Apps.Count(y => x.Name.Contains($"state_{y.AppId}_")) == 0
                                     ))
                        {
                            var junk = new List.JunkInfo
                            {
                                FSInfo  = fileDetails,
                                Size    = Functions.FileSystem.FormatBytes(fileDetails.Length),
                                Library = this,
                                Tag     = JunkType.HeadlessWorkshopFolder
                            };

                            if (List.JunkItems.Count(x => x.FSInfo.FullName == junk.FSInfo.FullName) == 0)
                            {
                                if (List.IgnoredJunkItems.Contains(fileDetails.FullName))
                                {
                                    continue;
                                }
                                List.LcProgress.Report(junk);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex);
            }
        }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
        public void UpdateJunks()
        {
            try
            {
                while (UpdatingAppList)
                {
                    Task.Delay(5000);
                }

                CommonFolder.Refresh();
                if (CommonFolder.Exists)
                {
                    foreach (var 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
                                 Functions.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)))
                    {
                        var junk = new List.JunkInfo
                        {
                            FSInfo  = dirInfo,
                            Size    = Functions.FileSystem.GetDirectorySize(dirInfo, true),
                            Library = Library
                        };

                        if (List.LcItems.Count(x => x.FSInfo.FullName == junk.FSInfo.FullName) == 0)
                        {
                            List.LCProgress.Report(junk);
                        }
                    }
                }

                WorkshopFolder.Refresh();
                if (WorkshopFolder.Exists)
                {
                    foreach (var 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
                                 Functions.TaskManager.TaskList.Count(
                                     z => string.Equals(z.SteamApp.WorkShopAcfName, x.Name
                                                        , StringComparison.InvariantCultureIgnoreCase) &&
                                     z.TargetLibrary == Library
                                     ) == 0
                                 ))
                    {
                        var junk = new List.JunkInfo
                        {
                            FSInfo  = fileDetails,
                            Size    = fileDetails.Length,
                            Library = Library
                        };

                        if (List.LcItems.Count(x => x.FSInfo.FullName == junk.FSInfo.FullName) == 0)
                        {
                            List.LCProgress.Report(junk);
                        }
                    }

                    if (Directory.Exists(Path.Combine(WorkshopFolder.FullName, "content")))
                    {
                        foreach (var 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
                                     Functions.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)))
                        {
                            var junk = new List.JunkInfo
                            {
                                FSInfo  = dirInfo,
                                Size    = Functions.FileSystem.GetDirectorySize(dirInfo, true),
                                Library = Library
                            };

                            if (List.LcItems.Count(x => x.FSInfo.FullName == junk.FSInfo.FullName) == 0)
                            {
                                List.LCProgress.Report(junk);
                            }
                        }
                    }

                    if (Directory.Exists(Path.Combine(WorkshopFolder.FullName, "downloads")))
                    {
                        foreach (var 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
                                     ))
                        {
                            var junk = new List.JunkInfo
                            {
                                FSInfo  = fileDetails,
                                Size    = fileDetails.Length,
                                Library = Library
                            };

                            if (List.LcItems.Count(x => x.FSInfo.FullName == junk.FSInfo.FullName) == 0)
                            {
                                List.LCProgress.Report(junk);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Fatal(ex);
            }
        }