private void SetContentDisposition(PropertyContextSurface context)
        {
            INakedObjectSurface no = context.Property.GetNakedObject(context.Target);
            string cd = no != null?no.GetAttachment().ContentDisposition : AttachmentContext.DefaultContentDisposition;

            string fn = no != null?no.GetAttachment().FileName : AttachmentContext.DefaultFileName;

            ContentDisposition = new ContentDispositionHeaderValue(cd)
            {
                FileName = fn
            };
        }
Exemplo n.º 2
0
        public MediaTypeHeaderValue GetAttachmentMediaType()
        {
            INakedObjectSurface no = assoc.GetNakedObject(nakedObject);
            string mtv             = no != null?no.GetAttachment().MimeType : "";

            return(new MediaTypeHeaderValue(string.IsNullOrWhiteSpace(mtv) ? "image/bmp" : mtv));
        }
        private void SetContentType(PropertyContextSurface context)
        {
            INakedObjectSurface no = context.Property.GetNakedObject(context.Target);
            string mtv             = no != null?no.GetAttachment().MimeType : AttachmentContext.DefaultMimeType;

            contentType = new MediaTypeHeaderValue(mtv);
        }
        private void SetStream(PropertyContextSurface context)
        {
            INakedObjectSurface no = context.Property.GetNakedObject(context.Target);

            AsStream = no != null?no.GetAttachment().Content : new MemoryStream();
        }
        protected string GetAttachmentFileName(PropertyContextSurface context)
        {
            INakedObjectSurface no = context.Property.GetNakedObject(context.Target);

            return(no != null?no.GetAttachment().FileName : "UnknownFile");
        }