示例#1
0
 public CoreStatus(ref CoreDll.adStatusW status)
 {
     state   = status.state;
     path    = status.path;
     current = (int)status.current.ToUInt32();
     total   = (int)status.total.ToUInt32();
 }
示例#2
0
        //public CoreDll.Status2 GetStatus()
        //{
        //    return _dll.GetStatus();
        //}

        public CoreStatus StatusGet(CoreDll.ThreadType threadType, int threadId)
        {
            object statusObject = new CoreDll.adStatusW();

            byte[] status  = new byte[Marshal.SizeOf(statusObject)];
            IntPtr pStatus = Marshal.UnsafeAddrOfPinnedArrayElement(status, 0);

            if (_dll.adStatusGetW(threadType, new IntPtr(threadId), pStatus) == CoreDll.Error.Ok)
            {
                CoreDll.adStatusW statusW = (CoreDll.adStatusW)Marshal.PtrToStructure(pStatus, statusObject.GetType());
                try
                {
                    return(new CoreStatus(ref statusW));
                }
                catch (Exception)
                {
                    return(null);
                }
            }
            return(null);
        }