diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-10-01 23:35:45 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-10-01 23:35:45 -0400 |
| commit | a73da532d52ae68ad01965dbf368bacc7d56a218 (patch) | |
| tree | a6f05e95515f822dfc129c36554f74f1da4d4c23 /Emby.Server.Implementations/Social/SharingRepository.cs | |
| parent | f651fd6ffba80a6f8e54fca7d014622692cc08f7 (diff) | |
| parent | 796f374359d75e22d2095b3f3a8f9b220cacde27 (diff) | |
Merge pull request #2931 from MediaBrowser/beta
Beta
Diffstat (limited to 'Emby.Server.Implementations/Social/SharingRepository.cs')
| -rw-r--r-- | Emby.Server.Implementations/Social/SharingRepository.cs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Social/SharingRepository.cs b/Emby.Server.Implementations/Social/SharingRepository.cs index f306e76c4..f0b8cbd30 100644 --- a/Emby.Server.Implementations/Social/SharingRepository.cs +++ b/Emby.Server.Implementations/Social/SharingRepository.cs @@ -7,22 +7,42 @@ using MediaBrowser.Model.Logging; using MediaBrowser.Model.Social; using SQLitePCL.pretty; using MediaBrowser.Model.Extensions; +using MediaBrowser.Model.IO; namespace Emby.Server.Implementations.Social { public class SharingRepository : BaseSqliteRepository, ISharingRepository { - public SharingRepository(ILogger logger, IApplicationPaths appPaths) + protected IFileSystem FileSystem { get; private set; } + + public SharingRepository(ILogger logger, IApplicationPaths appPaths, IFileSystem fileSystem) : base(logger) { + FileSystem = fileSystem; DbFilePath = Path.Combine(appPaths.DataPath, "shares.db"); } + public void Initialize() + { + try + { + InitializeInternal(); + } + catch (Exception ex) + { + Logger.ErrorException("Error loading database file. Will reset and retry.", ex); + + FileSystem.DeleteFile(DbFilePath); + + InitializeInternal(); + } + } + /// <summary> /// Opens the connection to the database /// </summary> /// <returns>Task.</returns> - public void Initialize() + private void InitializeInternal() { using (var connection = CreateConnection()) { |
