Esempio n. 1
0
        public static List <Image> ConvertUrlToImages(PhotoListResponse data)
        {
            var imageList = new List <Image>();

            try
            {
                if (!string.IsNullOrEmpty(data.data.cover))
                {
                    imageList.Add(ReadImage(data.data.cover));
                }
                if (data.data != null)
                {
                    foreach (var img in data.data.large)
                    {
                        imageList.Add(ReadImage(img));
                    }
                }
            }
            catch (Exception ex)
            {
                return(imageList);
            }

            return(imageList);
        }
Esempio n. 2
0
        public static byte[] ConvertMultipleImageIntoOne(PhotoListResponse data)
        {
            var images = ConvertUrlToImages(data);
            var oneImg = Merge(images);

            return(SaveImageToByteArray(oneImg));
        }
Esempio n. 3
0
        //發送訊息到line
        public void PubNotify(houseEntity house, PhotoListResponse photos)
        {
            var form = new LineNotifyEntity();

            form.message = Helper.NotifyMessageBuilder(house);
            if (photos != null)
            {
                var imageByte = ImageProcessor.ConvertMultipleImageIntoOne(photos);
                LineNotifyApi(form, imageByte);
            }
            else
            {
                LineNotifyApi(form);
            }
        }
Esempio n. 4
0
        public PhotoListResponse GetPhotoList(houseEntity house)
        {
            var url               = UrlGenerator._BaseUrl + UrlGenerator._PhotoListUrl + $"?post_id={house.post_id}&type=1";
            var response          = Get591Response(url, Method.GET).Content;
            var PhotoListResponse = new PhotoListResponse();

            try
            {
                PhotoListResponse = JsonConvert.DeserializeObject <PhotoListResponse>(response);
            }
            catch
            {
                return(null);
            }

            return(PhotoListResponse);
        }