示例#1
0
文件: Api.cs 项目: fw2568/YaNco
        public static RfcRc GetBytes(IDataContainerHandle containerHandle, string name, out byte[] buffer, out
                                     RfcErrorInfo errorInfo)
        {
            var tempBuffer = new byte[255];
            var rc         = Interopt.RfcGetXString(containerHandle.Ptr, name, tempBuffer, 255, out var bufferLength, out errorInfo);

            if (rc != RfcRc.RFC_BUFFER_TOO_SMALL)
            {
                buffer = new byte[bufferLength];
                Array.Copy(tempBuffer, buffer, bufferLength);

                return(rc);
            }

            tempBuffer = new byte[bufferLength];
            rc         = Interopt.RfcGetXString(containerHandle.Ptr, name, tempBuffer, bufferLength, out _, out errorInfo);
            buffer     = new byte[bufferLength];
            tempBuffer.CopyTo(buffer, 0);

            return(rc);
        }