Example #1
0
 public MediaObjectInfo NewMediaObject(string blogid, string username, string password, MediaObject mediaObject)
 {
     _logger.LogInformation($"MetaWeblog:NewMediaObject is called");
     return(_provider.NewMediaObject(blogid, username, password, mediaObject));
 }
Example #2
0
        public MediaObjectInfo NewMediaObject(string blogid, string username, string password, MediaObject mediaObject)
        {
            EnsureUser(username, password).Wait();

            var filenameonly = mediaObject.name.Substring(mediaObject.name.LastIndexOf('/') + 1);
            var ext          = Path.GetExtension(filenameonly);

            var target = new IOClient();

            var             key        = GetFileName(ext);
            MediaObjectInfo objectInfo = new MediaObjectInfo();

            var bits = Convert.FromBase64String(mediaObject.bits);

            objectInfo.url = _qiniuService.Upload(key, bits).Result;
            return(objectInfo);
        }