private static void OnEntitlementDeleteImpl(IntPtr ptr, ref Entitlement entitlement) { GCHandle h = GCHandle.FromIntPtr(ptr); Discord d = (Discord)h.Target; if (d.StoreManagerInstance.OnEntitlementDelete != null) { d.StoreManagerInstance.OnEntitlementDelete.Invoke(ref entitlement); } }
/// <summary> /// Gets an entitlement by index when iterating over a user's entitlements. You must call /// <see cref="FetchEntitlements" /> first before being able to access SKUs in this way. /// </summary> /// <param name="index"></param> /// <returns></returns> /// <exception cref="ResultException"></exception> public Entitlement GetEntitlementAt(int index) { Entitlement ret = new Entitlement(); Result res = Methods.GetEntitlementAt(methodsPtr, index, ref ret); if (res != Result.Ok) { throw new ResultException(res); } return(ret); }
/// <summary> /// Gets an entitlement by its id. You must call <see cref="FetchEntitlements" /> first before being able to access /// SKUs in this way. /// </summary> /// <param name="entitlementId"></param> /// <returns></returns> /// <exception cref="ResultException"></exception> public Entitlement GetEntitlement(long entitlementId) { Entitlement ret = new Entitlement(); Result res = Methods.GetEntitlement(methodsPtr, entitlementId, ref ret); if (res != Result.Ok) { throw new ResultException(res); } return(ret); }