public void GetImageRotateFlipTest(
            string formatExtension,
            bool saveResultToStorage,
            params string[] additionalExportFormats)
        {
            string name        = null;
            string cloudFolder = CloudTestFolder;
            string storage     = DefaultStorage;
            string outName     = null;

            List <string> formatsToExport = new List <string>(this.BasicExportFormats);

            foreach (string additionalExportFormat in additionalExportFormats)
            {
                if (!formatsToExport.Contains(additionalExportFormat))
                {
                    formatsToExport.Add(additionalExportFormat);
                }
            }

            foreach (var inputFile in InputTestFiles)
            {
                if (inputFile.Name.EndsWith(formatExtension))
                {
                    name = inputFile.Name;
                }
                else
                {
                    continue;
                }

                foreach (string format in formatsToExport)
                {
                    foreach (var method in _rotateFlipMethods)
                    {
                        outName = $"{name}_{method}.{format}";

                        this.TestRawGetRequest(
                            $"input drawing: {name}; Output format: {format}; Method: {method}",
                            name,
                            outName,
                            saveResultToStorage,
                            delegate(string outPath)
                        {
                            var request = new GetDrawingRotateFlipRequest(name, format, method, cloudFolder, outPath, storage);
                            return(CadApi.GetDrawingRotateFlip(request));
                        },
                            cloudFolder,
                            storage);
                    }

                    break;
                }
            }
        }
示例#2
0
        // Rotate and flip existing image
        private void GetImageRotateFlip()
        {
            var    cadApi   = new CadApi(AppKey, AppSid);
            string fileName = "910609.dxf";
            // Possible values are jpg, bmp, psd, tiff, gif, png, j2k, wmf and pdf
            string formatToExport = "pdf";
            // Possible values are Rotate180FlipNone, Rotate180FlipX, Rotate180FlipXY, Rotate180FlipY, Rotate270FlipNone,
            // Rotate270FlipX, Rotate270FlipXY, Rotate270FlipY, Rotate90FlipNone, Rotate90FlipX, Rotate90FlipXY,
            // Rotate90FlipY, RotateNoneFlipNone, RotateNoneFlipX, RotateNoneFlipXY and RotateNoneFlipY
            var    method       = "Rotate180FlipNone";
            string destFileName = "910609.pdf";

            // Upload document to Cloud Storage
            uploadFileToCloudStorage(fileName);

            var request        = new GetDrawingRotateFlipRequest(fileName, formatToExport, method, null, null, null);
            var responseStream = cadApi.GetDrawingRotateFlip(request);

            // Save the output file to disk
            saveFileToDisk(responseStream, destFileName);
        }