private static TextResult[] DecodeFile(string strImagePath, int mode, int iLeft, int iTop, int iRight, int iBottom) { BarcodeReader _br = new BarcodeReader(); _br.LicenseKeys = "t0068MgAAAEBDbYNoTMuh5/ccI24YdlzcggFG93NGuHrF/AWmcbKAsObdABAWC5GvZZpXBlfrsJhkQ1yMO4B8qTUnk6S8HdY=."; string[] strTemplateNameArray = { "All_DEFAULT", "All_DEFAULT_WITHREGION" }; string tempDefaultTemplateJson = "{\"Version\": \"1.0\",\"ImageParameters\": {\"Name\": \"" + strTemplateNameArray[0] + "\",\"BarcodeFormatIds\": [\"All\"],\"RegionPredetectionMode\": \"Enable\"}}"; string tempTemplateJsonWithRegion = "{\"ImageParameters\": {\"Name\": \"" + strTemplateNameArray[1] + "\",\"BarcodeFormatIds\": [\"All\"],\"RegionPredetectionMode\": \"Disable\",\"RegionDefinitionNameArray\": [\"Region\"]},\"RegionDefinitionArray\": [{\"Name\": \"Region\",\"MeasuredByPercentage\": true" + ",\"Left\":" + iLeft.ToString() + ",\"Top\":" + iTop.ToString() + ",\"Right\":" + iRight.ToString() + ",\"Bottom\":" + iBottom.ToString() + "}]}"; if (mode == 0) { // load template json as a string. _br.AppendParameterTemplate(tempDefaultTemplateJson); } else { // load template json as a string. _br.AppendParameterTemplate(tempTemplateJsonWithRegion); } _br.DecodeFile(strImagePath, strTemplateNameArray[mode]); TextResult[] result = _br.DecodeFile(strImagePath, strTemplateNameArray[mode]); return(result); }