public void GetCDKeyList()
        {
            UPLAY_Overlapped uplay_Overlapped = default(UPLAY_Overlapped);
            IntPtr           intPtr           = Marshal.AllocHGlobal(Marshal.SizeOf(uplay_Overlapped));

            Marshal.StructureToPtr(uplay_Overlapped, intPtr, true);
            overlappedMap.Add(intPtr, uplay_Overlapped);
            IntPtr ptr;
            Int32  num = UplayInvokes.UPLAY_USER_GetCdKeys(out ptr, intPtr);

            if (num != 0)
            {
                UplayInvokes.UPLAY_Update();
                while (!UplayInvokes.UPLAY_HasOverlappedOperationCompleted(intPtr))
                {
                    Thread.Sleep(5);
                    UplayInvokes.UPLAY_Update();
                }
                m_keys.Clear();
                UPLAY_USER_CdKeyList uplay_USER_CdKeyList = (UPLAY_USER_CdKeyList)Marshal.PtrToStructure(ptr, typeof(UPLAY_USER_CdKeyList));
                IntPtr list = uplay_USER_CdKeyList.list;
                for (Int32 i = 0; i < uplay_USER_CdKeyList.count; i++)
                {
                    UPLAY_USER_CdKey uplay_USER_CdKey = (UPLAY_USER_CdKey)Marshal.PtrToStructure(list, typeof(UPLAY_USER_CdKey));
                    m_keys.Add(uplay_USER_CdKey.keyUtf8);
                    list = new IntPtr(list.ToInt32() + IntPtr.Size);
                }
            }
        }
Пример #2
0
        private IntPtr CreateOverlapped()
        {
            UPLAY_Overlapped uplay_Overlapped = default(UPLAY_Overlapped);
            IntPtr           intPtr           = Marshal.AllocHGlobal(Marshal.SizeOf(uplay_Overlapped));

            Marshal.StructureToPtr(uplay_Overlapped, intPtr, true);
            return(intPtr);
        }
        public void ShowOverlay()
        {
            UPLAY_Overlapped uplay_Overlapped = default(UPLAY_Overlapped);
            IntPtr           intPtr           = Marshal.AllocHGlobal(Marshal.SizeOf(uplay_Overlapped));

            Marshal.StructureToPtr(uplay_Overlapped, intPtr, true);
            overlappedMap.Add(intPtr, uplay_Overlapped);
            UplayInvokes.UPLAY_OVERLAY_Show(UPLAY_OVERLAY_Section.UPLAY_OverlaySection_Show, intPtr);
        }
 public void EarnAchievment(Int32 achievementId)
 {
     if (m_isUplayConnected)
     {
         UPLAY_Overlapped uplay_Overlapped = default(UPLAY_Overlapped);
         IntPtr           intPtr           = Marshal.AllocHGlobal(Marshal.SizeOf(uplay_Overlapped));
         Marshal.StructureToPtr(uplay_Overlapped, intPtr, true);
         overlappedMap.Add(intPtr, uplay_Overlapped);
         Int32 num = UplayInvokes.UPLAY_ACH_EarnAchievement((UInt32)achievementId, intPtr);
         if (num != 0)
         {
         }
     }
 }