Пример #1
0
        public void Post(VideoSend request)
        {
            if (string.IsNullOrWhiteSpace(request.Name))
            {
                throw new ArgumentException("Name cannot be empty.");
            }
            if (string.IsNullOrWhiteSpace(request.Path))
            {
                throw new ArgumentException("Path cannot be empty.");
            }
            if (string.IsNullOrWhiteSpace(request.UserId))
            {
                throw new ArgumentException("UserId cannot be empty.");
            }

            var list = Plugin.Instance.Configuration.Bookmarks.ToList();

            list.Add(new Bookmark
            {
                UserId   = request.UserId,
                Name     = request.Name,
                Image    = request.ImagePath,
                Path     = request.Path,
                Protocol = request.Protocol
            });

            Plugin.Instance.Configuration.Bookmarks = list.ToArray();

            Plugin.Instance.SaveConfiguration();
        }
Пример #2
0
        public void Post(VideoSend request)
        {
            if (string.IsNullOrWhiteSpace(request.Name))
            {
                throw new ArgumentException("Name cannot be empty.");
            }
            if (string.IsNullOrWhiteSpace(request.Path))
            {
                throw new ArgumentException("Path cannot be empty.");
            }
            if (string.IsNullOrWhiteSpace(request.UserId))
            {
                throw new ArgumentException("UserId cannot be empty.");
            }

            var list = Plugin.Instance.Configuration.Bookmarks.ToList();

            list.Add(new Bookmark
            {
                UserId = request.UserId,
                Name = request.Name,
                Image = request.ImagePath,
                Path = request.Path,
                Protocol = request.Protocol
            });

            Plugin.Instance.Configuration.Bookmarks = list.ToArray();

            Plugin.Instance.SaveConfiguration();
        }