示例#1
0
        public STA(IConnection con, string raw)
            : base(con, raw)
        {
            if (param == null)
            {
                return;
            }
            if (param.Count >= 2 && param[0].Length == 3)
            {
                severity = param[0].Substring(0, 1);
                code     = param[0].Substring(1);
                content  = AdcProtocol.ConvertIncomming(param[1]);
                valid    = true;
            }

            for (int i = 2; i < param.Count; i++)
            {
                if (param[i].Length < 2)
                {
                    continue;
                }
                string key   = param[i].Substring(0, 2);
                string value = param[i].Substring(2);
                switch (key)
                {
                case "FC":
                    pfc = value;
                    break;

                case "TL":
                    ptl = value;
                    break;

                case "FL":
                    pfl = value;
                    break;

                case "TO":
                    pto = value;
                    break;

                case "PR":
                    ppr = value;
                    break;

                case "IP":
                    pip = value;
                    break;
                }
            }
        }
示例#2
0
        public RES(IConnection con, string raw)
            : base(con, raw)
        {
            info = new ContentInfo();
            foreach (string var in param)
            {
                if (var.Length < 2)
                {
                    continue;
                }
                string key   = var.Substring(0, 2);
                string value = var.Substring(2);
                switch (key)
                {
                case "FN":
                    info.Set(ContentInfo.VIRTUAL, AdcProtocol.ConvertIncomming(value));
                    valid = true;
                    break;

                case "SI":
                    try
                    {
                        info.Size = long.Parse(value);
                    }
                    catch { }
                    break;

                case "SL":
                    try
                    {
                        slots = long.Parse(value);
                    }
                    catch { }
                    break;

                case "TO":
                    token = value;
                    break;

                case "TR":
                    info.Set(ContentInfo.TTH, value);
                    break;

                default:
                    // We dont know this value but to allow developer to support this anyway we will store it.
                    info.Set(key, value);
                    break;
                }
            }
        }
示例#3
0
        /// <summary>
        /// Constructor for recieving
        /// </summary>
        /// <param name="hub"></param>
        /// <param name="raw"></param>
        public MSG(IConnection con, string raw)
            : base(con, raw)
        {
            //I: IMSG Have\sa\snice\sday,\sand\sbehave\s;)
            //B: BMSG SHJV PIP
            //D: DMSG SHJV SH5B PIIP!! PMSHJV
            if (param == null)
            {
                return;
            }
            if (param.Count >= 1)
            {
                from    = id;
                to      = idtwo;
                content = param[0];
            }
            // Param
            for (int i = 1; i < param.Count; i++)
            {
                if (param[i].Length < 2)
                {
                    continue;
                }
                string key   = param[i].Substring(0, 2);
                string value = param[i].Substring(2);
                switch (key)
                {
                case "PM":
                    pmgroup = value;
                    break;

                case "ME":
                    me = value.Equals("1");
                    break;
                }
            }

            // Replacing stuff
            if (content != null)
            {
                content = AdcProtocol.ConvertIncomming(content);
                valid   = true;
            }
        }
示例#4
0
        // Receiving
        public INF(IConnection con, string raw)
            : base(con, raw)
        {
            if (param == null)
            {
                return;
            }
            info.TagInfo.GenerateTag = true;
            info.Set(UserInfo.SID, id);

            if (typeValid)
            {
                valid = true;
            }

            // IINF is from hub. all other should be from user =)
            // NIDCDev\sPublic HU1 HI1 DEThe\spublic\sDirect\sConnect\sdevelopment\shub VEADCH++\sv2.0.0-Release
            // TUOD SF0 SL1 SS0 SUTCP4,UDP4 DEPASIV HN4 HO0 HR0 I489.38.33.162 U41090 IDARJQDWZKC4MMC7PLQNOYSPHVI7V62QPS4IRF5KA [email protected] US104857600 VE++\s0.698 NI[RO][B][QUICK-NET]LIVIU
            for (int i = 0; i < param.Count; i++)
            {
                if (param[i].Length < 2)
                {
                    continue;
                }
                string key   = param[i].Substring(0, 2);
                string value = param[i].Substring(2);
                switch (key)
                {
                case "ID":
                    info.Set(UserInfo.CID, value);
                    break;

                case "I4":
                    info.Set(UserInfo.IP, value);
                    break;

                case "I6":
                    info.Set(UserInfo.IP, value);
                    break;

                case "U4":
                    info.Set(UserInfo.UDPPORT, value);
                    break;

                case "U6":
                    info.Set(UserInfo.UDPPORT, value);
                    break;

                case "SS":
                    info.Share = value;
                    break;

                //case "SF":
                //    break;
                //case "US":
                //    break;
                //case "DS":
                //    break;
                case "SL":
                    try
                    {
                        info.TagInfo.Slots = int.Parse(value);
                    }
                    catch (System.Exception)
                    {
                        info.TagInfo.Slots = 0;
                    }
                    break;

                //case "AS":
                //    break;
                //case "AM":
                //    break;
                case "EM":
                    info.Email = AdcProtocol.ConvertIncomming(value);
                    break;

                case "HN":
                    try
                    {
                        info.TagInfo.Normal = int.Parse(value);
                    }
                    catch (System.Exception)
                    {
                        info.TagInfo.Normal = 0;
                    }
                    break;

                case "HR":
                    try
                    {
                        info.TagInfo.Regged = int.Parse(value);
                    }
                    catch (System.Exception)
                    {
                        info.TagInfo.Regged = 0;
                    }
                    break;

                case "HO":
                    try
                    {
                        info.TagInfo.OP = int.Parse(value);
                    }
                    catch (System.Exception)
                    {
                        info.TagInfo.OP = 0;
                    }
                    break;

                case "TO":
                    token = value;
                    info.Set(key, value);
                    break;

                case "OP":          // Before ADC 1.0
                    info.IsOperator = (value == "1");
                    break;

                //case "AW":
                //    break;
                //case "BO":
                //    break;
                //case "HI":
                //    break;
                //case "HU":
                //    break;
                //case "SU":
                //    break;
                case "NI":
                    info.DisplayName = AdcProtocol.ConvertIncomming(value);
                    break;

                case "VE":
                    info.TagInfo.Version = AdcProtocol.ConvertIncomming(value);
                    break;

                case "DE":
                    info.Description = AdcProtocol.ConvertIncomming(value);
                    break;

                case "CT":
                    try
                    {
                        info.Account = int.Parse(value);
                    }
                    catch { }
                    break;

                case "SU":
                    info.Set(key, value);
                    string[] supports = value.Split(',');
                    foreach (string sup in supports)
                    {
                        switch (sup)
                        {
                        case "ADC0":
                            info.Set(UserInfo.SECURE, "");
                            break;
                        }
                    }
                    break;

                default:
                    // We will add all unhandled fields to user. This is because developer may know how to handle it even if we dont.
                    info.Set(key, value);
                    break;
                }
            }
        }