public void PrepareStreamAccess()
 {
     if (_underlayingResource != null)
     {
         _underlayingResource.PrepareStreamAccess();
     }
 }
예제 #2
0
 public void PrepareStreamAccess()
 {
     using (ServiceRegistration.Get <IImpersonationService>().CheckImpersonationFor(CanonicalLocalResourcePath))
         if (_underlayingResource != null)
         {
             _underlayingResource.PrepareStreamAccess();
         }
 }
예제 #3
0
 public void PrepareStreamAccess()
 {
     using (ImpersonateUser(_impersonationContext))
         if (_underlayingResource != null)
         {
             _underlayingResource.PrepareStreamAccess();
         }
 }
예제 #4
0
 /// <summary>
 /// Loads an image from filesystem an returns a new <see cref="FanArtImage"/>.
 /// </summary>
 /// <param name="resourceLocator">Resource to load</param>
 /// <param name="maxWidth">Maximum width for image. <c>0</c> returns image in original size.</param>
 /// <param name="maxHeight">Maximum height for image. <c>0</c> returns image in original size.</param>
 /// <param name="mediaType">MediaType</param>
 /// <param name="fanArtType">FanArtType</param>
 /// <param name="fanArtName">Fanart name</param>
 /// <returns>FanArtImage or <c>null</c>.</returns>
 public static FanArtImage FromResource(IResourceLocator resourceLocator, int maxWidth, int maxHeight, FanArtConstants.FanArtMediaType mediaType, FanArtConstants.FanArtType fanArtType, string fanArtName)
 {
     try
     {
         using (var ra = resourceLocator.CreateAccessor())
         {
             ILocalFsResourceAccessor fsra = ra as ILocalFsResourceAccessor;
             if (fsra != null)
             {
                 fsra.PrepareStreamAccess();
                 using (var fileStream = fsra.OpenRead())
                     return(FromStream(fileStream, maxWidth, maxHeight, mediaType, fanArtType, fanArtName, fsra.LocalFileSystemPath));
             }
         }
     }
     catch
     {
     }
     return(null);
 }
예제 #5
0
 /// <summary>
 /// Loads an image from filesystem an returns a new <see cref="FanArtImage"/>.
 /// </summary>
 /// <param name="resourceLocator">Resource to load</param>
 /// <param name="maxWidth">Maximum width for image. <c>0</c> returns image in original size.</param>
 /// <param name="maxHeight">Maximum height for image. <c>0</c> returns image in original size.</param>
 /// <param name="mediaType">MediaType</param>
 /// <param name="fanArtType">FanArtType</param>
 /// <param name="fanArtName">Fanart name</param>
 /// <returns>FanArtImage or <c>null</c>.</returns>
 public static FanArtImage FromResource(IResourceLocator resourceLocator, int maxWidth, int maxHeight)
 {
     try
     {
         using (var ra = resourceLocator.CreateAccessor())
         {
             ILocalFsResourceAccessor fsra = ra as ILocalFsResourceAccessor;
             if (fsra != null)
             {
                 fsra.PrepareStreamAccess();
                 using (var fileStream = fsra.OpenRead())
                     // Calling EnsureLocalFileSystemAccess not necessary; only string operation
                     return(FromStream(fileStream, maxWidth, maxHeight, fsra.LocalFileSystemPath));
             }
         }
     }
     catch
     {
     }
     return(null);
 }