示例#1
0
        public static ChItem Parse(string[] toks)
        {
            ChItem chItem = new ChItem(toks[0], toks[1], toks[2], Int32.Parse(toks[3]), (toks[4] == "1" ? true : false));

            chItem.Available = ItemAvailable.Parse(toks.Skip(4).ToArray());
            return(chItem);
        }
示例#2
0
        public static ItemAvailable Parse(string[] toks)
        {
            ItemAvailable a = new ItemAvailable();

            a.IsFree        = String.IsNullOrEmpty(toks[0]) ? (bool?)null : Int32.Parse(toks[0]) == 1;
            a.RankId        = String.IsNullOrEmpty(toks[1]) ? (int?)null : Int32.Parse(toks[1]);
            a.Prestige      = String.IsNullOrEmpty(toks[2]) ? (int?)null : Int32.Parse(toks[2]);
            a.ChallengeType = String.IsNullOrEmpty(toks[3]) ? (int?)null : Int32.Parse(toks[3]);
            a.ChallengeName = toks[4];
            a.AccessFlag    = String.IsNullOrEmpty(toks[5]) ? (int?)null : Int32.Parse(toks[5]);

            if (!String.IsNullOrEmpty(toks[6]))
            {
                a.AccessInfo = new Dictionary <int, ItemAvailable>();
                int      startI;
                int      length;
                string   content     = toks[6].GetFoldingContent(out startI, out length);
                string[] contentToks = content.SplitWithFolding();
                foreach (string contentTok in contentToks)
                {
                    if (String.IsNullOrEmpty(contentTok))
                    {
                        continue;
                    }

                    string   accessContent = contentTok.GetFoldingContent(out startI, out length);
                    string[] accessToks    = accessContent.SplitWithFolding();
                    int      iAccessFlag   = Int32.Parse(accessToks[0]);

                    ItemAvailable access = new ItemAvailable();
                    access.IsFree        = String.IsNullOrEmpty(accessToks[1]) ? (bool?)null : Int32.Parse(accessToks[1]) == 1;
                    access.RankId        = String.IsNullOrEmpty(accessToks[2]) ? (int?)null : Int32.Parse(accessToks[2]);
                    access.Prestige      = String.IsNullOrEmpty(accessToks[3]) ? (int?)null : Int32.Parse(accessToks[3]);
                    access.ChallengeType = String.IsNullOrEmpty(accessToks[4]) ? (int?)null : Int32.Parse(accessToks[4]);
                    access.ChallengeName = accessToks[5];

                    if (!a.AccessInfo.Keys.Contains(iAccessFlag))
                    {
                        a.AccessInfo.Add(iAccessFlag, access);
                    }

                    a.AccessInfo[iAccessFlag] = access;
                }
            }

            return(a);
        }