Ejemplo n.º 1
0
        public static string CommandRequest(string method,
                                            string documentRevisionId,
                                            string callbackUrl,
                                            string userId,
                                            string status)
        {
            int timeout;

            Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out timeout);

            var docServiceConnector = new Web.Core.Files.DocumentService(
                StudioKeySettings.GetKey(),
                StudioKeySettings.GetSKey(),
                TenantStatisticsProvider.GetUsersCount());

            if (timeout > 0)
            {
                docServiceConnector.Timeout = timeout;
            }
            try
            {
                return(docServiceConnector.CommandRequest(
                           FilesLinkUtility.DocServiceCommandUrl,
                           method,
                           documentRevisionId,
                           callbackUrl,
                           userId,
                           status));
            }
            catch (Exception e)
            {
                throw CustomizeError(e);
            }
        }
Ejemplo n.º 2
0
        public static string GetExternalUri(Stream fileStream, string contentType, string documentRevisionId)
        {
            int timeout;

            Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out timeout);

            var docServiceConnector = new Web.Core.Files.DocumentService(
                StudioKeySettings.GetKey(),
                StudioKeySettings.GetSKey(),
                TenantStatisticsProvider.GetUsersCount());

            if (timeout > 0)
            {
                docServiceConnector.Timeout = timeout;
            }
            try
            {
                return(docServiceConnector.GetExternalUri(
                           FilesLinkUtility.DocServiceStorageUrl,
                           fileStream,
                           contentType,
                           documentRevisionId));
            }
            catch (Exception ex)
            {
                throw CustomizeError(ex);
            }
        }
        public static int GetConvertedUri(string documentUri,
                                          string fromExtension,
                                          string toExtension,
                                          string documentRevisionId,
                                          bool isAsync,
                                          out string convertedDocumentUri)
        {
            int timeout;
            Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out timeout);

            var docServiceConnector = new Web.Core.Files.DocumentService(
                StudioKeySettings.GetKey(),
                StudioKeySettings.GetSKey(),
                TenantStatisticsProvider.GetUsersCount());
            if (timeout > 0)
            {
                docServiceConnector.Timeout = timeout;
            }
            try
            {
                return docServiceConnector.GetConvertedUri(
                    FilesLinkUtility.DocServiceConverterUrl,
                    documentUri,
                    fromExtension,
                    toExtension,
                    documentRevisionId,
                    isAsync,
                    out convertedDocumentUri);
            }
            catch (Exception ex)
            {
                throw CustomizeError(ex);
            }
        }
        private static Web.Core.Files.DocumentService GetDocumentService()
        {
            int timeout;

            Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out timeout);

            var documentService = new Web.Core.Files.DocumentService(
                StudioKeySettings.GetKey(),
                StudioKeySettings.GetSKey(),
                TenantStatisticsProvider.GetUsersCount());

            if (timeout > 0)
            {
                documentService.Timeout = timeout;
            }
            return(documentService);
        }
        public static string GenerateValidateKey(string documentRevisionId)
        {
            var docServiceConnector = new Web.Core.Files.DocumentService(
                StudioKeySettings.GetKey(),
                StudioKeySettings.GetSKey(),
                TenantStatisticsProvider.GetUsersCount());

            string userIp = null;
            try
            {
                if (HttpContext.Current != null) userIp = HttpContext.Current.Request.UserHostAddress;
            }
            catch
            {
                userIp = string.Empty;
            }

            return docServiceConnector.GenerateValidateKey(documentRevisionId, userIp);
        }
        public static string GenerateValidateKey(string documentRevisionId)
        {
            var docServiceConnector = new Web.Core.Files.DocumentService(
                StudioKeySettings.GetKey(),
                StudioKeySettings.GetSKey(),
                TenantStatisticsProvider.GetUsersCount());

            string userIp = null;

            try
            {
                if (HttpContext.Current != null)
                {
                    userIp = HttpContext.Current.Request.UserHostAddress;
                }
            }
            catch
            {
                userIp = string.Empty;
            }

            return(docServiceConnector.GenerateValidateKey(GenerateRevisionId(documentRevisionId), userIp));
        }
Ejemplo n.º 7
0
        public static int GetConvertedUri(string documentUri,
                                          string fromExtension,
                                          string toExtension,
                                          string documentRevisionId,
                                          bool isAsync,
                                          out string convertedDocumentUri)
        {
            int timeout;

            Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out timeout);

            var docServiceConnector = new Web.Core.Files.DocumentService(
                StudioKeySettings.GetKey(),
                StudioKeySettings.GetSKey(),
                TenantStatisticsProvider.GetUsersCount());

            if (timeout > 0)
            {
                docServiceConnector.Timeout = timeout;
            }
            try
            {
                return(docServiceConnector.GetConvertedUri(
                           FilesLinkUtility.DocServiceConverterUrl,
                           documentUri,
                           fromExtension,
                           toExtension,
                           documentRevisionId,
                           isAsync,
                           out convertedDocumentUri));
            }
            catch (Exception ex)
            {
                throw CustomizeError(ex);
            }
        }
        public static string CommandRequest(string method,
                                            string documentRevisionId,
                                            string callbackUrl,
                                            string users,
                                            string status)
        {
            int timeout;
            Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out timeout);

            var docServiceConnector = new Web.Core.Files.DocumentService(
                StudioKeySettings.GetKey(),
                StudioKeySettings.GetSKey(),
                TenantStatisticsProvider.GetUsersCount());
            if (timeout > 0)
            {
                docServiceConnector.Timeout = timeout;
            }
            try
            {
                return docServiceConnector.CommandRequest(
                    FilesLinkUtility.DocServiceCommandUrl,
                    method,
                    documentRevisionId,
                    callbackUrl,
                    users,
                    status);
            }
            catch (Exception e)
            {
                throw CustomizeError(e);
            }
        }
        public static string GetExternalUri(Stream fileStream, string contentType, string documentRevisionId)
        {
            int timeout;
            Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out timeout);

            var docServiceConnector = new Web.Core.Files.DocumentService(
                StudioKeySettings.GetKey(),
                StudioKeySettings.GetSKey(),
                TenantStatisticsProvider.GetUsersCount());
            if (timeout > 0)
            {
                docServiceConnector.Timeout = timeout;
            }
            try
            {
                return docServiceConnector.GetExternalUri(
                    FilesLinkUtility.DocServiceStorageUrl,
                    fileStream,
                    contentType,
                    documentRevisionId);
            }
            catch (Exception ex)
            {
                throw CustomizeError(ex);
            }
        }