/// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public static BinaryResourceDescriptor CreateDescriptor(byte[] resource, eBinaryResourceLocationType locationType, object locationDescriptor)
        {
            BinaryResourceDescriptor descriptor = new BinaryResourceDescriptor();

            try
            {
                // Construct descriptor
                if (locationType.Equals(eBinaryResourceLocationType.Http))
                {
                    var locDesc = locationDescriptor as HttpLocationDescriptor;
                    descriptor.LocationDescriptorJson = (new HttpLocationDescriptor { Uri = locDesc.Uri }).ToJSON();

                    // Use Dropbox's REST API to upload resource
                }
                else if (locationType.Equals(eBinaryResourceLocationType.RedisDB))
                {
                    var locDesc = locationDescriptor as RedisDBLocationDescriptor;
                    descriptor.LocationDescriptorJson = (new RedisDBLocationDescriptor()).ToJSON();
                }
            }
            catch (Exception ex)
            {
                descriptor = null;
                DebugEx.Assert(ex, "Error constructing descriptor for specified resource");
            }

            return descriptor;
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static BinaryResourceDescriptor CreateDescriptor(byte[] resource, eBinaryResourceLocationType locationType, object locationDescriptor)
        {
            BinaryResourceDescriptor descriptor = new BinaryResourceDescriptor();

            try
            {
                // Construct descriptor
                if (locationType.Equals(eBinaryResourceLocationType.Http))
                {
                    var locDesc = locationDescriptor as HttpLocationDescriptor;
                    descriptor.LocationDescriptorJson = (new HttpLocationDescriptor {
                        Uri = locDesc.Uri
                    }).ToJSON();

                    // Use Dropbox's REST API to upload resource
                }
                else if (locationType.Equals(eBinaryResourceLocationType.RedisDB))
                {
                    var locDesc = locationDescriptor as RedisDBLocationDescriptor;
                    descriptor.LocationDescriptorJson = (new RedisDBLocationDescriptor()).ToJSON();
                }
            }
            catch (Exception ex)
            {
                descriptor = null;
                DebugEx.Assert(ex, "Error constructing descriptor for specified resource");
            }

            return(descriptor);
        }
 public BinaryResourceDescriptor(string name,
                                 eBinaryResourceContentType contentType,
                                 eBinaryResourceLocationType locationType,
                                 ContentDescriptor contentDescriptor,
                                 LocationDescriptor locationDescriptor,
                                 int size           = 0,
                                 string description = "")
 {
     this.FriendlyName        = name;
     this.FriendlyDescription = description;
     this.Size                   = size;
     this.ContentType            = contentType;
     this.LocationType           = locationType;
     this.ContentDescriptorJson  = contentDescriptor.ToJSON();
     this.LocationDescriptorJson = locationDescriptor.ToJSON();
 }
 public BinaryResourceDescriptor(string name,
                                 eBinaryResourceContentType contentType,
                                 eBinaryResourceLocationType locationType,
                                 ContentDescriptor contentDescriptor,
                                 LocationDescriptor locationDescriptor,
                                 int size = 0,
                                 string description = "")
 {
     this.FriendlyName = name;
     this.FriendlyDescription = description;
     this.Size = size;
     this.ContentType = contentType;
     this.LocationType = locationType;
     this.ContentDescriptorJson = contentDescriptor.ToJSON();
     this.LocationDescriptorJson = locationDescriptor.ToJSON();
 }