public Stream Convert(Stream file, string fileName, string toFormat)
        {
            UploadFileRequest uploadFileRequest = new UploadFileRequest()
            {
                Path = fileName,
                File = file
            };

            CadCloudApi.UploadFile(uploadFileRequest);

            GetDrawingSaveAsRequest getDrawingSaveAsRequest = new GetDrawingSaveAsRequest()
            {
                Name         = fileName,
                OutputFormat = toFormat
            };

            var convertResult = CadCloudApi.GetDrawingSaveAs(getDrawingSaveAsRequest);

            DeleteFileRequest deleteFileRequest = new DeleteFileRequest()
            {
                Path = fileName
            };

            CadCloudApi.DeleteFile(deleteFileRequest);

            return(convertResult);
        }
        private void EnsureFilesExists(string cloudFolder, string storage, string localFolder, bool forceOverride)
        {
            EnsureDirectoryExists(cloudFolder, storage);
            var filesResponse = CadApi.GetFilesList(new GetFilesListRequest(cloudFolder, storage));

            var files = filesResponse.Value;

            foreach (var file in Directory.GetFiles(Path.GetFullPath(localFolder), "*.*", SearchOption.TopDirectoryOnly))
            {
                if (file.ToLower().EndsWith(".json"))
                {
                    continue;
                }

                var fileInfo            = new FileInfo(file);
                var fullStorageFileName =
                    string.IsNullOrEmpty(cloudFolder) ? fileInfo.Name : cloudFolder + "\\" + fileInfo.Name;

                var putInputFile = forceOverride;
                if (CheckFileExistsOnCloud(fileInfo.Name, files))
                {
                    if (forceOverride)
                    {
                        CadApi.DeleteFile(new DeleteFileRequest(fullStorageFileName, storage));
                    }
                }
                else
                {
                    putInputFile = true;
                }

                if (putInputFile)
                {
                    using (var fs = File.OpenRead(fileInfo.FullName))
                    {
                        CadApi.UploadFile(new UploadFileRequest(fullStorageFileName, fs, storage));
                    }
                }
            }
        }