public static async void AddNew(string LibraryPath, bool IsMainLibrary = false) { try { Definitions.SteamLibrary Library = new Definitions.SteamLibrary(LibraryPath, IsMainLibrary); Definitions.List.Libraries.Add(new Definitions.Library { Type = Definitions.Enums.LibraryType.Steam, DirectoryInfo = new DirectoryInfo(LibraryPath), Steam = Library }); await Task.Run(() => Library.UpdateAppList()); await Task.Run(() => Library.UpdateJunks()); } catch (Exception ex) { logger.Fatal(ex); ex.Data.Add("LibraryPath", LibraryPath); ex.Data.Add("CurrentLibraries", Definitions.List.Libraries.ToList()); Definitions.SLM.RavenClient.Capture(new SharpRaven.Data.SentryEvent(ex)); } }
public static async void AddNewAsync(string libraryPath) { try { if (string.IsNullOrEmpty(libraryPath)) { return; } if (!libraryPath.EndsWith(Path.DirectorySeparatorChar.ToString())) { libraryPath += Path.DirectorySeparatorChar; } var library = new Definitions.SteamLibrary(libraryPath) { Type = LibraryType.SLM, DirectoryInfo = new DirectoryInfo(libraryPath) }; Definitions.List.LibraryProgress.Report(library); if (!Directory.Exists(libraryPath)) { return; } await Task.Run(() => library.UpdateAppList()).ConfigureAwait(true); await Task.Run(() => library.UpdateJunks()).ConfigureAwait(true); } catch (Exception ex) { Logger.Fatal(ex); MessageBox.Show(ex.ToString()); } }