Esempio n. 1
0
        // 当算子为AttributesPlusTerm时
        // parameters:
        // return:
        //		NULL
        //		其他
        int BldAttributesPlusTerm(BerNode param,
                                  string strToken)
        {
            BerNode subparam = null;
            // string strQuery = "";
            int    three        = 3;
            string strTerm      = "";
            string strAttrType  = "";
            string strAttrValue = "";

            param = param.NewChildConstructedNode(BerTree.z3950_AttributesPlusTerm,
                                                  ASN1_CONTEXT);
            subparam = param.NewChildConstructedNode(
                BerTree.z3950_AttributeList,
                ASN1_CONTEXT);

            DivideToken(strToken,
                        out strTerm,
                        out strAttrType,
                        out strAttrValue);

            // 缺省值
            if (strAttrType == "")
            {
                strAttrType = "1";
            }
            if (strAttrValue == "")
            {
                strAttrValue = "4";
            }

            /*
             * strMessage.Format("term[%s] attrtype[%s] attrvalue[%s]",
             *  strTerm,
             *  strAttrType,
             *  strAttrValue);
             */
            try
            {
                HandleQuery(param,
                            subparam,
                            strTerm,
                            strAttrType,
                            strAttrValue);
            }
            catch (Exception ex)
            {
                throw new Exception("BldAttributesPlusTerm() 处理 token '" + strToken + "' 过程中出现异常", ex);
            }

            if (strToken.IndexOf('/', 0) == -1)
            {
                BerNode seq = null;
                seq = subparam.NewChildConstructedNode(
                    ASN1_SEQUENCE,
                    ASN1_UNIVERSAL);
                // TRACE("pSeq->m_uTag=%d",pSeq->m_uTag);
                seq.NewChildIntegerNode(BerTree.z3950_AttributeType,
                                        ASN1_CONTEXT,
                                        BitConverter.GetBytes((Int16)three)); /* position */
                // 一样?
                seq.NewChildIntegerNode(BerTree.z3950_AttributeValue,
                                        ASN1_CONTEXT,
                                        BitConverter.GetBytes((Int16)three)); /* position */
            }

            return(0);
        }
Esempio n. 2
0
 int PushToArray(BerNode param)
 {
     this.m_StackArray.Add(param);
     return(0);
 }