Esempio n. 1
0
        internal void GatherAddressStatus()
        {
            var las = new LINEADDRESSSTATUS();

            byte[] rawBuffer = null;

            int rc, neededSize = 1024;

            do
            {
                las.dwTotalSize = neededSize;
                IntPtr pLas = Marshal.AllocHGlobal(neededSize);
                Marshal.StructureToPtr(las, pLas, true);
                rc = NativeMethods.lineGetAddressStatus(_lineOwner.Handle, _addressId, pLas);
                Marshal.PtrToStructure(pLas, las);
                if (las.dwNeededSize > neededSize)
                {
                    neededSize = las.dwNeededSize;
                    rc         = NativeMethods.LINEERR_STRUCTURETOOSMALL;
                }
                else if (rc == NativeMethods.LINEERR_OK)
                {
                    rawBuffer = new byte[las.dwUsedSize];
                    Marshal.Copy(pLas, rawBuffer, 0, las.dwUsedSize);
                }
                Marshal.FreeHGlobal(pLas);
            }while (rc == NativeMethods.LINEERR_STRUCTURETOOSMALL);
            _addrStatus = new AddressStatus(las, rawBuffer, _lineOwner.StringFormat);
        }
Esempio n. 2
0
 internal AddressStatus(LINEADDRESSSTATUS las, byte[] rawBuffer, int stringFormat)
 {
     _las          = las;
     _rawBuffer    = rawBuffer;
     _stringFormat = stringFormat;
 }