mirror of
https://github.com/ZuneDev/ZuneUIXTools.git
synced 2026-07-27 13:11:59 -07:00
Prevent DIS from producing invalid statements
This commit is contained in:
@@ -4,6 +4,7 @@ using Microsoft.CodeAnalysis.CSharp.Extensions;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Microsoft.Iris.Asm.Models;
|
||||
using Microsoft.Iris.Debug.Symbols;
|
||||
using Microsoft.Iris.DecompXml.Extensions;
|
||||
using Microsoft.Iris.DecompXml.Mock;
|
||||
using Microsoft.Iris.Markup;
|
||||
using Microsoft.Iris.Markup.UIX;
|
||||
@@ -127,6 +128,9 @@ partial class Decompiler
|
||||
break;
|
||||
}
|
||||
|
||||
if (!expr.IsStatementExpression())
|
||||
break;
|
||||
|
||||
cfa.AppendToBlock(ExpressionStatement(expr));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace Microsoft.Iris.DecompXml.Extensions;
|
||||
|
||||
internal static class SyntaxNodeExtensions
|
||||
{
|
||||
public static bool IsStatementExpression(this SyntaxNode syntax)
|
||||
{
|
||||
// The grammar gives:
|
||||
//
|
||||
// expression-statement:
|
||||
// statement-expression ;
|
||||
//
|
||||
// statement-expression:
|
||||
// invocation-expression
|
||||
// object-creation-expression
|
||||
// assignment
|
||||
// post-increment-expression
|
||||
// post-decrement-expression
|
||||
// pre-increment-expression
|
||||
// pre-decrement-expression
|
||||
// await-expression
|
||||
|
||||
switch (syntax.Kind())
|
||||
{
|
||||
case SyntaxKind.InvocationExpression:
|
||||
case SyntaxKind.ObjectCreationExpression:
|
||||
case SyntaxKind.SimpleAssignmentExpression:
|
||||
case SyntaxKind.AddAssignmentExpression:
|
||||
case SyntaxKind.SubtractAssignmentExpression:
|
||||
case SyntaxKind.MultiplyAssignmentExpression:
|
||||
case SyntaxKind.DivideAssignmentExpression:
|
||||
case SyntaxKind.ModuloAssignmentExpression:
|
||||
case SyntaxKind.AndAssignmentExpression:
|
||||
case SyntaxKind.OrAssignmentExpression:
|
||||
case SyntaxKind.ExclusiveOrAssignmentExpression:
|
||||
case SyntaxKind.LeftShiftAssignmentExpression:
|
||||
case SyntaxKind.RightShiftAssignmentExpression:
|
||||
case SyntaxKind.UnsignedRightShiftAssignmentExpression:
|
||||
case SyntaxKind.CoalesceAssignmentExpression:
|
||||
case SyntaxKind.PostIncrementExpression:
|
||||
case SyntaxKind.PostDecrementExpression:
|
||||
case SyntaxKind.PreIncrementExpression:
|
||||
case SyntaxKind.PreDecrementExpression:
|
||||
case SyntaxKind.AwaitExpression:
|
||||
return true;
|
||||
|
||||
case SyntaxKind.ConditionalAccessExpression:
|
||||
var access = (ConditionalAccessExpressionSyntax)syntax;
|
||||
return IsStatementExpression(access.WhenNotNull);
|
||||
|
||||
// Allow missing IdentifierNames; they will show up in error cases
|
||||
// where there is no statement whatsoever.
|
||||
|
||||
case SyntaxKind.IdentifierName:
|
||||
return syntax.IsMissing;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ ActionContainer.Visible = #SaveAsPlaylistButton.Visible # || #ShowMPContentCheck
|
||||
]]></Script>
|
||||
<Script><![CDATA[
|
||||
[DeclareTrigger(CurrentlyPlayingTrackMixAvailability.Available)]
|
||||
object track = zuneUI:TransportControls.Instance.CurrentTrack;
|
||||
zuneUI:PlaybackTrack track = zuneUI:TransportControls.Instance.CurrentTrack;
|
||||
if ((Page.ShowMixOnEntry && track != null) && (Page.InitialPlaybackID == track.PlaybackID) && #CurrentlyPlayingTrackMixAvailability.Available #)
|
||||
{
|
||||
CurrentlyPlayingTrackMixAvailability.UpdateMixSeed.Invoke();
|
||||
@@ -670,14 +670,12 @@ if (playingVideo)
|
||||
{
|
||||
object naturalWidth = stream.ContentHeight * stream.ContentAspectWidth / stream.ContentAspectHeight;
|
||||
object naturalHeight = stream.ContentHeight;
|
||||
object wndWidth = #Window.ClientSize #.Width;
|
||||
object wndHeight = Window.ClientSize.Height;
|
||||
int wndWidth = #Window.ClientSize #.Width;
|
||||
int wndHeight = Window.ClientSize.Height;
|
||||
if (wndWidth != 0 && wndHeight != 0)
|
||||
{
|
||||
object scaleX = (float)(wndWidth) / (float)(naturalWidth);
|
||||
((float)(wndWidth)) / ((float)(naturalWidth));
|
||||
object scaleY = (float)(wndHeight) / (float)(naturalHeight);
|
||||
((float)(wndHeight)) / ((float)(naturalHeight));
|
||||
int scale = system:Math.Min(scaleX, scaleY);
|
||||
maxVideoSizeX = #TransportControls.ZoomScaleFactor # * naturalWidth;
|
||||
maxVideoSizeY = TransportControls.ZoomScaleFactor * naturalHeight;
|
||||
@@ -1320,7 +1318,7 @@ if (ListModel.SelectionManager != null && ListModel.SelectionManager.IsSelected(
|
||||
<Scripts>
|
||||
<Script><![CDATA[
|
||||
[DeclareTrigger(zuneUI:TransportControls.Instance.CurrentTrack)]
|
||||
object track = #zuneUI:TransportControls.Instance.CurrentTrack #;
|
||||
zuneUI:PlaybackTrack track = #zuneUI:TransportControls.Instance.CurrentTrack #;
|
||||
if (LibraryAlbumInfo != null)
|
||||
{
|
||||
Class.DisposeOwnedObject(LibraryAlbumInfo);
|
||||
@@ -1513,7 +1511,7 @@ if (RotateInfo.Enabled)
|
||||
[DeclareTrigger(NowPlayingBackgroundHelper.Visible)]
|
||||
MPTrackQuery.Enabled = false;
|
||||
MPTrackQuery.Id = null;
|
||||
object currentTrack = zuneUI:TransportControls.Instance.CurrentTrack;
|
||||
zuneUI:PlaybackTrack currentTrack = zuneUI:TransportControls.Instance.CurrentTrack;
|
||||
if (#NowPlayingBackgroundHelper.Visible # && NowPlayingBackgroundHelper.Visible || !currentTrack.IsInVisibleCollection && util:FeatureEnablement.IsFeatureEnabled(zuneDBApi:Features.eMusic))
|
||||
{
|
||||
MPTrackQuery.Id = TrackId.ToString();
|
||||
@@ -1530,7 +1528,7 @@ ArtistQuery.Enabled = false;
|
||||
ArtistQuery.Id = null;
|
||||
TopListenersQuery.Enabled = false;
|
||||
TopListenersQuery.ArtistId = null;
|
||||
object currentTrack = zuneUI:TransportControls.Instance.CurrentTrack;
|
||||
zuneUI:PlaybackTrack currentTrack = zuneUI:TransportControls.Instance.CurrentTrack;
|
||||
if (((!zuneUI:GuidHelper.IsEmpty(ArtistId) && #NowPlayingBackgroundHelper.Visible # && util:FeatureEnablement.IsFeatureEnabled(zuneDBApi:Features.eMusic) && configuration:ClientConfiguration.Playback.ShowNowPlayingClipAnimations) && (iris:Application.RenderingQuality == iris:RenderingQuality.MaxQuality)) && (currentTrack != null) && currentTrack.IsMusic)
|
||||
{
|
||||
ArtistPhotosQuery.Id = ArtistId.ToString();
|
||||
|
||||
Reference in New Issue
Block a user