Пример #1
0
        public string GetVideoUrl(string remoteStoragePrefix)
        {
            switch (type)
            {
            case "1":
            case "youtube":
                return($"www.youtube.com/embed/{code}?wmode=opaque&autoplay=1");

            case "3":
            case "upload":
            case "mydevice":
                return($"{remoteStoragePrefix}{Storages.GetByFileId(file_id).storage_path}");

            case "2":
            case "vimeo":
                return
                    ($"player.vimeo.com/video/{code}?title=0&byline=0&portrait=0&wmode=opaque&autoplay=1");

            case "4":
            case "dailymotion":
                return($"www.dailymotion.com/embed/video/{code}?wmode=opaque&autoplay=1");

            case "6":
            case "embedcode":
            case "iframely":
                return(string.IsNullOrEmpty(code) ? code : "");

            case "fb":
                Dictionary <string, string> data = JsonConvert.DeserializeObject <Dictionary <string, string> >(code);
                return(data["video"]);

            default:
                return(string.Empty);
            }
        }
Пример #2
0
        public FeedImage(uint photoId)
        {
            var storage = Storages.GetByFileId(photoId);

            src  = ServiceUrlPrefixes.CouldFront + storage.storage_path;
            size = JsonConvert.DeserializeObject <FeedImageSize>(storage.@params);
        }
Пример #3
0
        public LikeBy(Like like)
        {
            user_id = like.poster_id;
            var user = Users.GetById((uint)user_id);

            displayname         = user.displayname;
            image_profile       = ServiceUrlPrefixes.CouldFront + Storages.GetByFileId((uint)user.photo_id).storage_path;
            reaction_image_icon = like.reaction;
            image = image_normal = image_icon = image_profile;
        }
Пример #4
0
 public FeedReaction(Reaction reaction, uint count)
 {
     caption = reaction.title;
     if (count > 0)
     {
         reaction_count = count;
     }
     reactionicon_id     = reaction.reactionicon_id;
     reaction_image_icon = ServiceUrlPrefixes.CouldFront + Storages.GetByFileId(reaction.photo_id).storage_path;
 }
Пример #5
0
        public override void Execute()
        {
            var responseList = Banners.GetAll().Where(b => b.file_id > 0).Select(b => new BannerVM
            {
                image            = $"url({ServiceUrlPrefixes.CouldFront + Storages.GetByFileId((uint)b.file_id).storage_path})",
                feed_banner_url  = $"{ServiceUrlPrefixes.CouldFront + Storages.GetByFileId((uint)b.file_id).storage_path}",
                background_color = b.background_color,
                color            = b.color,
                highlighted      = b.highlighted
            }).ToList();

            Response = JsonConvert.SerializeObject(responseList);
        }
Пример #6
0
        private void SetAttachmentData(ActivityAttachment activityAttachment)
        {
            var iface = activityAttachment.GetActivityObject();

            data["type"]        = activityAttachment.type;
            data["title"]       = iface.GetObjectTitle();
            data["description"] = iface.GetObjectDesctiption();
            //data["url"] = HttpUtility.UrlEncode(coreLink.uri);
            if (iface.GetStorageFileId() > 0)
            {
                var storage   = Storages.GetByFileId(iface.GetStorageFileId());
                var imageSize = JsonConvert.DeserializeObject <FeedImageSize>(storage.@params);
                data["img"]        = ServiceUrlPrefixes.CouldFront + storage.storage_path;
                data["img_width"]  = imageSize.width.ToString();
                data["img_height"] = imageSize.height.ToString();
            }

            if (iface is Video)
            {
                var video = iface as Video;
                data["video_type"] = video.type;
                if (video.type == "fb")
                {
                    Dictionary <string, string> code = JsonConvert.DeserializeObject <Dictionary <string, string> >(video.code);
                    data["img"]        = code["thumb"];
                    data["img_width"]  = "600";
                    data["img_height"] = "600";
                }
                //else
                //{
                data["video_code"] = video.code;
                data["url"]        = video.GetVideoUrl(ServiceUrlPrefixes.CouldFront);
                //}
                //if (video.file_id > 0)
                //{
                //    var storage = Storages.GetByFileId(video.file_id);
                //    data["url"] = HttpUtility.UrlEncode(ServiceUrlPrefixes.CouldFront + storage.storage_path);
                //}
            }

            if (iface is CoreLink)
            {
                var link = iface as CoreLink;
                data["url"] = link.uri;
            }
        }
Пример #7
0
 public Storage Get(uint fileId)
 {
     ///
     return(Storages.GetByFileId(fileId));
 }