C# Class FCExporter, temona.Iot.study

FusionCharts Exporter is an ASP.NET C# script that handles FusionCharts (since v3.1) Server Side Export feature. This in conjuncture with other resource classses would process FusionCharts Export Data POSTED to it from FusionCharts and convert the data to an image or a PDF. Subsequently, it would save to the server or respond back as an HTTP response to client side as download. This script might be called as the FusionCharts Exporter - main module
Inheritance: System.Web.UI.Page
Exibir arquivo Open project: TEMONA/temona.Iot.study Class Usage Examples

Protected Methods

Method Description
Page_Load ( object sender, EventArgs e ) : void

The main function that handles all Input - Process - Output of this Export Architecture

Private Methods

Method Description
GetJSImage ( Hashtable exportData, bool processPdf ) : MemoryStream
bang ( string str ) : Hashtable
bang ( string str, char delimiterList ) : Hashtable

Helper function that splits a string containing delimiter separated key value pairs into hashtable

buildResponse ( ArrayList arrMsg ) : string

Builds response from an array of status information. Joins the array to a string. Each array element should be a string which is a key=value pair. This array are either joined by a & to build a querystring (to pass to chart) or joined by a HTML
to show neat and clean status informaton in Browser window if download fails at the processing stage.

convertRAWImageDataToFile ( string imageData, string parameters ) : void
exportProcessor ( string strFormat, string stream, Hashtable meta ) : MemoryStream
exportProcessor ( string strFormat, string stream, Hashtable meta, string imageData ) : MemoryStream

Get Export data from and build the export binary/objct.

flushStatus ( object filename, Hashtable meta ) : void

Flushes exported status message/or any status message to the chart or the output stream. It parses the exported status through parser function parseExportedStatus, builds proper response string using buildResponse function and flushes the response string to the output stream and terminates the program.

flushStatus ( object filename, Hashtable meta, string msg ) : void

Flushes exported status message/or any status message to the chart or the output stream. It parses the exported status through parser function parseExportedStatus, builds proper response string using buildResponse function and flushes the response string to the output stream and terminates the program.

generateIntelligentFileId ( ) : string

generates a file suffix for a existing file name to apply smart file naming

getExtension ( string exportType ) : string

gets file extension checking the export type.

getImageData ( string>.Dictionary imageData, string imageName ) : string

Get image data from the json object Request["encodedImgData"].

getMime ( string exportType ) : string

gets mime type for an export type

isDirectoryWritable ( string path ) : bool

Finds if a directory is writable

outputExportObject ( MemoryStream exportObj, Hashtable exportParams ) : object

Checks whether the export action is download or save. If action is 'download', send export parameters to 'setupDownload' function. If action is not-'download', send export parameters to 'setupServer' function. In either case it gets exportSettings and passes the settings along with processed export binary (image/PDF) to the output handler function if the export settings return a 'ready' flag set to 'true' or 'download'. The export process would stop here if the action is 'download'. In the other case, it gets back success status from output handler function and returns it.

parseExportRequestStream ( ) : Hashtable

Parses POST stream from chart and builds a Hashtable containing export data and parameters in a format readable by other functions. The Hashtable contains keys 'stream' (contains encoded image data) ; 'meta' ( Hashtable with 'width', 'height' and 'bgColor' keys) ; and 'parameters' ( Hashtable of all export parameters from chart as keys, like - exportFormat, exportFileName, exportAction etc.)

parseExportedStatus ( object filename, Hashtable meta, string msg ) : ArrayList

Parses the exported status and builds an array of export status information. As per status it builds a status array which contains statusCode (0/1), statusMesage, fileName, width, height and notice in some cases.

parseParams ( string strParams ) : Hashtable

Parse export 'parameters' string into a Hashtable Also synchronise default values from defaultparameterValues Hashtable

raise_error ( string msg ) : void
raise_error ( string msg, bool halt ) : void

Error reporter function that has a list of error messages. It can terminate the execution and send successStatus=0 along with a error message. It can also append notice to a global variable and continue execution of the program.

setupDownload ( Hashtable exportParams ) : Hashtable

setup download headers and return ready flag in exportSettings

setupServer ( Hashtable exportParams ) : Hashtable

check server permissions and settings and return ready flag to exportSettings

stichImageToSVG ( string svgData, string imageData ) : string
stichImageToSVGAndGetStream ( string svgData, string imageData ) : MemoryStream
stichImageToSVGAndGetString ( string svgData, string imageData ) : string

Method Details

Page_Load() protected method

The main function that handles all Input - Process - Output of this Export Architecture
protected Page_Load ( object sender, EventArgs e ) : void
sender object FusionCharts chart SWF
e EventArgs
return void