Exemplo n.º 1
0
        // Token: 0x0600303A RID: 12346 RVA: 0x0011AC24 File Offset: 0x00118E24
        internal static bool IsWebReadyDocument(DocumentLibraryObjectId objectId, UserContext userContext)
        {
            IDocument document;

            try
            {
                document = DocumentLibraryUtilities.LoadDocumentLibraryItem(objectId, userContext);
            }
            catch (AccessDeniedException)
            {
                ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI access is denied.");
                return(false);
            }
            catch (ObjectNotFoundException)
            {
                ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI object not found.");
                return(false);
            }
            if (document == null)
            {
                return(false);
            }
            PropertyDefinition propertyDefinition = null;

            if ((objectId.UriFlags & UriFlags.SharepointDocument) == UriFlags.SharepointDocument)
            {
                propertyDefinition = SharepointDocumentSchema.FileType;
            }
            else if ((objectId.UriFlags & UriFlags.UncDocument) == UriFlags.UncDocument)
            {
                propertyDefinition = UncDocumentSchema.FileType;
            }
            object obj = document.TryGetProperty(propertyDefinition);
            string mimeType;

            if (!(obj is PropertyError))
            {
                mimeType = (obj as string);
            }
            else
            {
                mimeType = string.Empty;
            }
            string fileName = Path.GetFileName(document.Uri.ToString());
            string fileExtension;

            if (string.IsNullOrEmpty(fileName))
            {
                fileExtension = string.Empty;
            }
            else
            {
                fileExtension = Path.GetExtension(fileName);
            }
            return(AttachmentUtility.IsWebReadyDocument(fileExtension, mimeType));
        }
Exemplo n.º 2
0
        // Token: 0x06002D5A RID: 11610 RVA: 0x000FE9BC File Offset: 0x000FCBBC
        protected void DataBind(DocumentLibraryObjectId objectId)
        {
            this.PreDataBind();
            IDocument document;

            try
            {
                document = DocumentLibraryUtilities.LoadDocumentLibraryItem(objectId, base.UserContext);
            }
            catch (AccessDeniedException)
            {
                ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI access is denied.");
                Utilities.TransferToErrorPage(base.OwaContext, LocalizedStrings.GetNonEncoded(234621291));
                return;
            }
            catch (ObjectNotFoundException)
            {
                ExTraceGlobals.DocumentsTracer.TraceDebug(0L, "URI object not found.");
                Utilities.TransferToErrorPage(base.OwaContext, LocalizedStrings.GetNonEncoded(1599334062));
                return;
            }
            if (document == null)
            {
                throw new OwaInvalidRequestException("objectId is invalid for unc/wss document");
            }
            object obj = document.TryGetProperty(this.contentTypePropertyDefinition);

            if (!(obj is PropertyError))
            {
                this.contentType = (obj as string);
            }
            else
            {
                this.contentType = string.Empty;
            }
            this.stream   = document.GetDocument();
            this.fileName = Path.GetFileName(document.Uri.ToString());
            if (!string.IsNullOrEmpty(this.fileName))
            {
                this.fileName = HttpUtility.UrlDecode(this.fileName);
            }
        }