private NpCloudSocketSystem(string url, NpCloudSocketType type, string hashKey)
 {
     this.mSetting = new NpCloudSetting(type, url);
     if (type != NpCloudSocketType.TCP)
     {
         if (type == NpCloudSocketType.Web)
         {
             this.mSocketSystem = new NpCloudWebSocketSystem(this.mSetting, hashKey);
         }
     }
     else
     {
         this.mSocketSystem = new NpCloudTCPSocketSystem(this.mSetting, hashKey);
     }
 }
Example #2
0
        protected byte[] CreateLoginParameter(NpCloudSetting setting, object option)
        {
            string[] array = setting.ProjectId.Split(new char[]
            {
                '.'
            });
            string str = setting.ProjectId;

            if (array.Length > 1)
            {
                str = array[1];
            }
            NpCloudRequestParameter npCloudRequestParameter = new NpCloudRequestParameter();

            npCloudRequestParameter.content = new Dictionary <string, object>
            {
                {
                    "projectId",
                    setting.ProjectId
                },
                {
                    "projectPass",
                    str + "pass"
                },
                {
                    "userId",
                    setting.UserId
                }
            };
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            dictionary.Add("value", NpCloudCommandType.login.ToString());
            if (option != null)
            {
                dictionary.Add("option", option);
            }
            npCloudRequestParameter.command = dictionary;
            npCloudRequestParameter.type    = "direct";
            MemoryStream memoryStream = new MemoryStream();

            NpMessagePack.Pack <object>(npCloudRequestParameter, memoryStream);
            return(this.AddHeaderBuffer(memoryStream.GetBuffer(), NpCloudHeaderType.CommonMsg));
        }
Example #3
0
 public NpCloudWebSocketSystem(NpCloudSetting setting, string hashKey) : base(hashKey)
 {
     this.mSetting = setting;
 }