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); }
private void SaveGeneratedReportItemInstance() { if (this.m_dynamicWidth == null && this.m_dynamicHeight == null) { OnDemandProcessingContext odpContext = base.RenderingContext.OdpContext; AspNetCore.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot = odpContext.OdpMetadata.ReportSnapshot; IChunkFactory chunkFactory = odpContext.ChunkFactory; if (this.CriDef.RepeatWith == null) { string text = CustomReportItem.CreateChunkName(); using (Stream stream = chunkFactory.CreateChunk(text, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.GeneratedReportItems, null)) { new IntermediateFormatWriter(stream, odpContext.GetActiveCompatibilityVersion()).Write(this.m_generatedReportItem.Instance); stream.Flush(); } reportSnapshot.AddGeneratedReportItemChunkName(this.GetGeneratedInstanceChunkKey(), text); } else { ImageInstance imageInstance = (ImageInstance)this.m_generatedReportItem.Instance; string text = imageInstance.StreamName = ImageHelper.StoreImageDataInChunk(AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Image, imageInstance.ImageData, imageInstance.MIMEType, base.RenderingContext.OdpContext.OdpMetadata, base.RenderingContext.OdpContext.ChunkFactory); reportSnapshot.AddImageChunkName(this.GetGeneratedInstanceChunkKey(), text); } } }
private void SaveGeneratedReportItemInstance() { if (m_dynamicWidth != null || m_dynamicHeight != null) { return; } OnDemandProcessingContext odpContext = base.RenderingContext.OdpContext; Microsoft.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot = odpContext.OdpMetadata.ReportSnapshot; IChunkFactory chunkFactory = odpContext.ChunkFactory; if (CriDef.RepeatWith == null) { string text = CreateChunkName(); using (Stream stream = chunkFactory.CreateChunk(text, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.GeneratedReportItems, null)) { new IntermediateFormatWriter(stream, odpContext.GetActiveCompatibilityVersion()).Write(m_generatedReportItem.Instance); stream.Flush(); } reportSnapshot.AddGeneratedReportItemChunkName(GetGeneratedInstanceChunkKey(), text); } else { ImageInstance imageInstance = (ImageInstance)m_generatedReportItem.Instance; reportSnapshot.AddImageChunkName(name: imageInstance.StreamName = ImageHelper.StoreImageDataInChunk(Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Image, imageInstance.ImageData, imageInstance.MIMEType, base.RenderingContext.OdpContext.OdpMetadata, base.RenderingContext.OdpContext.ChunkFactory), definitionKey: GetGeneratedInstanceChunkKey()); } }
public static void SerializeMetadata(IChunkFactory chunkFactory, OnDemandMetadata odpMetadata, int compatVersion, bool prohibitSerializableValues) { odpMetadata.UpdateLastAssignedGlobalID(); using (Stream str = chunkFactory.CreateChunk("Metadata", AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Main, null)) { new IntermediateFormatWriter(str, compatVersion, prohibitSerializableValues).Write(odpMetadata); } }
private static IChunk DeserializeBlock(IChunk parent, IChunkFactory factory, Stream input, Endian endian) { var baseOffset = input.Position; var type = (ChunkType)input.ReadValueU32(endian); var block = factory.CreateChunk(type); if (block == null || block.Type != type) { throw new FormatException(); } var unknown04 = input.ReadValueU32(endian); var size = input.ReadValueU32(endian); var dataSize = input.ReadValueU32(endian); var childCount = input.ReadValueU32(endian); if (dataSize > size) { throw new FormatException(); } var childOffset = input.Position; var childEnd = childOffset + (size - dataSize - 20); var blockOffset = childEnd; var blockEnd = blockOffset + dataSize; if (blockEnd != baseOffset + size) { throw new FormatException(); } input.Seek(blockOffset, SeekOrigin.Begin); block.Deserialize(parent, input, endian); if (input.Position != blockEnd) { throw new FormatException(); } input.Seek(childOffset, SeekOrigin.Begin); for (uint i = 0; i < childCount; i++) { block.AddChild(DeserializeBlock(block, block, input, endian)); } if (input.Position != childEnd) { throw new FormatException(); } input.Seek(blockEnd, SeekOrigin.Begin); return(block); }
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; } }
public Stream OpenStream() { string mimeType; if (m_existingChunk) { return(m_chunkFactory.GetChunk(m_chunkName, m_chunkType, ChunkMode.Open, out mimeType)); } return(m_chunkFactory.CreateChunk(m_chunkName, m_chunkType, null)); }
internal void CreateDataChunkAndWriteHeader(RecordSetInfo recordSetInfo) { if (m_chunkStream == null) { m_recordSetInfo = recordSetInfo; m_chunkStream = m_reportChunkFactory.CreateChunk(m_dataSetChunkName, Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Data, null); m_chunkWriter = new IntermediateFormatWriter(m_chunkStream, m_DataChunkDeclarations, this, m_odpContext.GetActiveCompatibilityVersion(), m_odpContext.ProhibitSerializableValues); m_chunkWriter.Value.Write(m_recordSetInfo); } }
public static string StoreImageDataInChunk(AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes chunkType, byte[] imageData, string mimeType, OnDemandMetadata odpMetadata, IChunkFactory chunkFactory) { string text = ImageHelper.GenerateImageStreamName(); ReportSnapshot reportSnapshot = odpMetadata.ReportSnapshot; using (Stream stream = chunkFactory.CreateChunk(text, chunkType, mimeType)) { stream.Write(imageData, 0, imageData.Length); return(text); } }
private string StoreShapefileInChunk(AspNetCore.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext, byte[] data) { string text = Guid.NewGuid().ToString("N"); IChunkFactory chunkFactory = renderingContext.OdpContext.ChunkFactory; using (Stream stream = chunkFactory.CreateChunk(text, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Shapefile, null)) { stream.Write(data, 0, data.Length); return(text); } }
public void SetTileData(string url, byte[] data, string mimeType, AspNetCore.ReportingServices.OnDemandReportRendering.RenderingContext renderingContext) { string text = Guid.NewGuid().ToString("N"); ImageInfo imageInfo = new ImageInfo(text, ""); renderingContext.OdpContext.OdpMetadata.AddExternalImage(url, imageInfo); IChunkFactory chunkFactory = renderingContext.OdpContext.ChunkFactory; using (Stream stream = chunkFactory.CreateChunk(text, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Image, mimeType)) { stream.Write(data, 0, data.Length); } }
public void CopyDataChunksTo(IChunkFactory chunkFactory, out bool hasDataChunks) { hasDataChunks = false; foreach (Chunk allChunk in this.m_allChunks) { if (allChunk.Header.ChunkType == 5) { hasDataChunks = true; using (Stream to = chunkFactory.CreateChunk(allChunk.Header.ChunkName, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.Data, null)) { allChunk.Stream.Position = 0L; StreamSupport.CopyStreamUsingBuffer(allChunk.Stream, to, 4096); } } } }
private void GenerateReportItemDefinition() { this.m_generatedReportItem = null; ICustomReportItem controlInstance = base.RenderingContext.OdpContext.CriProcessingControls.GetControlInstance(this.CriDef.Type, base.RenderingContext.OdpContext.ExtFactory); if (controlInstance != null) { try { controlInstance.GenerateReportItemDefinition(this); } catch (Exception ex) { base.RenderingContext.ErrorContext.Register(ProcessingErrorCode.rsCRIProcessingError, Severity.Warning, this.Name, this.Type); Global.Tracer.TraceException(TraceLevel.Error, RPRes.rsCRIProcessingError(this.Name, this.Type) + " " + ex.ToString()); return; } if (this.m_generatedReportItem == null) { base.RenderingContext.ErrorContext.Register(ProcessingErrorCode.rsCRIRenderItemNull, Severity.Warning, this.CriDef.ObjectType, this.Name, this.Type); } else { this.m_generatedReportItem.ConstructReportItemDefinition(); this.m_generatedReportItem.CriGenerationPhase = CriGenerationPhases.None; string text = CustomReportItem.CreateChunkName(); OnDemandProcessingContext odpContext = base.RenderingContext.OdpContext; AspNetCore.ReportingServices.ReportIntermediateFormat.ReportSnapshot reportSnapshot = odpContext.OdpMetadata.ReportSnapshot; IChunkFactory chunkFactory = odpContext.ChunkFactory; using (Stream stream = chunkFactory.CreateChunk(text, AspNetCore.ReportingServices.ReportProcessing.ReportProcessing.ReportChunkTypes.GeneratedReportItems, null)) { IntermediateFormatWriter intermediateFormatWriter = new IntermediateFormatWriter(stream, odpContext.GetActiveCompatibilityVersion()); AspNetCore.ReportingServices.ReportIntermediateFormat.Visibility visibility = this.m_generatedReportItem.ReportItemDef.Visibility; this.m_generatedReportItem.ReportItemDef.Visibility = null; intermediateFormatWriter.Write(this.m_generatedReportItem.ReportItemDef); this.m_generatedReportItem.ReportItemDef.Visibility = visibility; stream.Flush(); } reportSnapshot.AddGeneratedReportItemChunkName(this.GetGeneratedDefinitionChunkKey(), text); } } }
private IChunk CreateChunk(Vector3F pos) { return(_chunkFactory.CreateChunk(pos, _chunkSize.width + 1, _chunkSize.height, _chunkSize.depth + 1)); }
public Stream CreateReportChunk(string name, ReportProcessing.ReportChunkTypes type, string mimeType) { return(m_chunkFactory.CreateChunk(name, type, mimeType)); }