Esempio n. 1
0
        public void HandleScreenshot(object maximoObj, string screenshotString, string screenshotName, ApplicationMetadata applicationMetadata)
        {
            if (!String.IsNullOrWhiteSpace(screenshotString) && !String.IsNullOrWhiteSpace(screenshotName))
            {
                if (screenshotName.ToLower().EndsWith("rtf"))
                {
                    var bytes                = Convert.FromBase64String(screenshotString);
                    var decodedString        = Encoding.UTF8.GetString(bytes);
                    var compressedScreenshot = CompressionUtil.CompressRtf(decodedString);

                    var convertedScreeshot = RTFUtil.ConvertToHTML(compressedScreenshot);

                    bytes            = Encoding.UTF8.GetBytes(convertedScreeshot);
                    screenshotString = Convert.ToBase64String(bytes);
                    screenshotName   = screenshotName.Substring(0, screenshotName.Length - 3) + "html";
                }

                Validate(screenshotName, screenshotString);

                _attachmentHandler.HandleAttachments(maximoObj, screenshotString, screenshotName, applicationMetadata);
            }
        }