示例#1
0
 internal ChunkFactoryStreamHandler(string chunkName, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes chunkType, IChunkFactory chunkFactory, bool existingChunk)
 {
     m_chunkName     = chunkName;
     m_chunkType     = chunkType;
     m_chunkFactory  = chunkFactory;
     m_existingChunk = existingChunk;
 }
示例#2
0
        internal Stream GetOrCreateChunk(Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type, string chunkName, bool createChunkIfNotExists, out bool isNewChunk)
        {
            isNewChunk = false;
            if (chunkName == null)
            {
                throw new RenderingObjectModelException(ProcessingErrorCode.rsInvalidParameterValue, "chunkName");
            }
            if (m_chunks.ContainsKey(chunkName))
            {
                return(m_chunks[chunkName]);
            }
            string mimeType;
            Stream stream = m_chunkFactory.GetChunk(chunkName, type, ChunkMode.Open, out mimeType);

            if (createChunkIfNotExists && stream == null)
            {
                stream     = m_chunkFactory.CreateChunk(chunkName, type, null);
                isNewChunk = true;
            }
            if (stream != null)
            {
                m_chunks.Add(chunkName, stream);
            }
            return(stream);
        }
示例#3
0
        public override Stream CreateChunk(string name, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type, string mimeType)
        {
            Erase(name, type);
            Chunk chunk = new Chunk(mimeType, name, type);

            m_allChunks.Add(chunk);
            return(chunk.Stream);
        }
示例#4
0
 internal Stream CreateChunk(Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type, string chunkName)
 {
     if (!IsChunkManagerValid())
     {
         return(null);
     }
     return(m_chunkManager.CreateChunk(type, chunkName));
 }
示例#5
0
 internal Stream GetOrCreateChunk(Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type, string chunkName, bool createChunkIfNotExists, out bool isNewChunk)
 {
     if (!IsChunkManagerValid())
     {
         isNewChunk = false;
         return(null);
     }
     return(m_chunkManager.GetOrCreateChunk(type, chunkName, createChunkIfNotExists, out isNewChunk));
 }
		internal static string StoreImageDataInChunk(Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes chunkType, byte[] imageData, string mimeType, OnDemandMetadata odpMetadata, IChunkFactory chunkFactory)
		{
			string text = GenerateImageStreamName();
			_ = odpMetadata.ReportSnapshot;
			using (Stream stream = chunkFactory.CreateChunk(text, chunkType, mimeType))
			{
				stream.Write(imageData, 0, imageData.Length);
				return text;
			}
		}
示例#7
0
        public Stream GetChunk(string chunkName, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes chunkType, ChunkMode chunkMode, out string mimeType)
        {
            Stream stream = GetChunk(chunkName, chunkType, out mimeType);

            if (chunkMode == ChunkMode.OpenOrCreate && stream == null)
            {
                mimeType = null;
                stream   = CreateChunk(chunkName, chunkType, mimeType);
            }
            return(stream);
        }
示例#8
0
 private Chunk GetChunkImpl(string name, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type)
 {
     foreach (Chunk allChunk in m_allChunks)
     {
         if (allChunk.Header.ChunkName == name && allChunk.Header.ChunkType == (int)type)
         {
             return(allChunk);
         }
     }
     return(null);
 }
        private byte[] ReadImageDataFromChunk(string chunkName, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes chunkType)
        {
            byte[] array = null;
            string mimeType;
            Stream chunk = m_chunkFactory.GetChunk(chunkName, chunkType, ChunkMode.Open, out mimeType);

            Global.Tracer.Assert(chunk != null, "Could not find expected image data chunk.  Name='{0}', Type={1}", chunkName, chunkType);
            using (chunk)
            {
                return(StreamSupport.ReadToEndUsingLength(chunk));
            }
        }
示例#10
0
 public bool Erase(string chunkName, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type)
 {
     foreach (Chunk allChunk in m_allChunks)
     {
         if (allChunk.Header.ChunkName == chunkName && allChunk.Header.ChunkType == (int)type)
         {
             m_allChunks.Remove(allChunk);
             return(true);
         }
     }
     return(false);
 }
示例#11
0
        public override Stream GetChunk(string name, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type, out string mimeType)
        {
            Chunk chunkImpl = GetChunkImpl(name, type);

            if (chunkImpl == null)
            {
                mimeType = null;
                return(null);
            }
            mimeType = chunkImpl.Header.MimeType;
            chunkImpl.Stream.Seek(0L, SeekOrigin.Begin);
            if (chunkImpl.Header.ChunkFlag == ChunkFlags.Compressed)
            {
                throw new InternalCatalogException("Cannot read compressed chunk.");
            }
            return(chunkImpl.Stream);
        }
示例#12
0
 internal Stream CreateChunk(Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type, string chunkName)
 {
     if (chunkName == null)
     {
         throw new RenderingObjectModelException(ProcessingErrorCode.rsInvalidParameterValue, "chunkName");
     }
     if (m_chunks.TryGetValue(chunkName, out Stream value))
     {
         value.Close();
         m_chunks.Remove(chunkName);
     }
     value = m_chunkFactory.CreateChunk(chunkName, type, null);
     if (value != null)
     {
         m_chunks.Add(chunkName, value);
     }
     return(value);
 }
 private static IStreamHandler BuildChunkStreamHandler(string chunkName, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes chunkType, IChunkFactory chunkFactory, bool openExisting)
 {
     return(new ChunkFactoryStreamHandler(chunkName, chunkType, chunkFactory, openExisting));
 }
示例#14
0
 public override string GetStreamMimeType(string name, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type)
 {
     return(GetChunkImpl(name, type)?.Header.MimeType);
 }
 public abstract Stream CreateChunk(string name, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type, string mimeType);
 public abstract string GetStreamMimeType(string name, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type);
示例#17
0
 public Chunk(string mimeType, string name, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes type)
 {
     m_header = new ChunkHeader(name, (int)type, ChunkFlags.None, mimeType, ChunkHeader.CurrentVersion, 0L);
 }
 private static void PreparePartitionedTreeForAsyncSerialization(PartitionedTreeScalabilityCache scaleCache, OnDemandProcessingContext odpContext, string chunkName, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes chunkType)
 {
     if (scaleCache != null)
     {
         RIFAppendOnlyStorage rIFAppendOnlyStorage = scaleCache.Storage as RIFAppendOnlyStorage;
         if (rIFAppendOnlyStorage != null)
         {
             IStreamHandler streamHandler = BuildChunkStreamHandler(chunkName, chunkType, odpContext.ChunkFactory, rIFAppendOnlyStorage.FromExistingStream);
             rIFAppendOnlyStorage.Reset(streamHandler);
         }
         scaleCache.PrepareForFlush();
     }
 }