Exemple #1
0
        /// <summary>Process
        /// <para>
        /// Process: Internal function to convert a RosetteFile into a dictionary to use for getResponse
        /// </para>
        /// </summary>
        /// <param name="file">RosetteFile: File being uploaded to use as a request to the Rosette server.</param>
        /// <returns>Dictionary&lt;string, object&gt;: Dictionary containing the results of the response from the server from the getResponse call.</returns>
        private Dictionary<string, Object> Process(RosetteFile file)
        {
            Dictionary<string, string> dict = new Dictionary<string, string>(){
                { "content", file.getFileDataString()},
                { "contentType", file.getDataType()},
                { "unit", "doc"},
            };

            if(file.getOptions() != null){
                Dictionary<string, string> opts = new JavaScriptSerializer().Deserialize<Dictionary<string, string>>(file.getOptions());
                dict = (Dictionary<string, string>)dict.Concat(opts.Where(x=> !dict.Keys.Contains(x.Key)));
            }


            return getResponse(SetupClient(), new JavaScriptSerializer().Serialize(dict));
        }