Beispiel #1
0
 public CoreStatistic GetStatistic()
 {
     try
     {
         object   statisticO = new CoreDll.adStatistic();
         byte[]   statisticB = new byte[Marshal.SizeOf(statisticO)];
         GCHandle statisticH = GCHandle.Alloc(statisticB, GCHandleType.Pinned);
         try
         {
             IntPtr statisticP = statisticH.AddrOfPinnedObject();
             if (m_dll.adStatisticGet(m_handle, statisticP) == CoreDll.Error.Ok)
             {
                 CoreDll.adStatistic statistic = (CoreDll.adStatistic)Marshal.PtrToStructure(statisticP, statisticO.GetType());
                 return(new CoreStatistic(ref statistic));
             }
         }
         finally
         {
             statisticH.Free();
         }
     }
     catch (Exception)
     {
     }
     return(null);
 }
Beispiel #2
0
 public CoreStatistic GetStatistic()
 {
     CoreDll.adStatistic[] statistic = new CoreDll.adStatistic[1];
     if (m_dll.adStatisticGet(m_handle, Marshal.UnsafeAddrOfPinnedArrayElement(statistic, 0)) == CoreDll.Error.Ok)
     {
         return(new CoreStatistic(ref statistic[0]));
     }
     return(null);
 }