Exemplo n.º 1
0
        public static byte[] StringToQmgrBytes(NmqiEnvironment env, Hconn hconn, string str, byte[] charAttrs, int offset, int length)
        {
            Encoding dotnetEncoding = MQCcsidTable.GetDotnetEncoding(hconn.Ccsid);

            byte[] bytes = dotnetEncoding.GetBytes(str);
            if (bytes.Length > length)
            {
                NmqiException exception = new NmqiException(env, -1, null, 2, 0x7d5, null);
                env.LastException = exception;
                throw exception;
            }
            if ((offset + length) > charAttrs.Length)
            {
                NmqiException exception2 = new NmqiException(env, -1, null, 2, 0x7d5, null);
                env.LastException = exception2;
                throw exception2;
            }
            for (int i = 0; i < bytes.Length; i++)
            {
                charAttrs[offset + i] = bytes[i];
            }
            byte[] buffer2 = dotnetEncoding.GetBytes(" ");
            for (int j = bytes.Length; j < length; j++)
            {
                charAttrs[offset + j] = buffer2[0];
            }
            return(bytes);
        }
Exemplo n.º 2
0
        public static QueueManagerInfo GetQueueManagerInfo(NmqiEnvironment env, NmqiMQ mq, Hconn hconn)
        {
            QueueManagerInfo   info     = env.NewQueueManagerInfo();
            MQObjectDescriptor pObjDesc = env.NewMQOD();

            pObjDesc.ObjectType = 5;
            int   options   = 0x20;
            Phobj pHobj     = env.NewPhobj();
            int   pCompCode = 0;
            int   pReason   = 0;

            mq.MQOPEN(hconn, ref pObjDesc, options, pHobj, out pCompCode, out pReason);
            if (pReason == 0)
            {
                Hobj   hOBJ       = pHobj.HOBJ;
                int[]  pSelectors = new int[] { 0x1f, 0x20, 2, 0x7df, 0x7f0 };
                int[]  pIntAttrs  = new int[3];
                byte[] pCharAttrs = new byte[0x60];
                mq.MQINQ(hconn, hOBJ, pSelectors.Length, pSelectors, pIntAttrs.Length, pIntAttrs, pCharAttrs.Length, pCharAttrs, out pCompCode, out pReason);
                if (pReason == 0)
                {
                    info.CommandLevel = pIntAttrs[0];
                    info.Platform     = pIntAttrs[1];
                    info.Ccsid        = pIntAttrs[2];
                    Encoding dotnetEncoding = MQCcsidTable.GetDotnetEncoding(info.Ccsid);
                    info.Name = dotnetEncoding.GetString(pCharAttrs, 0, 0x30);
                    info.Uid  = dotnetEncoding.GetString(pCharAttrs, 0x30, 0x30);
                }
                else
                {
                    NmqiException exception = new NmqiException(env, 0x253a, null, pCompCode, pReason, null);
                    env.LastException = exception;
                    throw exception;
                }
                mq.MQCLOSE(hconn, pHobj, 0, out pCompCode, out pReason);
                return(info);
            }
            NmqiException exception2 = new NmqiException(env, 0x2525, null, pCompCode, pReason, null);

            env.LastException = exception2;
            throw exception2;
        }
Exemplo n.º 3
0
 public static string QmgrBytesToString(Hconn hconn, byte[] charAttrs, int offset, int length)
 {
     return(MQCcsidTable.GetDotnetEncoding(hconn.Ccsid).GetString(charAttrs, offset, length).Trim());
 }