当前位置: 首页>>代码示例>>C#>>正文


C# IFileSystemResourceAccessor.OpenRead方法代码示例

本文整理汇总了C#中IFileSystemResourceAccessor.OpenRead方法的典型用法代码示例。如果您正苦于以下问题:C# IFileSystemResourceAccessor.OpenRead方法的具体用法?C# IFileSystemResourceAccessor.OpenRead怎么用?C# IFileSystemResourceAccessor.OpenRead使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IFileSystemResourceAccessor的用法示例。


在下文中一共展示了IFileSystemResourceAccessor.OpenRead方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResourceAccessorTextureImageSource

 /// <summary>
 /// Constructs a <see cref="ResourceAccessorTextureImageSource"/> for the given data.
 /// </summary>
 /// <param name="resourceAccessor">The resource accessor to load the texture data from.</param>
 /// <param name="rotation">Desired rotation for the given image.</param>
 public ResourceAccessorTextureImageSource(IFileSystemResourceAccessor resourceAccessor, RightAngledRotation rotation)
 {
   _key = resourceAccessor.CanonicalLocalResourcePath.Serialize();
   _resourceAccessor = resourceAccessor;
   _stream = _resourceAccessor.OpenRead();
   _rotation = rotation;
 }
开发者ID:BigGranu,项目名称:MediaPortal-2,代码行数:12,代码来源:ResourceAccessorTextureImageSource.cs

示例2: ZipResourceProxy

 public ZipResourceProxy(string key, IFileSystemResourceAccessor zipFileAccessor)
 {
   _key = key;
   _zipFileResourceAccessor = zipFileAccessor;
   _zipFileStream = _zipFileResourceAccessor.OpenRead(); // Not sure if the ZipFile closes the stream appropriately, so we keep a reference to it
   try
   {
     _zipFile = new ZipFile(_zipFileStream);
   }
   catch
   {
     _zipFileStream.Dispose();
     throw;
   }
 }
开发者ID:VicDemented,项目名称:MediaPortal-2,代码行数:15,代码来源:ZipResourceProxy.cs

示例3: IsoResourceProxy

    public IsoResourceProxy(string key, IFileSystemResourceAccessor isoFileResourceAccessor)
    {
      _key = key;
      _isoFileResourceAccessor = isoFileResourceAccessor;

      _underlayingStream = _isoFileResourceAccessor.OpenRead();
      try
      {
        _diskFileSystem = GetFileSystem(_underlayingStream);
      }
      catch
      {
        _underlayingStream.Dispose();
        throw;
      }
    }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:16,代码来源:IsoResourceProxy.cs

示例4: IsResource

    public bool IsResource(IFileSystemResourceAccessor baseResourceAccessor, string path)
    {
      string entryPath = ZipResourceAccessor.ToEntryPath(path);

      lock (_syncObj)
      {
        string key = baseResourceAccessor.CanonicalLocalResourcePath.Serialize();
        try
        {
          ZipResourceProxy proxy;
          if (_zipUsages.TryGetValue(key, out proxy))
            return path.Equals("/") || ZipResourceAccessor.IsResource(proxy.ZipFile, entryPath);
        }
        catch (Exception)
        {
          return false;
        }
      }

      using (Stream resourceStream = baseResourceAccessor.OpenRead()) // Not sure if the ZipFile will close the stream so we dispose it here
        try
        {
          using (ZipFile zFile = new ZipFile(resourceStream))
            return path.Equals("/") || ZipResourceAccessor.IsResource(zFile, entryPath);
        }
        catch (Exception)
        {
          return false;
        }
    }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:30,代码来源:ZipResourceProvider.cs

示例5: ReadMediaInfo

    protected MediaInfoWrapper ReadMediaInfo(IFileSystemResourceAccessor mediaItemAccessor)
    {
      MediaInfoWrapper result = new MediaInfoWrapper();

      ILocalFsResourceAccessor localFsResourceAccessor = mediaItemAccessor as ILocalFsResourceAccessor;
      if (ReferenceEquals(localFsResourceAccessor, null))
      {
        Stream stream = null;
        try
        {
          stream = mediaItemAccessor.OpenRead();
          if (stream != null)
            result.Open(stream);
        }
        finally
        {
          if (stream != null)
            stream.Close();
        }
      }
      else
      {
        using (localFsResourceAccessor.EnsureLocalFileSystemAccess())
          result.Open(localFsResourceAccessor.LocalFileSystemPath);
      }

      return result;
    }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:28,代码来源:VideoMetadataExtractor.cs

示例6: ReadMetaInfo

 private void ReadMetaInfo(IFileSystemResourceAccessor mediaItemAccessor)
 {
   using (Stream mediaStream = mediaItemAccessor.OpenRead())
     ReadMetaInfo(mediaStream);
 }
开发者ID:VicDemented,项目名称:MediaPortal-2,代码行数:5,代码来源:ExifMetaInfo.cs

示例7: IsResource

    public bool IsResource(IFileSystemResourceAccessor baseResourceAccessor, string path)
    {
      string resourceName = baseResourceAccessor.ResourceName;
      if (string.IsNullOrEmpty(resourceName) || !baseResourceAccessor.IsFile)
        return false;

      // Test if we have already an ISO proxy for that ISO file...
      lock (_syncObj)
      {
        string key = baseResourceAccessor.CanonicalLocalResourcePath.Serialize();
        try
        {
          IsoResourceProxy proxy;
          if (_isoUsages.TryGetValue(key, out proxy))
            lock (proxy.SyncObj)
              return IsoResourceAccessor.IsResource(proxy.DiskFileSystem, path);
        }
        catch (Exception)
        {
          return false;
        }
      }

      // ... if not, test the resource in a new disk file system instance
      using (Stream underlayingStream = baseResourceAccessor.OpenRead())
      {
        try
        {
          IFileSystem diskFileSystem = IsoResourceProxy.GetFileSystem(underlayingStream);
          using (diskFileSystem as IDisposable)
            return IsoResourceAccessor.IsResource(diskFileSystem, path);
        }
        catch
        {
          return false;
        }
      }
    }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:38,代码来源:IsoResourceProvider.cs

示例8: ReadMediaInfo

 protected MediaInfoWrapper ReadMediaInfo(IFileSystemResourceAccessor mediaItemAccessor)
 {
   MediaInfoWrapper result = new MediaInfoWrapper();
   Stream stream = null;
   try
   {
     stream = mediaItemAccessor.OpenRead();
     if (stream != null)
       result.Open(stream);
   }
   finally
   {
     if (stream != null)
       stream.Close();
   }
   return result;
 }
开发者ID:HAF-Blade,项目名称:MediaPortal-2,代码行数:17,代码来源:VideoMetadataExtractor.cs


注:本文中的IFileSystemResourceAccessor.OpenRead方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。