From c920dff44800eb4a147395ca9fe128f3e1e2df76 Mon Sep 17 00:00:00 2001 From: Joshua Askharoun Date: Sun, 21 Feb 2021 22:52:00 -0600 Subject: [PATCH] Make library compile --- Microsoft/Zune/PerfTrace/EtwTraceProvider.cs | 26 +++++++++++--------- Microsoft/Zune/Shell/ZuneApplication.cs | 8 +++--- ZuneUI/Attachment.cs | 4 ++- ZuneUI/LibraryPlaybackTrack.cs | 10 ++++---- ZuneUI/MobileWirelessSyncWizard.cs | 8 +++--- ZuneUI/MusicLibraryPage.cs | 12 ++++----- ZuneUI/PlaylistManager.cs | 12 ++++----- ZuneUI/PodcastCredentials.cs | 2 +- ZuneUI/PodcastSignIn.cs | 2 +- ZuneUI/ProxyCredentials.cs | 8 +++--- ZuneUI/RecommendationsHelper.cs | 6 ++--- ZuneUI/UIGasGauge.cs | 3 ++- ZuneXml/XmlDataProviderQuery.cs | 12 ++++----- 13 files changed, 59 insertions(+), 54 deletions(-) diff --git a/Microsoft/Zune/PerfTrace/EtwTraceProvider.cs b/Microsoft/Zune/PerfTrace/EtwTraceProvider.cs index 0f0b7e2..1b78e09 100644 --- a/Microsoft/Zune/PerfTrace/EtwTraceProvider.cs +++ b/Microsoft/Zune/PerfTrace/EtwTraceProvider.cs @@ -29,9 +29,11 @@ namespace Microsoft.Zune.PerfTrace this._traceHandle = 0UL; this._registrationHandle = 0UL; RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(regPath); - num = 1; - if (registryKey == null || !(registryKey.GetValue("EtwEnabled") is int num)) - ; + int num = 1; + if (registryKey != null && registryKey.GetValue("EtwEnabled") is int val) + { + num = val; + } if (num <= 0) { this._enabled = false; @@ -247,14 +249,14 @@ namespace Microsoft.Zune.PerfTrace if (data0 != null) { ++num2; - EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)((UIntPtr) & baseEvent.UserData + (UIntPtr)num3++ * (UIntPtr)sizeof(EtwTraceProvider.MofField)); + EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField)); if ((str10 = this.ProcessOneObject(data0, mofField, ptr, ref offSet)) != null) num1 |= 1; } if (data1 != null) { ++num2; - EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)((UIntPtr) & baseEvent.UserData + (UIntPtr)num3++ * (UIntPtr)sizeof(EtwTraceProvider.MofField)); + EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField)); ptr = chPtr1 + offSet; if ((str9 = this.ProcessOneObject(data1, mofField, ptr, ref offSet)) != null) num1 |= 2; @@ -262,7 +264,7 @@ namespace Microsoft.Zune.PerfTrace if (data2 != null) { ++num2; - EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)((UIntPtr) & baseEvent.UserData + (UIntPtr)num3++ * (UIntPtr)sizeof(EtwTraceProvider.MofField)); + EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField)); ptr = chPtr1 + offSet; if ((str8 = this.ProcessOneObject(data2, mofField, ptr, ref offSet)) != null) num1 |= 4; @@ -270,7 +272,7 @@ namespace Microsoft.Zune.PerfTrace if (data3 != null) { ++num2; - EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)((UIntPtr) & baseEvent.UserData + (UIntPtr)num3++ * (UIntPtr)sizeof(EtwTraceProvider.MofField)); + EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField)); ptr = chPtr1 + offSet; if ((str7 = this.ProcessOneObject(data3, mofField, ptr, ref offSet)) != null) num1 |= 8; @@ -278,7 +280,7 @@ namespace Microsoft.Zune.PerfTrace if (data4 != null) { ++num2; - EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)((UIntPtr) & baseEvent.UserData + (UIntPtr)num3++ * (UIntPtr)sizeof(EtwTraceProvider.MofField)); + EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField)); ptr = chPtr1 + offSet; if ((str6 = this.ProcessOneObject(data4, mofField, ptr, ref offSet)) != null) num1 |= 16; @@ -286,7 +288,7 @@ namespace Microsoft.Zune.PerfTrace if (data5 != null) { ++num2; - EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)((UIntPtr) & baseEvent.UserData + (UIntPtr)num3++ * (UIntPtr)sizeof(EtwTraceProvider.MofField)); + EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField)); ptr = chPtr1 + offSet; if ((str5 = this.ProcessOneObject(data5, mofField, ptr, ref offSet)) != null) num1 |= 32; @@ -294,7 +296,7 @@ namespace Microsoft.Zune.PerfTrace if (data6 != null) { ++num2; - EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)((UIntPtr) & baseEvent.UserData + (UIntPtr)num3++ * (UIntPtr)sizeof(EtwTraceProvider.MofField)); + EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField)); ptr = chPtr1 + offSet; if ((str4 = this.ProcessOneObject(data6, mofField, ptr, ref offSet)) != null) num1 |= 64; @@ -302,7 +304,7 @@ namespace Microsoft.Zune.PerfTrace if (data7 != null) { ++num2; - EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)((UIntPtr) & baseEvent.UserData + (UIntPtr)num3++ * (UIntPtr)sizeof(EtwTraceProvider.MofField)); + EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField)); ptr = chPtr1 + offSet; if ((str3 = this.ProcessOneObject(data7, mofField, ptr, ref offSet)) != null) num1 |= 128; @@ -310,7 +312,7 @@ namespace Microsoft.Zune.PerfTrace if (data8 != null) { uint num4 = num2 + 1U; - EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)((UIntPtr) & baseEvent.UserData + (UIntPtr)num3++ * (UIntPtr)sizeof(EtwTraceProvider.MofField)); + EtwTraceProvider.MofField* mofField = (EtwTraceProvider.MofField*)( & baseEvent.UserData + num3++ * sizeof(EtwTraceProvider.MofField)); ptr = chPtr1 + offSet; if ((str2 = this.ProcessOneObject(data8, mofField, ptr, ref offSet)) != null) num1 |= 256; diff --git a/Microsoft/Zune/Shell/ZuneApplication.cs b/Microsoft/Zune/Shell/ZuneApplication.cs index f22dba3..eac1fb2 100644 --- a/Microsoft/Zune/Shell/ZuneApplication.cs +++ b/Microsoft/Zune/Shell/ZuneApplication.cs @@ -205,10 +205,10 @@ namespace Microsoft.Zune.Shell } if (args[(object)"link"] is string link && !ZuneUI.Shell.IgnoreAppNavigationsArgs) ZuneUI.Shell.ProcessExternalLink(link); - if (args[(object)"ripcd"] is string path && !ZuneUI.Shell.IgnoreAppNavigationsArgs) - CDAccess.HandleDiskFromAutoplay(path, CDAction.Rip); - if (args[(object)"playcd"] is string path && !ZuneUI.Shell.IgnoreAppNavigationsArgs) - CDAccess.HandleDiskFromAutoplay(path, CDAction.Play); + if (args[(object)"ripcd"] is string playCdPath && !ZuneUI.Shell.IgnoreAppNavigationsArgs) + CDAccess.HandleDiskFromAutoplay(playCdPath, CDAction.Rip); + if (args[(object)"playcd"] is string ripCdPath && !ZuneUI.Shell.IgnoreAppNavigationsArgs) + CDAccess.HandleDiskFromAutoplay(ripCdPath, CDAction.Play); if (args[(object)"playmedia"] is string initialUrl && !ZuneUI.Shell.IgnoreAppNavigationsArgs) ZuneApplication.RegisterNewFileEnumeration(new LaunchFromShellHelper("play", initialUrl)); if (args[(object)"shellhlp_v2"] is string taskName && !ZuneUI.Shell.IgnoreAppNavigationsArgs) diff --git a/ZuneUI/Attachment.cs b/ZuneUI/Attachment.cs index c31923d..f097f22 100644 --- a/ZuneUI/Attachment.cs +++ b/ZuneUI/Attachment.cs @@ -41,13 +41,15 @@ namespace ZuneUI public static bool CanCreateAttachment(object obj) { + DataProviderObject dataProviderObject = null; MediaType mediaType = MediaType.Undefined; Guid guid = Guid.Empty; int num = -1; bool flag = false; switch (obj) { - case DataProviderObject dataProviderObject: + case DataProviderObject _: + dataProviderObject = (DataProviderObject)obj; object property1 = dataProviderObject.GetProperty("ZuneMediaId"); if (property1 != null) guid = (Guid)property1; diff --git a/ZuneUI/LibraryPlaybackTrack.cs b/ZuneUI/LibraryPlaybackTrack.cs index b32c774..25a3dcd 100644 --- a/ZuneUI/LibraryPlaybackTrack.cs +++ b/ZuneUI/LibraryPlaybackTrack.cs @@ -221,7 +221,7 @@ namespace ZuneUI this._hasIncrementedSkipCount = false; this._lastStoredBookmark = 0L; this._duration = playbackWrapper.Duration; - if (this._mediaType == MediaType.PodcastEpisode || this._mediaType == MediaType.Video) + if (this._mediaType == ZuneUI.MediaType.PodcastEpisode || this._mediaType == ZuneUI.MediaType.Video) { LibraryPlaybackTrack.PodcastVideoLengthGroup videoLengthGroup = LibraryPlaybackTrack.PodcastVideoLengthGroup.Long; while (videoLengthGroup > LibraryPlaybackTrack.PodcastVideoLengthGroup.Short && this._duration <= LibraryPlaybackTrack.c_podcastVideoLengths[(int)videoLengthGroup]) @@ -236,7 +236,7 @@ namespace ZuneUI if (this._lastStoredBookmark > 200000000L) this._hasIncrementedPlayCount = true; } - if (this._mediaType == MediaType.PodcastEpisode) + if (this._mediaType == ZuneUI.MediaType.PodcastEpisode) { if (this.IsVideo) SQMLog.Log(SQMDataId.PodcastVideoEpisodePlayed, 1); @@ -247,13 +247,13 @@ namespace ZuneUI EMediaTypes MediaType; switch (this.MediaType) { - case MediaType.Track: + case ZuneUI.MediaType.Track: MediaType = EMediaTypes.eMediaTypeAudio; break; - case MediaType.Video: + case ZuneUI.MediaType.Video: MediaType = EMediaTypes.eMediaTypeVideo; break; - case MediaType.PodcastEpisode: + case ZuneUI.MediaType.PodcastEpisode: MediaType = EMediaTypes.eMediaTypePodcastEpisode; break; default: diff --git a/ZuneUI/MobileWirelessSyncWizard.cs b/ZuneUI/MobileWirelessSyncWizard.cs index 723db25..5332d8d 100644 --- a/ZuneUI/MobileWirelessSyncWizard.cs +++ b/ZuneUI/MobileWirelessSyncWizard.cs @@ -38,10 +38,10 @@ namespace ZuneUI public override void Cancel() { - if (this.CurrentPage is MobileWirelessSyncWizardPage currentPage) - currentPage.OnCancel(); - if (this.CurrentPage is MobileWirelessSyncErrorPage currentPage) - currentPage.OnCancel(); + if (this.CurrentPage is MobileWirelessSyncWizardPage currentWizardPage) + currentWizardPage.OnCancel(); + if (this.CurrentPage is MobileWirelessSyncErrorPage currentErrorPage) + currentErrorPage.OnCancel(); base.Cancel(); } } diff --git a/ZuneUI/MusicLibraryPage.cs b/ZuneUI/MusicLibraryPage.cs index 9088e48..3c1fa4e 100644 --- a/ZuneUI/MusicLibraryPage.cs +++ b/ZuneUI/MusicLibraryPage.cs @@ -549,7 +549,7 @@ namespace ZuneUI private void ShowContentTypesChanged(object sender, EventArgs e) { if (!this.ShowContentTypes.Value) - this.DrmStateMask = DrmStateMask.All(); + this.DrmStateMask = ZuneUI.DrmStateMask.All(); ClientConfiguration.Shell.ShowContentTypes = this.ShowContentTypes.Value; } @@ -640,7 +640,7 @@ namespace ZuneUI { if (!(ZuneShell.DefaultInstance.CurrentPage is LibraryPage currentPage)) return; - currentPage.DrmStateMask = DrmStateMask.All(); + currentPage.DrmStateMask = ZuneUI.DrmStateMask.All(); SQMLog.Log(SQMDataId.LibraryContentTypeAllClicks, 1); } @@ -648,7 +648,7 @@ namespace ZuneUI { if (!(ZuneShell.DefaultInstance.CurrentPage is LibraryPage currentPage)) return; - currentPage.DrmStateMask = DrmStateMask.Personal(); + currentPage.DrmStateMask = ZuneUI.DrmStateMask.Personal(); SQMLog.Log(SQMDataId.LibraryContentTypePersonalClicks, 1); } @@ -656,7 +656,7 @@ namespace ZuneUI { if (!(ZuneShell.DefaultInstance.CurrentPage is LibraryPage currentPage)) return; - currentPage.DrmStateMask = DrmStateMask.Protected(); + currentPage.DrmStateMask = ZuneUI.DrmStateMask.Protected(); SQMLog.Log(SQMDataId.LibraryContentTypeProtectedClicks, 1); } @@ -664,7 +664,7 @@ namespace ZuneUI { if (!(ZuneShell.DefaultInstance.CurrentPage is LibraryPage currentPage)) return; - currentPage.DrmStateMask = DrmStateMask.ZunePass(); + currentPage.DrmStateMask = ZuneUI.DrmStateMask.ZunePass(); SQMLog.Log(SQMDataId.LibraryContentTypeZunePassClicks, 1); } @@ -710,7 +710,7 @@ namespace ZuneUI if (this.NavigationArguments != null) { MusicLibraryPage._preferredContentType = MusicLibraryPage._showContentTypesAll; - this.DrmStateMask = DrmStateMask.All(); + this.DrmStateMask = ZuneUI.DrmStateMask.All(); if (this.NavigationArguments.Contains((object)"ViewOverrideId")) { MusicLibraryView navigationArgument = (MusicLibraryView)this.NavigationArguments[(object)"ViewOverrideId"]; diff --git a/ZuneUI/PlaylistManager.cs b/ZuneUI/PlaylistManager.cs index 7fc981c..60234b4 100644 --- a/ZuneUI/PlaylistManager.cs +++ b/ZuneUI/PlaylistManager.cs @@ -349,20 +349,20 @@ namespace ZuneUI if (count <= 0) return; MediaType mediaType1 = MediaType.Undefined; - if (items[0] is LibraryDataProviderItemBase providerItemBase) + if (items[0] is LibraryDataProviderItemBase providerItemBaseA) { - if (providerItemBase.TypeName == "Artist") + if (providerItemBaseA.TypeName == "Artist") mediaType1 = MediaType.Artist; - else if (providerItemBase.TypeName == "Album") + else if (providerItemBaseA.TypeName == "Album") mediaType1 = MediaType.Album; - else if (providerItemBase.TypeName == "Genre") + else if (providerItemBaseA.TypeName == "Genre") mediaType1 = MediaType.Genre; } if (mediaType1 == MediaType.Artist || mediaType1 == MediaType.Genre || mediaType1 == MediaType.Album) { IList list = (IList)new ArrayList(count); - foreach (LibraryDataProviderItemBase providerItemBase in (IEnumerable)items) - list.Add((object)(int)providerItemBase.GetProperty("LibraryId")); + foreach (LibraryDataProviderItemBase providerItemBaseB in (IEnumerable)items) + list.Add((int)providerItemBaseB.GetProperty("LibraryId")); bool singleAlbum = list.Count == 1; if ((mediaType1 == MediaType.Artist || mediaType1 == MediaType.Genre) && list.Count == 1) { diff --git a/ZuneUI/PodcastCredentials.cs b/ZuneUI/PodcastCredentials.cs index a1b92cc..8d065bf 100644 --- a/ZuneUI/PodcastCredentials.cs +++ b/ZuneUI/PodcastCredentials.cs @@ -57,7 +57,7 @@ namespace ZuneUI this._inputDialog.Dispose(); this._inputDialog = (PodcastSignIn)null; } - this._inputDialog = new PodcastSignIn((SubscriptonCredentialRequestArguments)args, new EventHandler(((NetworkSignInCredentials)this).OnDialogSignIn), new EventHandler(((NetworkSignInCredentials)this).OnDialogCanceled)); + this._inputDialog = new PodcastSignIn((SubscriptonCredentialRequestArguments)args, new EventHandler(OnDialogSignIn), new EventHandler(OnDialogCanceled)); this._inputDialog.Show(); } diff --git a/ZuneUI/PodcastSignIn.cs b/ZuneUI/PodcastSignIn.cs index f58469b..e00f9d3 100644 --- a/ZuneUI/PodcastSignIn.cs +++ b/ZuneUI/PodcastSignIn.cs @@ -38,7 +38,7 @@ namespace ZuneUI : base(signInHandler, cancelHandler, "res://ZuneShellResources!PodcastDialogs.uix#PodcastSignInDialogUI") { this._credentials = credentials; - this.Cancel.Invoked += new EventHandler(((NetworkSignInDialogHelper)this).OnInvoked); + this.Cancel.Invoked += new EventHandler(this.OnInvoked); this._seriesTitle = this._credentials.SubscriptionMediaId <= 0 ? string.Empty : PlaylistManager.GetFieldValue(this._credentials.SubscriptionMediaId, EListType.ePodcastList, 344, string.Empty); this._title = Shell.LoadString(StringId.IDS_PODCAST_SIGN_IN_TITLE); Uri uri = new Uri(this._credentials.TargetUrl); diff --git a/ZuneUI/ProxyCredentials.cs b/ZuneUI/ProxyCredentials.cs index 21459a7..7c9ecfa 100644 --- a/ZuneUI/ProxyCredentials.cs +++ b/ZuneUI/ProxyCredentials.cs @@ -75,10 +75,10 @@ namespace ZuneUI if (this._inputDialog != null) { this._inputDialog.Dispose(); - this._inputDialog = (ProxySignIn)null; + this._inputDialog = null; } this._credentials = (UserCredentialRequestArguments)args; - this._inputDialog = new ProxySignIn(this._credentials, new EventHandler(((NetworkSignInCredentials)this).OnDialogSignIn), new EventHandler(((NetworkSignInCredentials)this).OnDialogCanceled)); + this._inputDialog = new ProxySignIn(this._credentials, new EventHandler(OnDialogSignIn), new EventHandler(OnDialogCanceled)); this._inputDialog.Show(); this._lastUIPathPrompted = ZuneShell.DefaultInstance.CurrentPage.UIPath; } @@ -92,11 +92,11 @@ namespace ZuneUI public override void Dispose() { - UserCredentialManager.Instance.SetCredentialHandler((UserCredentialHandler)null); + UserCredentialManager.Instance.SetCredentialHandler(null); if (this._inputDialog != null) { this._inputDialog.Dispose(); - this._inputDialog = (ProxySignIn)null; + this._inputDialog = null; } base.Dispose(); } diff --git a/ZuneUI/RecommendationsHelper.cs b/ZuneUI/RecommendationsHelper.cs index 7829510..a2672b7 100644 --- a/ZuneUI/RecommendationsHelper.cs +++ b/ZuneUI/RecommendationsHelper.cs @@ -74,9 +74,9 @@ namespace ZuneUI public static int GetKeyValueInt(IDictionary dictionary, object key, int defaultValue) { - num = defaultValue; - if (dictionary == null || !dictionary.Contains(key) || !(dictionary[key] is int num)) - ; + int num = defaultValue; + if (dictionary != null && dictionary.Contains(key) && dictionary[key] is int val) + num = val; return num; } diff --git a/ZuneUI/UIGasGauge.cs b/ZuneUI/UIGasGauge.cs index 0eeb566..1576040 100644 --- a/ZuneUI/UIGasGauge.cs +++ b/ZuneUI/UIGasGauge.cs @@ -24,7 +24,8 @@ namespace ZuneUI this._gauge.CategorySpaceUsedUpdatedEvent += new CategorySpaceUsedUpdatedHandler(this.OnCategorySpaceUpdated); this._gauge.ReservedSpaceUpdatedEvent += new ReservedSpaceUpdatedHandler(this.OnReservedSpaceUpdated); } - if (!(owner is UIDevice uiDevice) && owner is SyncGroupList syncGroupList) + UIDevice uiDevice = owner as UIDevice; + if (uiDevice == null && owner is SyncGroupList syncGroupList) uiDevice = syncGroupList.Device; if (uiDevice == null) return; diff --git a/ZuneXml/XmlDataProviderQuery.cs b/ZuneXml/XmlDataProviderQuery.cs index d3590f4..6f8af82 100644 --- a/ZuneXml/XmlDataProviderQuery.cs +++ b/ZuneXml/XmlDataProviderQuery.cs @@ -83,12 +83,12 @@ namespace ZuneXml protected override void BeginExecute() { - if (this.GetProperty("SendPassportTicket") is bool property) - this._passportTicketType = property ? EPassportPolicyId.MBI : EPassportPolicyId.None; - if (this.GetProperty("SendSecurePassportTicket") is bool property) - this._passportTicketType = property ? EPassportPolicyId.MBI_SSL : EPassportPolicyId.None; - if (this.GetProperty("RefreshOnCacheExpire") is bool property) - this._refreshOnCacheExpire = property; + if (this.GetProperty("SendPassportTicket") is bool passportProperty) + this._passportTicketType = passportProperty ? EPassportPolicyId.MBI : EPassportPolicyId.None; + if (this.GetProperty("SendSecurePassportTicket") is bool securePassportProperty) + this._passportTicketType = securePassportProperty ? EPassportPolicyId.MBI_SSL : EPassportPolicyId.None; + if (this.GetProperty("RefreshOnCacheExpire") is bool expireProperty) + this._refreshOnCacheExpire = expireProperty; string resourceUri = this.GetResourceUri(); string postBody = this.GetPostBody(); if (string.IsNullOrEmpty(resourceUri))