Beispiel #1
0
        public static string[] GetProjectionMethodParameterList(string method, out string username)
        {
            /* %typemap(csout) char** CSL */
            IntPtr cPtr = OsrPINVOKE.GetProjectionMethodParameterList(method, out username);
            IntPtr objPtr;
            int    count = 0;

            if (cPtr != IntPtr.Zero)
            {
                while (Marshal.ReadIntPtr(cPtr, count * IntPtr.Size) != IntPtr.Zero)
                {
                    ++count;
                }
            }
            string[] ret = new string[count];
            if (count > 0)
            {
                for (int cx = 0; cx < count; cx++)
                {
                    objPtr  = System.Runtime.InteropServices.Marshal.ReadIntPtr(cPtr, cx * System.Runtime.InteropServices.Marshal.SizeOf(typeof(IntPtr)));
                    ret[cx] = (objPtr == IntPtr.Zero) ? null : System.Runtime.InteropServices.Marshal.PtrToStringAnsi(objPtr);
                }
            }
            if (cPtr != IntPtr.Zero)
            {
                OsrPINVOKE.StringListDestroy(cPtr);
            }

            if (OsrPINVOKE.SWIGPendingException.Pending)
            {
                throw OsrPINVOKE.SWIGPendingException.Retrieve();
            }
            return(ret);
        }