Skip to content

Commit

Permalink
Update ExpressionTreeToString to 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitz committed Sep 16, 2020
1 parent 533e234 commit 2016ff2
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 23 deletions.
4 changes: 2 additions & 2 deletions Debuggee/Debuggee.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ZSpitz.Util" Version="0.0.42" />
<PackageReference Include="ExpressionTreeToString" Version="2.0.27" />
<PackageReference Include="ZSpitz.Util" Version="0.1.56" />
<PackageReference Include="ExpressionTreeToString" Version="3.0.41" />
<Reference Include="Microsoft.VisualStudio.DebuggerVisualizers">
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.DebuggerVisualizers.dll</HintPath>
<Private>false</Private>
Expand Down
6 changes: 3 additions & 3 deletions Package/Package.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ExpressionTreeToString" Version="2.0.27" />
<PackageReference Include="ExpressionTreeToString" Version="3.0.41" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
<PackageReference Include="ZSpitz.Util" Version="0.0.42" />
<PackageReference Include="ZSpitz.Util.Wpf" Version="0.0.42" />
<PackageReference Include="ZSpitz.Util" Version="0.1.56" />
<PackageReference Include="ZSpitz.Util.Wpf" Version="0.1.56" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="MultiSelectTreeView" Version="1.0.9" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Serialization/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using Periscope.Debuggee;
#endif
using System;
using static ExpressionTreeToString.FormatterNames;
using static ExpressionTreeToString.RendererNames;

namespace ExpressionTreeVisualizer.Serialization {
[Serializable]
Expand Down
10 changes: 4 additions & 6 deletions Serialization/ExpressionNodeData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using ExpressionTreeToString.Util;
using static ExpressionTreeVisualizer.Serialization.EndNodeTypes;
using static ExpressionTreeToString.Globals;
using System.Runtime.CompilerServices;
using static ExpressionTreeToString.FormatterNames;
using System.Collections;
using ZSpitz.Util;
using static ZSpitz.Util.Functions;
using ExpressionTreeToString;
using static ZSpitz.Util.Language;

namespace ExpressionTreeVisualizer.Serialization {
[Serializable]
Expand Down Expand Up @@ -68,14 +66,14 @@ public class ExpressionNodeData {
internal ExpressionNodeData(object o, (string aggregatePath, string pathFromParent) path, VisualizerData visualizerData, ValueExtractor valueExtractor, Dictionary<string, (int start, int length)> pathSpans, bool isParameterDeclaration = false, PropertyInfo? pi = null, string? parentWatchExpression = null) :
this(
o, path,
visualizerData.Config.Language,
OneOfStringLanguageExtensions.ResolveLanguage(visualizerData.Config.Language)!.Value,
valueExtractor,
pathSpans, isParameterDeclaration, pi, parentWatchExpression
) { }

private ExpressionNodeData(
object o, (string aggregatePath, string pathFromParent) path,
string language,
Language language,
ValueExtractor valueExtractor,
Dictionary<string, (int start, int length)> pathSpans, bool isParameterDeclaration = false, PropertyInfo? pi = null, string? parentWatchExpression = null
) {
Expand Down Expand Up @@ -212,7 +210,7 @@ private ExpressionNodeData(

string? factoryMethodName = null;
if (o is BinaryExpression || o is UnaryExpression) {
BinaryUnaryMethods.TryGetValue(((Expression)o).NodeType, out factoryMethodName);
Globals.FactoryMethodNames.TryGetValue(((Expression)o).NodeType, out factoryMethodName);
}
if (factoryMethodName.IsNullOrWhitespace()) {
var publicType = o.GetType().BaseTypes(false, true).FirstOrDefault(x => !x.IsInterface && x.IsPublic);
Expand Down
3 changes: 1 addition & 2 deletions Serialization/VisualizerData.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using ExpressionTreeToString;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using ZSpitz.Util;
using static ZSpitz.Util.Functions;
Expand All @@ -17,7 +16,7 @@ public VisualizerData(object o, Config? config = null) {
if (!Config.Path.IsNullOrWhitespace()) {
o = ((Expression)ResolvePath(o, Config.Path)).ExtractValue();
}
Source = WriterBase.Create(o, Config.Formatter, Config.Language, out var pathSpans).ToString();
Source = Renderers.Invoke(Config.Formatter, o, Config.Language, out var pathSpans);

var valueExtractor = new ValueExtractor();
Root = new ExpressionNodeData(o, ("", ""), this, valueExtractor, pathSpans, false);
Expand Down
6 changes: 3 additions & 3 deletions Tests.Visualizer/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ExpressionTreeToString" Version="2.0.27" />
<PackageReference Include="ExpressionTreeToString" Version="3.0.41" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.2">
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="ExpressionTreeTestObjects" Version="1.0.5" />
<PackageReference Include="ExpressionTreeTestObjects" Version="1.0.12" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 3 additions & 2 deletions UI/SettingsControl.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using static ExpressionTreeToString.FormatterNames;
using static ExpressionTreeToString.Renderers;
using static ZSpitz.Util.LanguageNames;

namespace ExpressionTreeVisualizer {
public partial class SettingsControl {
public SettingsControl() {
InitializeComponent();

cmbFormatters.ItemsSource = new[] { CSharp, VisualBasic, FactoryMethods, ObjectNotation, TextualTree };
cmbFormatters.ItemsSource = RendererKeys;
cmbLanguages.ItemsSource = new[] { CSharp, VisualBasic };
}
}
Expand Down
2 changes: 1 addition & 1 deletion Visualizer/Periscope
6 changes: 3 additions & 3 deletions Visualizer/Visualizer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@
<HintPath>..\..\..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\PublicAssemblies\Microsoft.VisualStudio.DebuggerVisualizers.dll</HintPath>
<Private>false</Private>
</Reference>
<PackageReference Include="ExpressionTreeToString" Version="2.0.27" />
<PackageReference Include="ExpressionTreeToString" Version="3.0.41" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.19" />
<PackageReference Include="MultiSelectTreeView" Version="1.0.9" />
<PackageReference Include="ZSpitz.Util" Version="0.0.42" />
<PackageReference Include="ZSpitz.Util.Wpf" Version="0.0.42" />
<PackageReference Include="ZSpitz.Util" Version="0.1.56" />
<PackageReference Include="ZSpitz.Util.Wpf" Version="0.1.56" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Octokit" Version="0.48.0" />
<ProjectReference Include="..\Debuggee\Debuggee.csproj" />
Expand Down

0 comments on commit 2016ff2

Please sign in to comment.