Skip to content

Commit

Permalink
Merge branch 'master' into LuceneIndexAmend
Browse files Browse the repository at this point in the history
  • Loading branch information
QilongTang committed Oct 24, 2023
2 parents b103148 + 892253e commit d958562
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 36 deletions.
23 changes: 15 additions & 8 deletions src/DynamoCoreWpf/Utilities/CrashReportTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,16 +125,23 @@ private static string FindCERToolInInstallLocations()

try
{
string rootFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var assemblyPath = Path.Combine(Path.Combine(rootFolder, "DynamoInstallDetective.dll"));
if (!File.Exists(assemblyPath))
throw new FileNotFoundException(assemblyPath);

var assembly = Assembly.LoadFrom(assemblyPath);

var type = assembly.GetType("DynamoInstallDetective.Utilities");
// Try to directly get the type for the detective class
// (this will in many cases also load the assembly)
var type = Type.GetType("DynamoInstallDetective.Utilities, DynamoInstallDetective", false);
if (type == null)
{
// fallback, load the assembly and get the type using LoadFrom
string rootFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
var assemblyPath = Path.Combine(rootFolder, "DynamoInstallDetective.dll");
if (!File.Exists(assemblyPath))
throw new FileNotFoundException(assemblyPath);

var assembly = Assembly.LoadFrom(assemblyPath);
type = assembly.GetType("DynamoInstallDetective.Utilities");
}

var installationsMethod = type.GetMethod(
var installationsMethod = type.GetMethod(
"FindMultipleProductInstallations",
BindingFlags.Public | BindingFlags.Static);

Expand Down
53 changes: 31 additions & 22 deletions src/DynamoCoreWpf/ViewModels/Core/NodeViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using Dynamo.Configuration;
using Dynamo.Engine.CodeGeneration;
using Dynamo.Graph;
Expand All @@ -18,9 +7,19 @@
using Dynamo.Logging;
using Dynamo.Models;
using Dynamo.Selection;
using Dynamo.UI;
using Dynamo.Wpf.ViewModels.Core;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
using System.Windows.Controls.Primitives;
using System.Windows.Media;
using Point = System.Windows.Point;
using Size = System.Windows.Size;

Expand Down Expand Up @@ -1349,7 +1348,7 @@ internal SolidColorBrush GetBorderColor()

/*
Priorities seem to be:
Error > Warning > Info ; Frozen > Preview > None
Error > Warning > Info ; Frozen > Package > Preview > None
Pass through all possible states in reverse order
to assign icon values for each possible scenario
*/
Expand All @@ -1358,14 +1357,6 @@ Pass through all possible states in reverse order

if (this.NodeModel == null) return result;

if (this.NodeModel.IsCustomFunction)
{
result = nodeCustomColor;
if(result != null)
{
ImgGlyphOneSource = packageGlyph;
}
}
if (!this.IsVisible)
{
result = nodePreviewColor;
Expand All @@ -1374,6 +1365,24 @@ Pass through all possible states in reverse order
ImgGlyphOneSource = previewGlyph;
}
}

if (this.NodeModel.IsCustomFunction)
{
result = nodeCustomColor;
if(result != null)
{
if (ImgGlyphOneSource == null)
{
ImgGlyphOneSource = packageGlyph;
}
else
{
ImgGlyphOneSource = packageGlyph;
ImgGlyphTwoSource = previewGlyph;
}
}
}

if (this.IsFrozen)
{
result = nodeFrozenOverlayColor;
Expand All @@ -1382,7 +1391,7 @@ Pass through all possible states in reverse order
if (ImgGlyphOneSource == null)
{
ImgGlyphOneSource = frozenGlyph;
}
}
else
{
ImgGlyphOneSource = frozenGlyph;
Expand Down
18 changes: 12 additions & 6 deletions src/Tools/DynamoShapeManager/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,13 +527,19 @@ public static string GetGeometryFactoryPath2(string rootFolder, Version version)
#endif
private static IEnumerable GetAsmInstallations(string rootFolder)
{
var assemblyPath = Path.Combine(Path.Combine(rootFolder, "DynamoInstallDetective.dll"));
if (!File.Exists(assemblyPath))
throw new FileNotFoundException(assemblyPath);

var assembly = Assembly.LoadFrom(assemblyPath);
// Try to directly get the type for the detective class
// (this will in many cases also load the assembly)
var type = Type.GetType("DynamoInstallDetective.Utilities, DynamoInstallDetective", false);
if (type == null)
{
// fallback, load the assembly and get the type using LoadFrom
var assemblyPath = Path.Combine(rootFolder, "DynamoInstallDetective.dll");
if (!File.Exists(assemblyPath))
throw new FileNotFoundException(assemblyPath);

var type = assembly.GetType("DynamoInstallDetective.Utilities");
var assembly = Assembly.LoadFrom(assemblyPath);
type = assembly.GetType("DynamoInstallDetective.Utilities");
}

var installationsMethod = type.GetMethod(
"FindMultipleProductInstallations",
Expand Down

0 comments on commit d958562

Please sign in to comment.