cn.jpush.api/push/mode/Platform.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using cn.jpush.api.common;
using cn.jpush.api.util;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Diagnostics;

namespace cn.jpush.api.push.mode
{
   public class Platform 
    {
        private  const String ALL = "all";
        [JsonProperty(PropertyName = "winphone")]
        public string allPlatform{get;set;}
        private HashSet<string> _deviceTypes;
        public HashSet<string> deviceTypes
        {
            get
            {
                return _deviceTypes;
            }
            set
            {
                if (value != null)
                {
                    allPlatform = null;
                }
                _deviceTypes = value;
            }
        }
        private Platform()
        {
            allPlatform = ALL;
            deviceTypes = null;
        }
        private Platform(bool all, HashSet<string> deviceTypes)
        {
            //用来判断all=true时deviceTypes必须为空,反之当all=false时deviceTypes有值,不然json序列化会出错
            Debug.Assert(all && deviceTypes == null || !all && deviceTypes != null);
            if (all)
            {
                allPlatform = ALL;
            }
            this.deviceTypes = deviceTypes;
        }
        public static Platform all()
        {
            return new Platform(true, null).Check();
        }
        public static Platform ios()
        {
            HashSet<string> types = new HashSet<string>();
            types.Add(DeviceType.ios.ToString());
            return new Platform(false,types).Check();
        }
        public static Platform android()
        {
            HashSet<string> types = new HashSet<string>();
            types.Add(DeviceType.android.ToString());
            return new Platform(false, types).Check();
后面还有 54 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。