예제 #1
0
        public CoreGroup[] GetGroup(uint startFrom, uint size)
        {
            uint groupSize = GetGroupSize();

            if (groupSize > startFrom)
            {
                object groupObject = new CoreDll.adGroup();
                int    sizeOfGroup = Marshal.SizeOf(groupObject);
                size = Math.Min(groupSize - startFrom, size);
                byte[]      buffer     = new byte[sizeOfGroup * size];
                CoreGroup[] groups     = new CoreGroup[size];
                UIntPtr[]   pStartFrom = new UIntPtr[1];
                pStartFrom[0] = new UIntPtr(startFrom);
                UIntPtr[] pSize = new UIntPtr[1];
                pSize[0] = new UIntPtr(size);
                if (m_dll.adGroupGet(m_handle, Marshal.UnsafeAddrOfPinnedArrayElement(pStartFrom, 0),
                                     Marshal.UnsafeAddrOfPinnedArrayElement(buffer, 0),
                                     Marshal.UnsafeAddrOfPinnedArrayElement(pSize, 0)) == CoreDll.Error.Ok)
                {
                    for (uint i = 0; i < pSize[0].ToUInt32(); ++i)
                    {
                        IntPtr          pGroup = Marshal.UnsafeAddrOfPinnedArrayElement(buffer, (int)(i * sizeOfGroup));
                        CoreDll.adGroup group  = (CoreDll.adGroup)Marshal.PtrToStructure(pGroup, groupObject.GetType());
                        groups[i] = new CoreGroup(ref group, this);
                    }
                }
                return(groups);
            }
            return(null);
        }
예제 #2
0
파일: CoreGroup.cs 프로젝트: vsf6/AntiDupl
 public CoreGroup(ref CoreDll.adGroup group, CoreLib core)
 {
     id     = group.id.ToInt32();
     images = core.GetImageInfo(id, 0, (uint)group.size);
     for (int i = 0; i < images.Length; ++i)
     {
         sizeMax.Width  = Math.Max(sizeMax.Width, (int)images[i].width);
         sizeMax.Height = Math.Max(sizeMax.Height, (int)images[i].height);
     }
 }