static StorageService()
        {
            var applicationData = ApplicationData.Current;

            LocalStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.LocalFolder);

#if WINDOWS_PHONE
            if (Version.Parse(Deployment.Current.RuntimeVersion).Major >= 6)
            {
                RoamingStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.RoamingFolder);
                TemporaryStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.TemporaryFolder);

                var localCacheFolderPropertyInfo = applicationData.GetType().GetRuntimeProperty("LocalCacheFolder");

                if (localCacheFolderPropertyInfo != null)
                {
                    LocalCacheStorageServiceHandlerStatic = new StorageServiceHandler((StorageFolder)localCacheFolderPropertyInfo.GetValue(applicationData));
                }
            }
#else
            RoamingStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.RoamingFolder);
            TemporaryStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.TemporaryFolder);
#endif

#if WINDOWS_PHONE_APP
            var localCacheFolderPropertyInfo = applicationData.GetType().GetRuntimeProperty("LocalCacheFolder");

            if (localCacheFolderPropertyInfo != null)
            {
                LocalCacheStorageServiceHandlerStatic = new StorageServiceHandler((StorageFolder)localCacheFolderPropertyInfo.GetValue(applicationData));
            }
#endif
        }
        static StorageService()
        {
            var applicationData = ApplicationData.Current;

            LocalStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.LocalFolder);

#if WINDOWS_PHONE
            if (Version.Parse(Deployment.Current.RuntimeVersion).Major >= 6)
            {
                RoamingStorageServiceHandlerStatic   = new StorageServiceHandler(applicationData.RoamingFolder);
                TemporaryStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.TemporaryFolder);

                var localCacheFolderPropertyInfo = applicationData.GetType().GetRuntimeProperty("LocalCacheFolder");

                if (localCacheFolderPropertyInfo != null)
                {
                    LocalCacheStorageServiceHandlerStatic = new StorageServiceHandler((StorageFolder)localCacheFolderPropertyInfo.GetValue(applicationData));
                }
            }
#else
            RoamingStorageServiceHandlerStatic   = new StorageServiceHandler(applicationData.RoamingFolder);
            TemporaryStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.TemporaryFolder);
#endif

#if WINDOWS_PHONE_APP
            var localCacheFolderPropertyInfo = applicationData.GetType().GetRuntimeProperty("LocalCacheFolder");

            if (localCacheFolderPropertyInfo != null)
            {
                LocalCacheStorageServiceHandlerStatic = new StorageServiceHandler((StorageFolder)localCacheFolderPropertyInfo.GetValue(applicationData));
            }
#endif
        }
Ejemplo n.º 3
0
        public ItemRepository(IStorageService storageService)
        {
            _storageService = storageService.Local;
            _storageFolder = ApplicationData.Current.LocalFolder;

            LoadItems().ConfigureAwait(false);
        }
 public static async Task DeleteFileIfExists(this IStorageServiceHandler storageService, string file)
 {
     if (await storageService.FileExistsAsync(file))
     {
         await storageService.DeleteFileAsync(file);
     }
 }
 public static async Task CreateDirectoryIfNotThere(this IStorageServiceHandler storageService, string path)
 {
     if (!await storageService.DirectoryExistsAsync(path))
     {
         await storageService.CreateDirectoryAsync(path);
     }
 }
 public static async Task DeleteDirectoryIfExists(this IStorageServiceHandler storageService, string path)
 {
     if (await storageService.DirectoryExistsAsync(path))
     {
         await storageService.DeleteDirectoryAsync(path);
     }
 }
Ejemplo n.º 7
0
        public ItemRepository(IStorageService storageService)
        {
            _storageService = storageService.Local;
            _storageFolder  = ApplicationData.Current.LocalFolder;

            LoadItems().ConfigureAwait(false);
        }
Ejemplo n.º 8
0
 public TileService(IConnectionManager connectionManager, IStorageService storageService)
 {
     _logger = new WPLogger(typeof(TileService));
     _logger.Info("Starting TileService");
     _connectionManager = connectionManager;
     _storageService    = storageService.Local;
     Current            = this;
 }
Ejemplo n.º 9
0
 public TileService(IConnectionManager connectionManager, IStorageService storageService)
 {
     _logger = new WPLogger(typeof(TileService));
     _logger.Info("Starting TileService");
     _connectionManager = connectionManager;
     _storageService = storageService.Local;
     Current = this;
 }
        public static async Task <Stream> OpenFileIfExists(this IStorageServiceHandler storageService, string file)
        {
            if (await storageService.FileExistsAsync(file))
            {
                return(await storageService.OpenFileForReadAsync(file));
            }

            return(null);
        }
        public static async Task <string> ReadStringIfFileExists(this IStorageServiceHandler storageService, string file)
        {
            if (!await storageService.FileExistsAsync(file))
            {
                return(string.Empty);
            }

            return(await storageService.ReadAllTextAsync(file));
        }
 public static async Task MoveFileIfExists(this IStorageServiceHandler storageService, string source, string destination, bool overwrite)
 {
     if (await storageService.FileExistsAsync(source))
     {
         var destinationFolder = Path.GetDirectoryName(destination);
         if (!await storageService.DirectoryExistsAsync(destinationFolder))
         {
             await storageService.CreateDirectoryAsync(destinationFolder);
         }
         await storageService.MoveFileAsync(source, destination, overwrite);
     }
 }
Ejemplo n.º 13
0
        static WinLogger()
        {
            if (LogConfiguration == null)
            {
                LogConfiguration = new LogConfiguration();
            }

            if (CacheStorage == null)
            {
                CacheStorage = new StorageService().LocalCache;
            }
        }
Ejemplo n.º 14
0
        public WinLogger(string typeName)
        {
            _typeName = typeName;
            if (LogConfiguration == null)
            {
                LogConfiguration = new LogConfiguration();
            }

            if (_cacheStorage == null)
            {
                _cacheStorage = new StorageService().Local;
            }
        }
Ejemplo n.º 15
0
 public SyncService(
     IConnectionManager connectionManager,
     IMultiServerSync mediaSync,
     IStorageService storageService,
     IServerInfoService serverInfo,
     IMessagePromptService messagePrompt,
     IMessengerService messengerService)
 {
     _connectionManager = connectionManager;
     _mediaSync = mediaSync;
     _serverInfo = serverInfo;
     _messagePrompt = messagePrompt;
     _messengerService = messengerService;
     _storageService = storageService.Local;
     _logger = new WPLogger(GetType());
     Current = this;
 }
Ejemplo n.º 16
0
 public SyncService(
     IConnectionManager connectionManager,
     IMultiServerSync mediaSync,
     IStorageService storageService,
     IServerInfoService serverInfo,
     IMessagePromptService messagePrompt,
     IMessengerService messengerService)
 {
     _connectionManager = connectionManager;
     _mediaSync         = mediaSync;
     _serverInfo        = serverInfo;
     _messagePrompt     = messagePrompt;
     _messengerService  = messengerService;
     _storageService    = storageService.Local;
     _logger            = new WPLogger(GetType());
     Current            = this;
 }
        public static StorageFolder RootFolder(this IStorageServiceHandler storageService)
        {
            var service = storageService as StorageServiceHandler;

            if (service != null)
            {
                var fields = service.GetType().GetField("_storageFolder", BindingFlags.Instance | BindingFlags.NonPublic);
                if (fields != null)
                {
                    var storage = fields.GetValue(service) as StorageFolder;
                    if (storage != null)
                    {
                        return(storage);
                    }
                }
            }

            return(ApplicationData.Current.LocalFolder);
        }
Ejemplo n.º 18
0
        static StorageService()
        {
            var applicationData = ApplicationData.Current;

            LocalStorageServiceHandlerStatic   = new StorageServiceHandler(applicationData.LocalFolder, StorageServiceStorageType.Local);
            PackageStorageServiceHandlerStatic = new StorageServiceHandler(Windows.ApplicationModel.Package.Current.InstalledLocation, StorageServiceStorageType.Package);

#if !WINDOWS_PHONE
            RoamingStorageServiceHandlerStatic   = new StorageServiceHandler(applicationData.RoamingFolder, StorageServiceStorageType.Roaming);
            TemporaryStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.TemporaryFolder, StorageServiceStorageType.Temporary);
#endif

#if WINDOWS_PHONE_81 || WINDOWS_PHONE_APP
            var localCacheFolderPropertyInfo = applicationData.GetType().GetRuntimeProperty("LocalCacheFolder");

            if (localCacheFolderPropertyInfo != null)
            {
                LocalCacheStorageServiceHandlerStatic = new StorageServiceHandler((StorageFolder)localCacheFolderPropertyInfo.GetValue(applicationData), StorageServiceStorageType.LocalCache);
            }
#endif
        }
Ejemplo n.º 19
0
        static StorageService()
        {
            var applicationData = ApplicationData.Current;

            LocalStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.LocalFolder, StorageServiceStorageType.Local);
            PackageStorageServiceHandlerStatic = new StorageServiceHandler(Windows.ApplicationModel.Package.Current.InstalledLocation, StorageServiceStorageType.Package);

#if !WINDOWS_PHONE
            RoamingStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.RoamingFolder, StorageServiceStorageType.Roaming);
            TemporaryStorageServiceHandlerStatic = new StorageServiceHandler(applicationData.TemporaryFolder, StorageServiceStorageType.Temporary);
#endif

#if WINDOWS_PHONE_81 || WINDOWS_PHONE_APP
            var localCacheFolderPropertyInfo = applicationData.GetType().GetRuntimeProperty("LocalCacheFolder");

            if (localCacheFolderPropertyInfo != null)
            {
                LocalCacheStorageServiceHandlerStatic = new StorageServiceHandler((StorageFolder)localCacheFolderPropertyInfo.GetValue(applicationData), StorageServiceStorageType.LocalCache);
            }
#endif
        }
 public static Task MoveFileIfExists(this IStorageServiceHandler storageService, string source, string destination)
 {
     return(storageService.MoveFileIfExists(source, destination, false));
 }
Ejemplo n.º 21
0
 public FileRepository(IStorageService storageService)
 {
     _storageService = storageService.Local;
 }
Ejemplo n.º 22
0
 public PlaylistHelper(IStorageService storageService)
 {
     _storageService = storageService.Local;
     _playlistFile = String.Format("{0}.json", Constants.Messages.CurrentPlaylist);
 }
Ejemplo n.º 23
0
 public UserActionRepository(IStorageService storageService)
 {
     _storageService = storageService.Local;
 }
 public ImageRepository(IStorageService storageService)
 {
     _storageService = storageService.Local;
 }
Ejemplo n.º 25
0
        static WinLogger()
        {
            if (LogConfiguration == null)
            {
                LogConfiguration = new LogConfiguration();
            }

            if (CacheStorage == null)
            {
                CacheStorage = new StorageService().LocalCache;
            }
        }
Ejemplo n.º 26
0
 public FileTransferManager(ILocalAssetManager localAssetManager, IStorageService storageService, ITransferService transferService)
 {
     _localAssetManager = localAssetManager;
     _transferService = transferService;
     _storageService = storageService.Local;
 }
 public FileTransferManager(ILocalAssetManager localAssetManager, IStorageService storageService, ITransferService transferService)
 {
     _localAssetManager = localAssetManager;
     _transferService   = transferService;
     _storageService    = storageService.Local;
 }
 public ItemRepository(IStorageService storageService)
 {
     _storageService = storageService.Local;
 }
 public UserActionRepository(IStorageService storageService)
 {
     _storageService = storageService.Local;
 }
 public PlaylistHelper(IStorageService storageService)
 {
     _storageService = storageService.Local;
     _playlistFile   = String.Format("{0}.json", Constants.Messages.CurrentPlaylist);
 }