Beispiel #1
0
        public override bool Equals(object obj)
        {
            VideoNodeKey key = obj as VideoNodeKey;

            if (key == this)
            {
                return(true);
            }
            if (key == null)
            {
                return(false);
            }
            AuthKey authkey = new AuthKey()
            {
                Auth = key.Auth, PlatForm = key.PlatForm
            };

            if (PlatFormCache.Instance.AuthItems.ContainsKey(authkey))
            {
                return(key.PlatForm == PlatForm && key.Type == Type && PlatFormCache.Instance.AuthItems[authkey] == Auth);
            }
            key.Auth     = null;
            key.PlatForm = authkey.PlatForm;
            return(key.PlatForm == PlatForm && key.Type == Type && key.Auth == Auth);
        }
        public void Init()
        {
            if (_inited)
            {
                return;
            }
            var types = BoxTypeCache.Instance.Items.Values;
            var plats = PlatformUtils.FormatVodPlatform();
            var list  = new Dictionary <VideoNodeKey, int>(types.Count * plats.Count + 1);
            var fb    = new Dictionary <VideoNodeKey, bool>(plats.Count);
            int i     = 0;

            foreach (var f in plats)
            {
                var key = new VideoNodeKey(f.PlatformName, 0, f.Licence);
                fb.Add(key, f.IsForbiddenSupport);
                list.Add(key, ++i);
                foreach (var type in types)
                {
                    list.Add(new VideoNodeKey(f.PlatformName, type.TypeID, f.Licence), ++i);
                }
            }
            list.Add(new VideoNodeKey(AuthNode.NoPlatFormName, 0, AuthNode.NoPlatFormLicence), ++i);
            _list      = list;
            _forbidden = fb;
            _inited    = true;
        }
        public void ForbiddenInit()
        {
            var plats = PlatformUtils.FormatVodPlatform();
            var fb    = new Dictionary <VideoNodeKey, bool>(plats.Count);

            foreach (var f in plats)
            {
                var key = new VideoNodeKey(f.PlatformName, 0, f.Licence);
                fb.Add(key, f.IsForbiddenSupport);
            }
            _forbidden = fb;
        }