示例#1
0
 internal static ICHXHtppRequestConverter GetRecycle(CHXContentType contentType)
 {
     if (contentType == CHXContentType.JSON)
     {
         return(new ContentTypeContainer.CHXJson());
     }
     else
     {
         return(null);
     }
 }
示例#2
0
 public static ICHXHtppRequestConverter GetBodyConverter(CHXContentType contentType)
 {
     if (contentType == CHXContentType.JSON)
     {
         return(new ContentTypeContainer.CHXJson());
     }
     else
     {
         return(null);
     }
 }
示例#3
0
        private static object GetMetadata(CHXContentType ct)
        {
            var type = ct.GetType();

            MemberInfo[] info = type.GetMember(ct.ToString());
            if ((info != null) && (info.Length > 0))
            {
                object[] attrs = info[0].GetCustomAttributes(typeof(CHXMetadata), false);
                if ((attrs != null) && (attrs.Length > 0))
                {
                    return(attrs[0]);
                }
            }
            return(null);
        }
示例#4
0
        public static bool IsBinary(this CHXContentType ct)
        {
            var metadata = GetMetadata(ct);

            return((metadata != null) ? ((CHXMetadata)metadata).IsBinary : false);
        }
示例#5
0
        public static bool IsText(this CHXContentType ct)
        {
            var metadata = GetMetadata(ct);

            return((metadata != null) ? ((CHXMetadata)metadata).IsText : true);
        }
示例#6
0
        public static string ToValue(this CHXContentType ct)
        {
            var metadata = GetMetadata(ct);

            return((metadata != null) ? ((CHXMetadata)metadata).Value : ct.ToString());
        }