public static async void AddNew(string LibraryPath, bool IsMainLibrary = false) { try { if (!LibraryPath.EndsWith(Path.DirectorySeparatorChar.ToString())) { LibraryPath += Path.DirectorySeparatorChar; } var newLibrary = new Definitions.SteamLibrary(LibraryPath, IsMainLibrary) { Type = Definitions.Enums.LibraryType.Steam, DirectoryInfo = new DirectoryInfo(LibraryPath) }; Definitions.List.LibraryProgress.Report(newLibrary); await Task.Run(newLibrary.UpdateAppListAsync).ConfigureAwait(true); await Task.Run(newLibrary.UpdateJunks).ConfigureAwait(true); } catch (Exception ex) { logger.Fatal(ex); } }
public static async void AddNewAsync(string LibraryPath) { try { if (string.IsNullOrEmpty(LibraryPath)) { return; } if (!LibraryPath.EndsWith(Path.DirectorySeparatorChar.ToString())) { LibraryPath += Path.DirectorySeparatorChar; } Definitions.SteamLibrary Library = new Definitions.SteamLibrary(LibraryPath) { Type = Definitions.Enums.LibraryType.SLM, DirectoryInfo = new DirectoryInfo(LibraryPath) }; Definitions.List.LibraryProgress.Report(Library); if (Directory.Exists(LibraryPath)) { await Task.Run(() => Library.UpdateAppListAsync()).ConfigureAwait(true); await Task.Run(() => Library.UpdateJunks()).ConfigureAwait(true); } } catch (Exception ex) { logger.Fatal(ex); MessageBox.Show(ex.ToString()); } }
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)); } }