Exemplo n.º 1
0
        // 当算子为ResultSetId时
        // parameters:
        int BldResultSetId(BerNode param,
                           string strToken)
        {
            param.NewChildCharNode(BerTree.z3950_ResultSetId,
                                   ASN1_CONTEXT,
                                   Encoding.UTF8.GetBytes(strToken));

            return(0);
        }
Exemplo n.º 2
0
        // 构造非near、within运算符的子树
        // parameters:
        int BuildGeneral(BerNode param,
                         string strToken,
                         int nType)
        {
            Debug.Assert(nType <= 0xffff, "");  // 避免转换为unsigned short int时候出问题

            param.NewChildCharNode((ushort)nType,
                                   ASN1_CONTEXT,
                                   Encoding.UTF8.GetBytes(strToken)); // ,0);?????

            return(0);
        }
Exemplo n.º 3
0
        /*
         * 发生未捕获的界面线程异常:
         * Type: System.FormatException
         * Message: 輸入字串格式不正確。
         * Stack:
         * 於 System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
         * 於 System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
         * 於 System.Int16.Parse(String s, NumberStyles style, NumberFormatInfo info)
         * 於 System.Convert.ToInt16(String value)
         * 於 DigitalPlatform.Z3950.PolandNode.HandleQuery(BerNode param, BerNode subparam, String strTerm, String strAttrType, String strAttrValue)
         * 於 DigitalPlatform.Z3950.PolandNode.BldAttributesPlusTerm(BerNode param, String strToken)
         * 於 DigitalPlatform.Z3950.PolandNode.BuildOperand(BerNode param, String strToken)
         * 於 DigitalPlatform.Z3950.PolandNode.HandleOperand(String strToken)
         * 於 DigitalPlatform.Z3950.PolandNode.ChangeRPNToTree()
         * 於 DigitalPlatform.Z3950.PolandNode.ChangeOrgToRPN()
         * 於 DigitalPlatform.Z3950.BerTree.make_type_1(String strQuery, Encoding queryTermEncoding, BerNode subroot)
         * 於 DigitalPlatform.Z3950.BerTree.SearchRequest(SEARCH_REQUEST struSearch_request, Byte[]& baPackage)
         * 於 dp2Catalog.ZConnection.DoSearchAsync()
         * 於 dp2Catalog.ZConnection.ZConnection_InitialComplete(Object sender, EventArgs e)
         * 於 dp2Catalog.ZConnection.BeginCommands(List`1 commands)
         * 於 dp2Catalog.ZSearchForm.DoSearchOneServer(TreeNode nodeServerOrDatabase, String& strError)
         * 於 dp2Catalog.ZSearchForm.DoSearch()
         * 於 dp2Catalog.ZSearchForm.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.ContainerControl.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.SplitContainer.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.ContainerControl.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.SplitContainer.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.ContainerControl.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.SplitContainer.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.ContainerControl.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.Control.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
         * 於 System.Windows.Forms.Control.PreProcessMessage(Message& msg)
         * 於 System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
         * 於 System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
         *
         * */
        // new version
        // 处理term或AttributesList
        // parameters:
        void HandleQuery(BerNode param,
                         BerNode subparam,
                         string strTerm,
                         string strAttrType,
                         string strAttrValue)
        {
            BerNode seq = null;

            seq = subparam.NewChildConstructedNode(
                ASN1_SEQUENCE,
                ASN1_UNIVERSAL);

            // 处理term、attributeType或attributeValue

            //    处理attributeType
            try
            {
                Int16 i = Convert.ToInt16(strAttrType);

                seq.NewChildIntegerNode(BerTree.z3950_AttributeType,
                                        ASN1_CONTEXT,
                                        BitConverter.GetBytes(i));
            }
            catch (Exception ex)
            {
                throw new Exception("strAttrType = '" + strAttrType + "' 应为数字。", ex);
            }

            //		处理attributeValue
            try
            {
                Int16 i = Convert.ToInt16(strAttrValue);
                seq.NewChildIntegerNode(BerTree.z3950_AttributeValue,
                                        ASN1_CONTEXT,
                                        BitConverter.GetBytes(i));
            }
            catch (Exception ex)
            {
                throw new Exception("strAttrValue = '" + strAttrValue + "' 应为数字。", ex);
            }
            // TODO: 为何这里被调用了两次?

            // term
            {
                BerNode tempnode = param.NewChildCharNode(BerTree.z3950_Term, //	处理term
                                                          ASN1_CONTEXT,
                                                                              //Encoding.GetEncoding(936).GetBytes(strTerm));
                                                          this.m_queryTermEncoding.GetBytes(strTerm));
                tempnode.m_strDebugInfo = "term [" + strTerm + "]";
            }

            // return 0;
        }