From 233627b15092f330863b195533009f5cc4a6095f Mon Sep 17 00:00:00 2001 From: "Joshua \"Yoshi\" Askharoun" Date: Sun, 7 Dec 2025 18:42:35 -0600 Subject: [PATCH] [WIP] SubscriptionDataProviderItem --- ZuneDBApi/CComPropVariant.cs | 15 +- ZuneDBApi/IMSMediaSchemaPropertySet.cs | 24 +- ZuneDBApi/IService.cs | 13 +- ZuneDBApi/Interop/VCString.cs | 4 + .../SubscriptionDataProviderItem.cs | 818 +++++++++--------- .../SubscriptionSeriesInfo.cs | 26 +- 6 files changed, 457 insertions(+), 443 deletions(-) diff --git a/ZuneDBApi/CComPropVariant.cs b/ZuneDBApi/CComPropVariant.cs index 2273344..62bdba8 100644 --- a/ZuneDBApi/CComPropVariant.cs +++ b/ZuneDBApi/CComPropVariant.cs @@ -1,19 +1,14 @@ -using Microsoft.VisualC; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[StructLayout(LayoutKind.Sequential, Size = 24)] -[NativeCppClass] -[DebugInfoInPDB] -[MiscellaneousBits(64)] +[StructLayout(LayoutKind.Explicit, Size = 24)] internal struct CComPropVariant { + [FieldOffset(0)] public VARTYPE vt; - public ushort wReserved1; - public ushort wReserved2; - public ushort wReserved3; - + [FieldOffset(8)] public ulong val1; + + [FieldOffset(16)] public ulong val2; } diff --git a/ZuneDBApi/IMSMediaSchemaPropertySet.cs b/ZuneDBApi/IMSMediaSchemaPropertySet.cs index e4e8438..80243da 100644 --- a/ZuneDBApi/IMSMediaSchemaPropertySet.cs +++ b/ZuneDBApi/IMSMediaSchemaPropertySet.cs @@ -3,27 +3,21 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -[StructLayout(LayoutKind.Sequential)] +[StructLayout(LayoutKind.Explicit)] [DebugInfoInPDB] [MiscellaneousBits(65)] [NativeCppClass] internal unsafe struct IMSMediaSchemaPropertySet { - private long _alignment1; + [FieldOffset(8)] + public delegate* unmanaged[Cdecl] addRef; - // 8 - public delegate* unmanaged[Cdecl, Cdecl] addRef; + [FieldOffset(16)] + public delegate* unmanaged[Cdecl] dispose; - // 16 - public delegate* unmanaged[Cdecl, Cdecl] dispose; + [FieldOffset(48)] + public delegate* unmanaged[Cdecl] readValue; - private long _alignment4; - private long _alignment5; - private long _alignment6; - - // 48 - public delegate* unmanaged[Cdecl, Cdecl] readValue; - - // 56 - public delegate* unmanaged[Cdecl, Cdecl] setValue; + [FieldOffset(56)] + public delegate* unmanaged[Cdecl] setValue; } diff --git a/ZuneDBApi/IService.cs b/ZuneDBApi/IService.cs index f6a3738..16ec07e 100644 --- a/ZuneDBApi/IService.cs +++ b/ZuneDBApi/IService.cs @@ -1,12 +1,9 @@ -using System.Runtime.CompilerServices; +using System; using System.Runtime.InteropServices; -using Microsoft.VisualC; -[StructLayout(LayoutKind.Sequential, Size = 8)] -[MiscellaneousBits(65)] -[NativeCppClass] -[DebugInfoInPDB] -internal static struct IService +[StructLayout(LayoutKind.Explicit)] +internal unsafe struct IService { - private long _003Calignment_0020member_003E; + [FieldOffset(384)] + public delegate* unmanaged[Cdecl, Cdecl] _method1; } diff --git a/ZuneDBApi/Interop/VCString.cs b/ZuneDBApi/Interop/VCString.cs index befdb72..2dffab8 100644 --- a/ZuneDBApi/Interop/VCString.cs +++ b/ZuneDBApi/Interop/VCString.cs @@ -1,4 +1,5 @@ using System; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace ZuneDBApi.Interop; @@ -23,4 +24,7 @@ internal static class VCString return array; } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe ushort* AsPtr(ref ushort[] str) => (ushort*)Unsafe.AsPointer(ref str); } diff --git a/ZuneDBApi/Microsoft.Zune.Subscription/SubscriptionDataProviderItem.cs b/ZuneDBApi/Microsoft.Zune.Subscription/SubscriptionDataProviderItem.cs index ad12d88..f8f7463 100644 --- a/ZuneDBApi/Microsoft.Zune.Subscription/SubscriptionDataProviderItem.cs +++ b/ZuneDBApi/Microsoft.Zune.Subscription/SubscriptionDataProviderItem.cs @@ -2,418 +2,442 @@ using System; using System.Runtime.CompilerServices; using _003CCppImplementationDetails_003E; using Microsoft.Iris; +using ZuneDBApi.Interop; namespace Microsoft.Zune.Subscription; public class SubscriptionDataProviderItem : DataProviderObject { - private string m_feedUrl; + private string m_feedUrl; - private int m_nSeriesId = -1; + private int m_nSeriesId = -1; - private int m_nEpisodeId = -1; + private int m_nEpisodeId = -1; - private EItemDownloadState m_eLastDownloadState = EItemDownloadState.eDownloadStateNone; + private EItemDownloadState m_eLastDownloadState = EItemDownloadState.eDownloadStateNone; - private unsafe IMSMediaSchemaPropertySet* m_pEpisodePropertySet; + private unsafe IMSMediaSchemaPropertySet* m_pEpisodePropertySet; - public unsafe SubscriptionDataProviderItem(DataProviderQuery owner, object typeCookie, string feedUrl, IMSMediaSchemaPropertySet* pEpisodePropertySet) - : base(owner, typeCookie) - { - //IL_0039: Expected I, but got I8 - m_feedUrl = feedUrl; - m_pEpisodePropertySet = pEpisodePropertySet; - ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)pEpisodePropertySet + 8)))((nint)pEpisodePropertySet); - BindToLocalEpisode(); - } + internal unsafe SubscriptionDataProviderItem(DataProviderQuery owner, object typeCookie, string feedUrl, IMSMediaSchemaPropertySet* pEpisodePropertySet) + : base(owner, typeCookie) + { + m_feedUrl = feedUrl; + m_pEpisodePropertySet = pEpisodePropertySet; + pEpisodePropertySet->addRef((nint)pEpisodePropertySet); + BindToLocalEpisode(); + } - public unsafe override object GetProperty(string propertyName) - { - //IL_00b6: Expected I4, but got I8 - //IL_024a: Expected I, but got I8 - //IL_0286: Expected I, but got I8 - //IL_0256: Expected I, but got I8 - System.Runtime.CompilerServices.Unsafe.SkipInit(out _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040 _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040); - *(long*)(&_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040) = (nint)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1M_0040MNHBCACD_0040_003F_0024AAT_003F_0024AAi_003F_0024AAt_003F_0024AAl_003F_0024AAe_003F_0024AA_003F_0024AA_0040); - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 8)) = 16797697; - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, long>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 16)) = (nint)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BI_0040DLMANABL_0040_003F_0024AAD_003F_0024AAe_003F_0024AAs_003F_0024AAc_003F_0024AAr_003F_0024AAi_003F_0024AAp_003F_0024AAt_003F_0024AAi_003F_0024AAo_003F_0024AAn_003F_0024AA_003F_0024AA_0040); - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 24)) = 134238211; - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, long>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 32)) = (nint)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BC_0040CGFFANJJ_0040_003F_0024AAD_003F_0024AAu_003F_0024AAr_003F_0024AAa_003F_0024AAt_003F_0024AAi_003F_0024AAo_003F_0024AAn_003F_0024AA_003F_0024AA_0040); - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 40)) = 16797701; - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, long>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 48)) = (nint)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BI_0040IMGEIAFE_0040_003F_0024AAR_003F_0024AAe_003F_0024AAl_003F_0024AAe_003F_0024AAa_003F_0024AAs_003F_0024AAe_003F_0024AAD_003F_0024AAa_003F_0024AAt_003F_0024AAe_003F_0024AA_003F_0024AA_0040); - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 56)) = 150995204; - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, long>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 64)) = (nint)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BC_0040BFOBHOBE_0040_003F_0024AAE_003F_0024AAx_003F_0024AAp_003F_0024AAl_003F_0024AAi_003F_0024AAc_003F_0024AAi_003F_0024AAt_003F_0024AA_003F_0024AA_0040); - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 72)) = 83906566; - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, long>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 80)) = (nint)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1O_0040IKCDCNCP_0040_003F_0024AAA_003F_0024AAu_003F_0024AAt_003F_0024AAh_003F_0024AAo_003F_0024AAr_003F_0024AA_003F_0024AA_0040); - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 88)) = 16797704; - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, long>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 96)) = (nint)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BK_0040DIFENCED_0040_003F_0024AAE_003F_0024AAn_003F_0024AAc_003F_0024AAl_003F_0024AAo_003F_0024AAs_003F_0024AAu_003F_0024AAr_003F_0024AAe_003F_0024AAU_003F_0024AAr_003F_0024AAl_003F_0024AA_003F_0024AA_0040); - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 104)) = 134238215; - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, long>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 112)) = (nint)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1CC_0040PFACMMFM_0040_003F_0024AAE_003F_0024AAp_003F_0024AAi_003F_0024AAs_003F_0024AAo_003F_0024AAd_003F_0024AAe_003F_0024AAM_003F_0024AAe_003F_0024AAd_003F_0024AAi_003F_0024AAa_003F_0024AAT_003F_0024AAy_003F_0024AAp_003F_0024AAe_003F_0024AA_003F_0024AA_0040); - System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 120)) = 100683786; - int num = 0; - System.Runtime.CompilerServices.Unsafe.SkipInit(out CComPropVariant cComPropVariant); - // IL initblk instruction - System.Runtime.CompilerServices.Unsafe.InitBlock(ref cComPropVariant, 0, 24); - object result; - try - { - fixed (ushort* ptr = &System.Runtime.CompilerServices.Unsafe.As(ref global::_003CModule_003E.PtrToStringChars(propertyName))) - { - if (global::_003CModule_003E._wcsicmp(ptr, (ushort*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BE_0040NCILDCLH_0040_003F_0024AAL_003F_0024AAi_003F_0024AAb_003F_0024AAr_003F_0024AAa_003F_0024AAr_003F_0024AAy_003F_0024AAI_003F_0024AAd_003F_0024AA_003F_0024AA_0040)) == 0) - { - System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref cComPropVariant, 8)) = m_nEpisodeId; - *(short*)(&cComPropVariant) = 3; - } - else if (global::_003CModule_003E._wcsicmp(ptr, (ushort*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BC_0040JCKMNCPP_0040_003F_0024AAS_003F_0024AAe_003F_0024AAr_003F_0024AAi_003F_0024AAe_003F_0024AAs_003F_0024AAI_003F_0024AAd_003F_0024AA_003F_0024AA_0040)) == 0) - { - System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref cComPropVariant, 8)) = m_nSeriesId; - *(short*)(&cComPropVariant) = 3; - } - else - { - if (global::_003CModule_003E._wcsicmp(ptr, (ushort*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BM_0040BGELMDBM_0040_003F_0024AAD_003F_0024AAo_003F_0024AAw_003F_0024AAn_003F_0024AAl_003F_0024AAo_003F_0024AAa_003F_0024AAd_003F_0024AAS_003F_0024AAt_003F_0024AAa_003F_0024AAt_003F_0024AAe_003F_0024AA_003F_0024AA_0040)) == 0) - { - int nEpisodeId = m_nEpisodeId; - if (nEpisodeId >= 0) - { - num = GetDatabaseValue(nEpisodeId, 145u, (tagPROPVARIANT*)(&cComPropVariant)); - if (num < 0) - { - goto IL_02b0; - } - if (m_eLastDownloadState != (EItemDownloadState)System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref cComPropVariant, 8))) - { - InvalidateDownloadState(); - } - m_eLastDownloadState = System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref cComPropVariant, 8)); - } - else - { - System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref cComPropVariant, 8)) = 0; - *(short*)(&cComPropVariant) = 3; - } - } - else if (global::_003CModule_003E._wcsicmp(ptr, (ushort*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BK_0040EPGEAFPP_0040_003F_0024AAD_003F_0024AAo_003F_0024AAw_003F_0024AAn_003F_0024AAl_003F_0024AAo_003F_0024AAa_003F_0024AAd_003F_0024AAT_003F_0024AAy_003F_0024AAp_003F_0024AAe_003F_0024AA_003F_0024AA_0040)) == 0) - { - int nEpisodeId2 = m_nEpisodeId; - if (nEpisodeId2 >= 0) - { - num = GetDatabaseValue(nEpisodeId2, 146u, (tagPROPVARIANT*)(&cComPropVariant)); - } - else - { - System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref cComPropVariant, 8)) = 0; - *(short*)(&cComPropVariant) = 3; - } - } - else if (global::_003CModule_003E._wcsicmp(ptr, (ushort*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BK_0040JJCAOHOO_0040_003F_0024AAP_003F_0024AAl_003F_0024AAa_003F_0024AAy_003F_0024AAe_003F_0024AAd_003F_0024AAS_003F_0024AAt_003F_0024AAa_003F_0024AAt_003F_0024AAu_003F_0024AAs_003F_0024AA_003F_0024AA_0040)) == 0) - { - *(short*)(&cComPropVariant) = 1; - int nEpisodeId3 = m_nEpisodeId; - if (nEpisodeId3 < 0) - { - goto IL_028b; - } - num = GetDatabaseValue(nEpisodeId3, 262u, (tagPROPVARIANT*)(&cComPropVariant)); - } - else if (global::_003CModule_003E._wcsicmp(ptr, (ushort*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1BE_0040HHOJDPEL_0040_003F_0024AAS_003F_0024AAo_003F_0024AAu_003F_0024AAr_003F_0024AAc_003F_0024AAe_003F_0024AAU_003F_0024AAr_003F_0024AAl_003F_0024AA_003F_0024AA_0040)) == 0) - { - *(short*)(&cComPropVariant) = 1; - int nEpisodeId4 = m_nEpisodeId; - if (nEpisodeId4 < 0) - { - goto IL_028b; - } - num = GetDatabaseValue(nEpisodeId4, 317u, (tagPROPVARIANT*)(&cComPropVariant)); - } - else if (global::_003CModule_003E._wcsicmp(ptr, (ushort*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref global::_003CModule_003E._003F_003F_C_0040_1CE_0040ELHJHONN_0040_003F_0024AAD_003F_0024AAo_003F_0024AAw_003F_0024AAn_003F_0024AAl_003F_0024AAo_003F_0024AAa_003F_0024AAd_003F_0024AAE_003F_0024AAr_003F_0024AAr_003F_0024AAo_003F_0024AAr_003F_0024AAC_003F_0024AAo_003F_0024AAd_003F_0024AAe_003F_0024AA_003F_0024AA_0040)) == 0) - { - *(short*)(&cComPropVariant) = 1; - int nEpisodeId5 = m_nEpisodeId; - if (nEpisodeId5 < 0) - { - goto IL_028b; - } - num = GetDatabaseValue(nEpisodeId5, 144u, (tagPROPVARIANT*)(&cComPropVariant)); - } - else - { - int num2 = 0; - PROPERTY_TO_PID_MAP* ptr2 = (PROPERTY_TO_PID_MAP*)(&_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040); - while (global::_003CModule_003E._wcsicmp(ptr, (ushort*)(*(ulong*)ptr2)) != 0) - { - num2++; - ptr2 = (PROPERTY_TO_PID_MAP*)((ulong)(nint)ptr2 + 16uL); - if ((uint)num2 < 8u) - { - continue; - } - goto IL_028b; - } - uint num3 = *(uint*)((ref *(_003F*)((long)num2 * 16L)) + (ref System.Runtime.CompilerServices.Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, _003F>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref _0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, 8)))); - IMSMediaSchemaPropertySet* pEpisodePropertySet = m_pEpisodePropertySet; - num = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)pEpisodePropertySet + 48)))((nint)pEpisodePropertySet, num3, 0u, (tagPROPVARIANT*)(&cComPropVariant)); - } - if (num < 0) - { - goto IL_02b0; - } - } - goto IL_028b; - IL_02b0: - result = base.Mappings[propertyName].DefaultValue; - goto end_IL_00c8; - IL_028b: - if (global::_003CModule_003E.CComPropVariant_002EIsNullOrEmpty(&cComPropVariant)) - { - goto IL_02b0; - } - result = SubscriptionDataProviderQueryResult.ConvertVariantToType(base.Mappings[propertyName].PropertyTypeName, &cComPropVariant); - end_IL_00c8:; - } - } - catch - { - //try-fault - global::_003CModule_003E.___CxxCallUnwindDtor((delegate*)(delegate*)(&global::_003CModule_003E.CComPropVariant_002E_007Bdtor_007D), &cComPropVariant); - throw; - } - global::_003CModule_003E.CComPropVariant_002EClear(&cComPropVariant); - return result; - } + public unsafe override object GetProperty(string propertyName) + { + PROPERTY_TO_PID_MAP[] propertyToPidMap = + [ + new() + { + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_Title), + propertyId = 0x1005001 + }, + new() + { + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_Description), + propertyId = 0x8005003 + }, + new() + { + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_Duration), + propertyId = 0x1005005 + }, + new() + { + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_ReleaseDate), + propertyId = 0x9000104 + }, + new() + { + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_Explicit), + propertyId = 0x5005006 + }, + new() + { + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_Author), + propertyId = 0x1005008 + }, + new() + { + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_EnclosureUrl), + propertyId = 0x8005007 + }, + new() + { + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_EpisodeMediaType), + propertyId = 0x600500A + }, + ]; - public unsafe override void SetProperty(string propertyName, object value) - { - //IL_0046: Expected I, but got I8 - if (m_nEpisodeId > 0 && propertyName == "DownloadErrorCode") - { - System.Runtime.CompilerServices.Unsafe.SkipInit(out tagVARIANT tagVARIANT); - *(short*)(&tagVARIANT) = 3; - System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref tagVARIANT, 8)) = (int)value; - System.Runtime.CompilerServices.Unsafe.SkipInit(out DBPropertySubmitStruct dBPropertySubmitStruct); - *(int*)(&dBPropertySubmitStruct) = 144; - System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref dBPropertySubmitStruct, 8)) = (nint)(&tagVARIANT); - int num = ZuneLibraryExports.SetFieldValues(m_nEpisodeId, EListType.ePodcastEpisodeList, 1, &dBPropertySubmitStruct, null); - if (0 == num) - { - FirePropertyChanged(propertyName); - } - } - } + Unsafe.SkipInit(out CComPropVariant cComPropVariant); + Unsafe.InitBlock(&cComPropVariant, 0, 24); - public unsafe virtual void SaveToLibrary() - { - //IL_0003: Expected I, but got I8 - //IL_0006: Expected I, but got I8 - //IL_0033: Expected I, but got I8 - //IL_0033: Expected I, but got I8 - //IL_0098: Expected I, but got I8 - //IL_009c: Expected I, but got I8 - //IL_00ae: Expected I, but got I8 - //IL_0067: Expected I, but got I8 - IService* ptr = null; - ISubscriptionManager* ptr2 = null; - int num = 1; - int nSeriesId = -1; - int nEpisodeId = -1; - int singleton = global::_003CModule_003E.GetSingleton((_GUID)global::_003CModule_003E._GUID_bb2d1edd_1bd5_4be1_8d38_36d4f0849911, (void**)(&ptr)); - if (singleton >= 0) - { - singleton = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)ptr + 384)))((nint)ptr, null, &num); - if (singleton >= 0) - { - singleton = global::_003CModule_003E.GetSingleton((_GUID)global::_003CModule_003E._GUID_9dc7c984_41d5_4130_a5ac_46d0825cd29d, (void**)(&ptr2)); - if (singleton >= 0) - { - singleton = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)ptr2 + 136)))((nint)ptr2, num, EMediaTypes.eMediaTypePodcastSeries, m_pEpisodePropertySet, &nSeriesId, &nEpisodeId); - if (singleton >= 0) - { - m_nSeriesId = nSeriesId; - m_nEpisodeId = nEpisodeId; - FirePropertyChanged("DownloadState"); - } - } - } - } - if (0L != (nint)ptr) - { - IService* intPtr = ptr; - ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)intPtr + 16)))((nint)intPtr); - ptr = null; - } - if (0L != (nint)ptr2) - { - ISubscriptionManager* intPtr2 = ptr2; - ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)intPtr2 + 16)))((nint)intPtr2); - } - } + int hresult = 0; + object result; - internal unsafe void OnDispose() - { - //IL_0019: Expected I, but got I8 - //IL_0022: Expected I, but got I8 - IMSMediaSchemaPropertySet* pEpisodePropertySet = m_pEpisodePropertySet; - if (0L != (nint)pEpisodePropertySet) - { - ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)pEpisodePropertySet + 16)))((nint)pEpisodePropertySet); - m_pEpisodePropertySet = null; - } - } + try + { + fixed (ushort* ptr = VCString.ToWide(propertyName)) + { + if (_003CModule_003E._wcsicmp(ptr, VCString.AsPtr(ref _003CModule_003E.PROPNAME_LibraryId)) == 0) + { + cComPropVariant.vt = VARTYPE.VT_I4; + cComPropVariant.val1 = (uint)m_nEpisodeId; + } + else if (_003CModule_003E._wcsicmp(ptr, VCString.AsPtr(ref _003CModule_003E.PROPNAME_SeriesId)) == 0) + { + cComPropVariant.vt = VARTYPE.VT_I4; + cComPropVariant.val1 = (uint)m_nSeriesId; + } + else + { + if (_003CModule_003E._wcsicmp(ptr, VCString.AsPtr(ref _003CModule_003E.PROPNAME_DownloadState)) == 0) + { + if (m_nEpisodeId >= 0) + { + hresult = GetDatabaseValue(m_nEpisodeId, 145u, (tagPROPVARIANT*)&cComPropVariant); + if (hresult < 0) + { + goto IL_02b0; + } - private unsafe int BindToLocalEpisode() - { - //IL_0003: Expected I, but got I8 - //IL_000b: Expected I4, but got I8 - //IL_0013: Expected I4, but got I8 - //IL_0050: Expected I, but got I8 - //IL_00a7: Expected I4, but got I8 - //IL_0071: Expected I, but got I8 - //IL_00e2: Expected I, but got I8 - //IL_00e6: Expected I, but got I8 - //IL_009a: Expected I, but got I8 - //IL_009a: Expected I, but got I8 - //IL_009a: Expected I, but got I8 - ISubscriptionManager* ptr = null; - System.Runtime.CompilerServices.Unsafe.SkipInit(out CComPropVariant cComPropVariant); - // IL initblk instruction - System.Runtime.CompilerServices.Unsafe.InitBlock(ref cComPropVariant, 0, 24); - int num2; - try - { - System.Runtime.CompilerServices.Unsafe.SkipInit(out CComPropVariant cComPropVariant2); - // IL initblk instruction - System.Runtime.CompilerServices.Unsafe.InitBlock(ref cComPropVariant2, 0, 24); - try - { - int num = -1; - fixed (ushort* ptr2 = &System.Runtime.CompilerServices.Unsafe.As(ref global::_003CModule_003E.PtrToStringChars(m_feedUrl))) - { - num2 = global::_003CModule_003E.GetSingleton((_GUID)global::_003CModule_003E._GUID_9dc7c984_41d5_4130_a5ac_46d0825cd29d, (void**)(&ptr)); - if (num2 >= 0) - { - IMSMediaSchemaPropertySet* pEpisodePropertySet = m_pEpisodePropertySet; - num2 = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)pEpisodePropertySet + 48)))((nint)pEpisodePropertySet, 16797697u, 0u, (tagPROPVARIANT*)(&cComPropVariant)); - if (num2 >= 0) - { - IMSMediaSchemaPropertySet* pEpisodePropertySet2 = m_pEpisodePropertySet; - num2 = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)pEpisodePropertySet2 + 48)))((nint)pEpisodePropertySet2, 134238215u, 0u, (tagPROPVARIANT*)(&cComPropVariant2)); - if (num2 >= 0) - { - long num3 = *(long*)ptr + 160; - num2 = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)num3))((nint)ptr, EMediaTypes.eMediaTypePodcastSeries, ptr2, (ushort*)System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref cComPropVariant, 8)), (ushort*)System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref cComPropVariant2, 8)), &num); - } - } - } - if (0 == num2) - { - System.Runtime.CompilerServices.Unsafe.SkipInit(out tagPROPVARIANT tagPROPVARIANT); - // IL initblk instruction - System.Runtime.CompilerServices.Unsafe.InitBlock(ref tagPROPVARIANT, 0, 24); - num2 = GetDatabaseValue(num, 311u, &tagPROPVARIANT); - if (num2 >= 0) - { - m_nEpisodeId = num; - m_nSeriesId = System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref tagPROPVARIANT, 8)); - } - } - if (0L != (nint)ptr) - { - ISubscriptionManager* intPtr = ptr; - ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)intPtr + 16)))((nint)intPtr); - ptr = null; - } - } - } - catch - { - //try-fault - global::_003CModule_003E.___CxxCallUnwindDtor((delegate*)(delegate*)(&global::_003CModule_003E.CComPropVariant_002E_007Bdtor_007D), &cComPropVariant2); - throw; - } - global::_003CModule_003E.CComPropVariant_002EClear(&cComPropVariant2); - } - catch - { - //try-fault - global::_003CModule_003E.___CxxCallUnwindDtor((delegate*)(delegate*)(&global::_003CModule_003E.CComPropVariant_002E_007Bdtor_007D), &cComPropVariant); - throw; - } - global::_003CModule_003E.CComPropVariant_002EClear(&cComPropVariant); - return num2; - } + // TODO: What size is EItemDownloadState + var newDownloadState = Unsafe.As(ref Unsafe.AddByteOffset(ref cComPropVariant, 8)); + if (m_eLastDownloadState != newDownloadState) + { + InvalidateDownloadState(); + } + m_eLastDownloadState = newDownloadState; + } + else + { + cComPropVariant.vt = VARTYPE.VT_I4; + cComPropVariant.val1 = 0; + } + } + else if (_003CModule_003E._wcsicmp(ptr, VCString.AsPtr(ref _003CModule_003E.PROPNAME_DownloadType)) == 0) + { + if (m_nEpisodeId >= 0) + { + hresult = GetDatabaseValue(m_nEpisodeId, 146u, (tagPROPVARIANT*)&cComPropVariant); + } + else + { + cComPropVariant.vt = VARTYPE.VT_I4; + cComPropVariant.val1 = 0; + } + } + else if (_003CModule_003E._wcsicmp(ptr, VCString.AsPtr(ref _003CModule_003E.PROPNAME_PlayedStatus)) == 0) + { + cComPropVariant.vt = VARTYPE.VT_NULL; + if (m_nEpisodeId < 0) + { + goto IL_028b; + } - private int InvalidateDownloadState() - { - FirePropertyChanged("DownloadState"); - FirePropertyChanged("DownloadType"); - FirePropertyChanged("DownloadErrorCode"); - return 0; - } + hresult = GetDatabaseValue(m_nEpisodeId, 262u, (tagPROPVARIANT*)&cComPropVariant); + } + else if (_003CModule_003E._wcsicmp(ptr, VCString.AsPtr(ref _003CModule_003E.PROPNAME_SourceUrl)) == 0) + { + cComPropVariant.vt = VARTYPE.VT_NULL; + if (m_nEpisodeId < 0) + { + goto IL_028b; + } - private unsafe int GetDatabaseValue(int nMediaId, uint dwAtom, tagPROPVARIANT* pvarValue) - { - //IL_001b: Expected I, but got I8 - //IL_0046: Expected I, but got I8 - //IL_0042: Expected I, but got I8 - //IL_0042: Expected I, but got I8 - //IL_00b0: Expected I, but got I8 - //IL_00b4: Expected I, but got I8 - //IL_006e: Expected I, but got I8 - //IL_00c8: Expected I, but got I8 - //IL_00cc: Expected I, but got I8 - if (pvarValue == null) - { - global::_003CModule_003E._ZuneShipAssert(1001u, 633u); - return -2147467261; - } - IService* ptr = null; - int num = 1; - int num2 = global::_003CModule_003E.GetSingleton((_GUID)global::_003CModule_003E._GUID_bb2d1edd_1bd5_4be1_8d38_36d4f0849911, (void**)(&ptr)); - if (num2 >= 0) - { - num2 = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)ptr + 384)))((nint)ptr, null, &num); - } - IQueryPropertyBag* ptr2 = null; - System.Runtime.CompilerServices.Unsafe.SkipInit(out DBPropertyRequestStruct dBPropertyRequestStruct); - global::_003CModule_003E.DBPropertyRequestStruct_002E_007Bctor_007D(&dBPropertyRequestStruct, dwAtom); - try - { - if (num2 >= 0) - { - num2 = ZuneLibraryExports.CreatePropertyBag(&ptr2); - if (num2 >= 0) - { - num2 = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)ptr2 + 56)))((nint)ptr2, (EQueryPropertyBagProp)0, num); - if (num2 >= 0) - { - num2 = ZuneLibraryExports.GetFieldValues(nMediaId, EListType.ePodcastEpisodeList, 1, &dBPropertyRequestStruct, ptr2); - if (num2 >= 0) - { - num2 = ((System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref dBPropertyRequestStruct, 4)) < 0) ? System.Runtime.CompilerServices.Unsafe.As(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref dBPropertyRequestStruct, 4)) : global::_003CModule_003E.PropVariantCopy(pvarValue, (tagPROPVARIANT*)System.Runtime.CompilerServices.Unsafe.AsPointer(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref dBPropertyRequestStruct, 8)))); - } - } - } - } - if (0L != (nint)ptr2) - { - IQueryPropertyBag* intPtr = ptr2; - ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)intPtr + 16)))((nint)intPtr); - ptr2 = null; - } - if (0L != (nint)ptr) - { - IService* intPtr2 = ptr; - ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)intPtr2 + 16)))((nint)intPtr2); - ptr = null; - } - } - catch - { - //try-fault - global::_003CModule_003E.___CxxCallUnwindDtor((delegate*)(delegate*)(&global::_003CModule_003E.DBPropertyRequestStruct_002E_007Bdtor_007D), &dBPropertyRequestStruct); - throw; - } - global::_003CModule_003E.DBPropertyRequestStruct_002E_007Bdtor_007D(&dBPropertyRequestStruct); - return num2; - } + hresult = GetDatabaseValue(m_nEpisodeId, 317u, (tagPROPVARIANT*)&cComPropVariant); + } + else if (_003CModule_003E._wcsicmp(ptr, VCString.AsPtr(ref _003CModule_003E.PROPNAME_DownloadErrorCode)) == 0) + { + cComPropVariant.vt = VARTYPE.VT_NULL; + if (m_nEpisodeId < 0) + { + goto IL_028b; + } + hresult = GetDatabaseValue(m_nEpisodeId, 144u, (tagPROPVARIANT*)&cComPropVariant); + } + else + { + int num2 = 0; + PROPERTY_TO_PID_MAP* ptr2 = (PROPERTY_TO_PID_MAP*)&propertyToPidMap; + while (_003CModule_003E._wcsicmp(ptr, (ushort*)*(ulong*)ptr2) != 0) + { + num2++; + ptr2 = (PROPERTY_TO_PID_MAP*)((ulong)(nint)ptr2 + 16uL); + if ((uint)num2 < 8u) + { + continue; + } + goto IL_028b; + } + uint num3 = *(uint*)((ref *(_003F*)((long)num2 * 16L)) + (ref Unsafe.As<_0024ArrayType_0024_0024_0024BY07UPROPERTY_TO_PID_MAP_0040Subscription_0040Zune_0040Microsoft_0040_0040, _003F>(ref Unsafe.AddByteOffset(ref propertyToPidMap, 8)))); + IMSMediaSchemaPropertySet* pEpisodePropertySet = m_pEpisodePropertySet; + hresult = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)pEpisodePropertySet + 48)))((nint)pEpisodePropertySet, num3, 0u, (tagPROPVARIANT*)&cComPropVariant); + } + if (hresult < 0) + { + goto IL_02b0; + } + } + goto IL_028b; + IL_02b0: + result = Mappings[propertyName].DefaultValue; + goto end_IL_00c8; + IL_028b: + if (_003CModule_003E.CComPropVariant_002EIsNullOrEmpty(&cComPropVariant)) + { + goto IL_02b0; + } + result = SubscriptionDataProviderQueryResult.ConvertVariantToType(Mappings[propertyName].PropertyTypeName, &cComPropVariant); + end_IL_00c8:; + } + } + catch + { + //try-fault + _003CModule_003E.___CxxCallUnwindDtor((delegate*)(delegate*)(&_003CModule_003E.CComPropVariant_002E_007Bdtor_007D), &cComPropVariant); + throw; + } + _003CModule_003E.CComPropVariant_002EClear(&cComPropVariant); + return result; + } + + public unsafe override void SetProperty(string propertyName, object value) + { + //IL_0046: Expected I, but got I8 + if (m_nEpisodeId > 0 && propertyName == "DownloadErrorCode") + { + Unsafe.SkipInit(out tagVARIANT tagVARIANT); + *(short*)&tagVARIANT = 3; + Unsafe.As(ref Unsafe.AddByteOffset(ref tagVARIANT, 8)) = (int)value; + Unsafe.SkipInit(out DBPropertySubmitStruct dBPropertySubmitStruct); + *(int*)&dBPropertySubmitStruct = 144; + Unsafe.As(ref Unsafe.AddByteOffset(ref dBPropertySubmitStruct, 8)) = (nint)(&tagVARIANT); + int num = ZuneLibraryExports.SetFieldValues(m_nEpisodeId, EListType.ePodcastEpisodeList, 1, &dBPropertySubmitStruct, null); + if (0 == num) + { + FirePropertyChanged(propertyName); + } + } + } + + public unsafe virtual void SaveToLibrary() + { + //IL_0003: Expected I, but got I8 + //IL_0006: Expected I, but got I8 + //IL_0033: Expected I, but got I8 + //IL_0033: Expected I, but got I8 + //IL_0098: Expected I, but got I8 + //IL_009c: Expected I, but got I8 + //IL_00ae: Expected I, but got I8 + //IL_0067: Expected I, but got I8 + IService* ptr = null; + ISubscriptionManager* ptr2 = null; + int num = 1; + int nSeriesId = -1; + int nEpisodeId = -1; + int singleton = _003CModule_003E.GetSingleton(_003CModule_003E.GuidToGUID(_003CModule_003E._GUID_bb2d1edd_1bd5_4be1_8d38_36d4f0849911), (void**)&ptr); + if (singleton >= 0) + { + singleton = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)ptr + 384)))((nint)ptr, null, &num); + if (singleton >= 0) + { + singleton = _003CModule_003E.GetSingleton((_GUID)_003CModule_003E._GUID_9dc7c984_41d5_4130_a5ac_46d0825cd29d, (void**)&ptr2); + if (singleton >= 0) + { + singleton = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)ptr2 + 136)))((nint)ptr2, num, EMediaTypes.eMediaTypePodcastSeries, m_pEpisodePropertySet, &nSeriesId, &nEpisodeId); + if (singleton >= 0) + { + m_nSeriesId = nSeriesId; + m_nEpisodeId = nEpisodeId; + FirePropertyChanged("DownloadState"); + } + } + } + } + if (0L != (nint)ptr) + { + IService* intPtr = ptr; + ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)intPtr + 16)))((nint)intPtr); + ptr = null; + } + if (0L != (nint)ptr2) + { + ISubscriptionManager* intPtr2 = ptr2; + ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)intPtr2 + 16)))((nint)intPtr2); + } + } + + internal unsafe void OnDispose() + { + //IL_0019: Expected I, but got I8 + //IL_0022: Expected I, but got I8 + IMSMediaSchemaPropertySet* pEpisodePropertySet = m_pEpisodePropertySet; + if (0L != (nint)pEpisodePropertySet) + { + ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)pEpisodePropertySet + 16)))((nint)pEpisodePropertySet); + m_pEpisodePropertySet = null; + } + } + + private unsafe int BindToLocalEpisode() + { + //IL_0003: Expected I, but got I8 + //IL_000b: Expected I4, but got I8 + //IL_0013: Expected I4, but got I8 + //IL_0050: Expected I, but got I8 + //IL_00a7: Expected I4, but got I8 + //IL_0071: Expected I, but got I8 + //IL_00e2: Expected I, but got I8 + //IL_00e6: Expected I, but got I8 + //IL_009a: Expected I, but got I8 + //IL_009a: Expected I, but got I8 + //IL_009a: Expected I, but got I8 + ISubscriptionManager* ptr = null; + Unsafe.SkipInit(out CComPropVariant cComPropVariant); + // IL initblk instruction + Unsafe.InitBlock(ref cComPropVariant, 0, 24); + int num2; + try + { + Unsafe.SkipInit(out CComPropVariant cComPropVariant2); + // IL initblk instruction + Unsafe.InitBlock(ref cComPropVariant2, 0, 24); + try + { + int num = -1; + fixed (ushort* ptr2 = &Unsafe.As(ref _003CModule_003E.PtrToStringChars(m_feedUrl))) + { + num2 = _003CModule_003E.GetSingleton((_GUID)_003CModule_003E._GUID_9dc7c984_41d5_4130_a5ac_46d0825cd29d, (void**)&ptr); + if (num2 >= 0) + { + IMSMediaSchemaPropertySet* pEpisodePropertySet = m_pEpisodePropertySet; + num2 = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)pEpisodePropertySet + 48)))((nint)pEpisodePropertySet, 16797697u, 0u, (tagPROPVARIANT*)&cComPropVariant); + if (num2 >= 0) + { + IMSMediaSchemaPropertySet* pEpisodePropertySet2 = m_pEpisodePropertySet; + num2 = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)pEpisodePropertySet2 + 48)))((nint)pEpisodePropertySet2, 134238215u, 0u, (tagPROPVARIANT*)&cComPropVariant2); + if (num2 >= 0) + { + long num3 = *(long*)ptr + 160; + num2 = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)num3))((nint)ptr, EMediaTypes.eMediaTypePodcastSeries, ptr2, (ushort*)Unsafe.As(ref Unsafe.AddByteOffset(ref cComPropVariant, 8)), (ushort*)Unsafe.As(ref Unsafe.AddByteOffset(ref cComPropVariant2, 8)), &num); + } + } + } + if (0 == num2) + { + Unsafe.SkipInit(out tagPROPVARIANT tagPROPVARIANT); + // IL initblk instruction + Unsafe.InitBlock(ref tagPROPVARIANT, 0, 24); + num2 = GetDatabaseValue(num, 311u, &tagPROPVARIANT); + if (num2 >= 0) + { + m_nEpisodeId = num; + m_nSeriesId = Unsafe.As(ref Unsafe.AddByteOffset(ref tagPROPVARIANT, 8)); + } + } + if (0L != (nint)ptr) + { + ISubscriptionManager* intPtr = ptr; + ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)intPtr + 16)))((nint)intPtr); + ptr = null; + } + } + } + catch + { + //try-fault + _003CModule_003E.___CxxCallUnwindDtor((delegate*)(delegate*)(&_003CModule_003E.CComPropVariant_002E_007Bdtor_007D), &cComPropVariant2); + throw; + } + _003CModule_003E.CComPropVariant_002EClear(&cComPropVariant2); + } + catch + { + //try-fault + _003CModule_003E.___CxxCallUnwindDtor((delegate*)(delegate*)(&_003CModule_003E.CComPropVariant_002E_007Bdtor_007D), &cComPropVariant); + throw; + } + _003CModule_003E.CComPropVariant_002EClear(&cComPropVariant); + return num2; + } + + private int InvalidateDownloadState() + { + FirePropertyChanged("DownloadState"); + FirePropertyChanged("DownloadType"); + FirePropertyChanged("DownloadErrorCode"); + return 0; + } + + private unsafe int GetDatabaseValue(int nMediaId, uint dwAtom, tagPROPVARIANT* pvarValue) + { + //IL_001b: Expected I, but got I8 + //IL_0046: Expected I, but got I8 + //IL_0042: Expected I, but got I8 + //IL_0042: Expected I, but got I8 + //IL_00b0: Expected I, but got I8 + //IL_00b4: Expected I, but got I8 + //IL_006e: Expected I, but got I8 + //IL_00c8: Expected I, but got I8 + //IL_00cc: Expected I, but got I8 + if (pvarValue == null) + { + _003CModule_003E._ZuneShipAssert(1001u, 633u); + return -2147467261; + } + IService* ptr = null; + int num = 1; + int num2 = _003CModule_003E.GetSingleton((_GUID)_003CModule_003E._GUID_bb2d1edd_1bd5_4be1_8d38_36d4f0849911, (void**)&ptr); + if (num2 >= 0) + { + num2 = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)ptr + 384)))((nint)ptr, null, &num); + } + IQueryPropertyBag* ptr2 = null; + Unsafe.SkipInit(out DBPropertyRequestStruct dBPropertyRequestStruct); + _003CModule_003E.DBPropertyRequestStruct_002E_007Bctor_007D(&dBPropertyRequestStruct, dwAtom); + try + { + if (num2 >= 0) + { + num2 = ZuneLibraryExports.CreatePropertyBag(&ptr2); + if (num2 >= 0) + { + num2 = ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)ptr2 + 56)))((nint)ptr2, (EQueryPropertyBagProp)0, num); + if (num2 >= 0) + { + num2 = ZuneLibraryExports.GetFieldValues(nMediaId, EListType.ePodcastEpisodeList, 1, &dBPropertyRequestStruct, ptr2); + if (num2 >= 0) + { + num2 = (Unsafe.As(ref Unsafe.AddByteOffset(ref dBPropertyRequestStruct, 4)) < 0) ? Unsafe.As(ref Unsafe.AddByteOffset(ref dBPropertyRequestStruct, 4)) : _003CModule_003E.PropVariantCopy(pvarValue, (tagPROPVARIANT*)Unsafe.AsPointer(ref Unsafe.AddByteOffset(ref dBPropertyRequestStruct, 8))); + } + } + } + } + if (0L != (nint)ptr2) + { + IQueryPropertyBag* intPtr = ptr2; + ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)intPtr + 16)))((nint)intPtr); + ptr2 = null; + } + if (0L != (nint)ptr) + { + IService* intPtr2 = ptr; + ((delegate* unmanaged[Cdecl, Cdecl])(*(ulong*)(*(long*)intPtr2 + 16)))((nint)intPtr2); + ptr = null; + } + } + catch + { + //try-fault + _003CModule_003E.___CxxCallUnwindDtor((delegate*)(delegate*)(&_003CModule_003E.DBPropertyRequestStruct_002E_007Bdtor_007D), &dBPropertyRequestStruct); + throw; + } + _003CModule_003E.DBPropertyRequestStruct_002E_007Bdtor_007D(&dBPropertyRequestStruct); + return num2; + } } diff --git a/ZuneDBApi/Microsoft.Zune.Subscription/SubscriptionSeriesInfo.cs b/ZuneDBApi/Microsoft.Zune.Subscription/SubscriptionSeriesInfo.cs index 1010327..a070c0b 100644 --- a/ZuneDBApi/Microsoft.Zune.Subscription/SubscriptionSeriesInfo.cs +++ b/ZuneDBApi/Microsoft.Zune.Subscription/SubscriptionSeriesInfo.cs @@ -29,52 +29,52 @@ public class SubscriptionSeriesInfo : DataProviderObject [ new() { - propertyName = (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_FeedUrl), + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_FeedUrl), propertyId = 0x8000103 }, new() { - propertyName = (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_ErrorCode), + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_ErrorCode), propertyId = 0x600010A }, new() { - propertyName = (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_Title), + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_Title), propertyId = PROPID_Title }, new() { - propertyName = (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_HomeUrl), + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_HomeUrl), propertyId = 0x800600C }, new() { - propertyName = (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_ArtUrl), + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_ArtUrl), propertyId = 0x800600D }, new() { - propertyName = (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_Description), + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_Description), propertyId = 0x8006002 }, new() { - propertyName = (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_Explicit), + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_Explicit), propertyId = 0x5006006 }, new() { - propertyName = (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_Copyright), + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_Copyright), propertyId = 0x1006009 }, new() { - propertyName = (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_Author), + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_Author), propertyId = 0x1006004 }, new() { - propertyName = (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_OwnerName), + propertyName = VCString.AsPtr(ref _003CModule_003E.PROPNAME_OwnerName), propertyId = 0x1006007 }, ]; @@ -87,9 +87,9 @@ public class SubscriptionSeriesInfo : DataProviderObject { fixed (ushort* pPropertyName = VCString.ToWide(propertyName)) { - if (_003CModule_003E._wcsicmp(pPropertyName, (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_LibraryId)) != 0 - && _003CModule_003E._wcsicmp(pPropertyName, (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_SeriesState)) != 0 - && _003CModule_003E._wcsicmp(pPropertyName, (ushort*)Unsafe.AsPointer(ref _003CModule_003E.PROPNAME_NumberOfEpisodes)) != 0 + if (_003CModule_003E._wcsicmp(pPropertyName, VCString.AsPtr(ref _003CModule_003E.PROPNAME_LibraryId)) != 0 + && _003CModule_003E._wcsicmp(pPropertyName, VCString.AsPtr(ref _003CModule_003E.PROPNAME_SeriesState)) != 0 + && _003CModule_003E._wcsicmp(pPropertyName, VCString.AsPtr(ref _003CModule_003E.PROPNAME_NumberOfEpisodes)) != 0 && m_pSeriesPropertySet != null) { for (int currentMapIndex = 0; currentMapIndex < propertyToPidMaps.Length; currentMapIndex++)