Пример #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 CoreStatus StatusGet(CoreDll.ThreadType threadType, int threadId)
 {
     try
     {
         object   statusO = new CoreDll.adStatusW();
         byte[]   statusB = new byte[Marshal.SizeOf(statusO)];
         GCHandle statusH = GCHandle.Alloc(statusB, GCHandleType.Pinned);
         try
         {
             IntPtr statusP = statusH.AddrOfPinnedObject();
             if (m_dll.adStatusGetW(m_handle, threadType, new IntPtr(threadId), statusP) == CoreDll.Error.Ok)
             {
                 CoreDll.adStatusW statusW = (CoreDll.adStatusW)Marshal.PtrToStructure(statusP, statusO.GetType());
                 return(new CoreStatus(ref statusW));
             }
         }
         finally
         {
             statusH.Free();
         }
     }
     catch (Exception)
     {
     }
     return(null);
 }
Пример #3
0
 public CoreStatus StatusGet(CoreDll.ThreadType threadType, int threadId)
 {
     try
     {
         object statusObject = new CoreDll.adStatusW();
         byte[] status       = new byte[Marshal.SizeOf(statusObject)];
         IntPtr pStatus      = Marshal.UnsafeAddrOfPinnedArrayElement(status, 0);
         if (m_dll.adStatusGetW(m_handle, threadType, new IntPtr(threadId), pStatus) == CoreDll.Error.Ok)
         {
             CoreDll.adStatusW statusW = (CoreDll.adStatusW)Marshal.PtrToStructure(pStatus, statusObject.GetType());
             return(new CoreStatus(ref statusW));
         }
     }
     catch (Exception)
     {
     }
     return(null);
 }