示例#1
0
文件: SafeModel.cs 项目: burstas/rmps
 /// <summary>
 /// 关键搜索
 /// </summary>
 /// <returns></returns>
 public Att InitMeta()
 {
     MetaAtt meta = new MetaAtt();
     _AttList.Add(meta);
     return meta;
 }
示例#2
0
文件: SafeModel.cs 项目: burstas/rmps
        /// <summary>
        /// 
        /// </summary>
        /// <param name="key"></param>
        public void Decode(string key)
        {
            // 查询数据是否为空
            if (key.Length < 1)
            {
                return;
            }
            key = _UserModel.Decode(key);

            _AttList.Clear();

            // Guid
            GuidAtt guid = new GuidAtt();
            guid.Name = Key.RegDate;
            guid.Data = Key.CatId;
            guid.SetSpec(GuidAtt.SPEC_GUID_TPLT, Key.LibId);
            _AttList.Add(guid);

            // MetaItem
            MetaAtt meta = new MetaAtt();
            meta.Name = Key.Title;
            meta.Data = Key.MetaKey;
            _AttList.Add(meta);

            // LogoItem
            LogoAtt logo = new LogoAtt();
            logo.Name = Key.IcoName;
            logo.Data = Key.IcoMemo;
            logo.setPath(Key.IcoPath);
            _AttList.Add(logo);

            // HintItem
            HintAtt hint = new HintAtt();
            hint.Data = Key.GtdId;
            hint.Name = Key.GtdMemo;
            hint.GtdHeader = Key.GtdHeader;
            _AttList.Add(hint);

            // 处理每一个数据
            string[] arr = key.Split(Att.SP_SQL_EE);
            int o = 1;
            for (int i = 0, j = arr.Length - 1; i < j; i += 1)
            {
                string s = arr[i] + Att.SP_SQL_KV;
                int dn = s.IndexOf(Att.SP_SQL_KV);
                int dd = s.IndexOf(Att.SP_SQL_KV, dn + 1);
                int ds = s.IndexOf(Att.SP_SQL_KV, dd + 1);

                int type = int.Parse(s.Substring(0, dn));
                string name = s.Substring(dn + 1, dd - dn - 1);
                string data = s.Substring(dd + 1, ds - dd - 1);
                string spec = s.Substring(ds + 1);
                Att item = Att.GetInstance(type, name, data);
                item.Order = (o++).ToString();
                if (spec.Length > 0)
                {
                    item.DecodeSpec(spec, Att.SP_SQL_KV);
                }
                _AttList.Add(item);
            }
        }