Esempio n. 1
0
 internal OpenrecOptionsViewModel(OpenrecSiteOptions siteOptions)
 {
     _origin  = siteOptions;
     _changed = siteOptions.Clone();
     ShowOpenStampMusicSelectorCommand = new RelayCommand(ShowOpenStampMusicSelector);
     ShowOpenYellMusicSelectorCommand  = new RelayCommand(ShowOpenYellMusicSelector);
 }
Esempio n. 2
0
        public CommentProvider(ICommentOptions options, OpenrecSiteOptions siteOptions, ILogger logger, IUserStoreManager userStoreManager)
        {
            _options              = options;
            _siteOptions          = siteOptions;
            _logger               = logger;
            _userStoreManager     = userStoreManager;
            _dataSource           = new DataSource();
            _500msTimer.Interval  = 500;
            _500msTimer.Elapsed  += _500msTimer_Elapsed;
            _500msTimer.AutoReset = true;

            CanConnect    = true;
            CanDisconnect = false;
        }
        public override void LoadOptions(string path, IIo io)
        {
            _siteOptions = new OpenrecSiteOptions();
            try
            {
                var s = io.ReadFile(path);

                _siteOptions.Deserialize(s);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                _logger.LogException(ex, "", $"path={path}");
            }
        }
Esempio n. 4
0
        public static IOpenrecCommentData CreateCommentData(IComment obj, DateTime startAt, OpenrecSiteOptions siteOptions)
        {
            var nameIcons = new List <IMessagePart>();

            if (obj.IsOfficial)
            {
                var officialIcon = new MessageImagePortion
                {
                    Alt       = "オフィシャルユーザー",
                    Height    = 20,
                    Width     = 20,
                    Image     = Properties.Resources.sprite_v5,
                    SrcX      = 14,
                    SrcY      = 268,
                    SrcHeight = 30,
                    SrcWidth  = 30,
                };
                nameIcons.Add(officialIcon);
            }
            if (obj.IsModerating)
            {
                var premiumIcon = new MessageImagePortion
                {
                    Alt       = "スタッフ",
                    Height    = 20,
                    Width     = 20,
                    Image     = Properties.Resources.sprite_v5,
                    SrcX      = 524,
                    SrcY      = 384,
                    SrcHeight = 30,
                    SrcWidth  = 30,
                };
                nameIcons.Add(premiumIcon);
            }
            if (obj.IsPremium)
            {
                var premiumIcon = new MessageImagePortion
                {
                    Alt       = "プレミアム会員",
                    Height    = 20,
                    Width     = 20,
                    Image     = Properties.Resources.sprite_v6,
                    SrcX      = 96,
                    SrcY      = 86,
                    SrcHeight = 30,
                    SrcWidth  = 30,
                };
                nameIcons.Add(premiumIcon);
            }
            if (obj.IsFresh)
            {
                var premiumIcon = new MessageImagePortion
                {
                    Alt       = "新規ユーザー",
                    Height    = 20,
                    Width     = 21,
                    Image     = Properties.Resources.sprite_v5,
                    SrcX      = 62,
                    SrcY      = 314,
                    SrcHeight = 30,
                    SrcWidth  = 32,
                };
                nameIcons.Add(premiumIcon);
            }

            var text = Tools.DecodeHtmlEntity(obj.Message);

            IMessageImage stamp = null;

            if (!string.IsNullOrEmpty(obj.StampUrl))
            {
                var stampIcon = new MessageImage
                {
                    Alt    = "",
                    Url    = obj.StampUrl,
                    Height = siteOptions.StampSize,
                    Width  = siteOptions.StampSize,
                };
                stamp = stampIcon;
            }

            var yellPoints = obj.YellPoints?.ToString();

            var postTime = obj.PostedAt;

            return(new OpenrecCommentData
            {
                Name = obj.Nickname,
                NameIcons = nameIcons,
                Message = text,
                Stamp = stamp,
                YellPoints = yellPoints,
                Id = obj.Id,
                UserId = obj.UserId,
                PostTime = postTime,
                Elapsed = postTime - startAt,
                UserIconUrl = obj.UserIconUrl,
            });
        }