Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
reddyashish committed Dec 10, 2018
2 parents d055de4 + 615c080 commit 085fb51
Show file tree
Hide file tree
Showing 32 changed files with 4,065 additions and 97 deletions.
4 changes: 2 additions & 2 deletions src/DynamoCore/DynamoCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ limitations under the License.
<Reference Include="Analytics.NET.Google">
<HintPath>..\..\extern\Analytics.NET\Analytics.NET.Google.dll</HintPath>
</Reference>
<Reference Include="Greg, Version=1.1.6907.32055, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Greg.1.1.6907.32055\lib\net45\Greg.dll</HintPath>
<Reference Include="Greg, Version=1.1.6913.31484, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Greg.1.1.6913.31484\lib\net47\Greg.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCore/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Greg" version="1.1.6907.32055" targetFramework="net47" />
<package id="Greg" version="1.1.6913.31484" targetFramework="net47" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="RestSharp" version="105.2.3" targetFramework="net47" />
</packages>
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/Commands/WorkspaceCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ public bool IsGeometryOperationEnabled
return false; // No selection.

// Menu options that are specific to geometry (show/hide all
// geometry previews, upstream previews, etc.) are only enabled
// geometry previews, etc.) are only enabled
// in the home workspace.
//
return (this.Model is HomeWorkspaceModel);
Expand Down
4 changes: 2 additions & 2 deletions src/DynamoCoreWpf/DynamoCoreWpf.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
<Reference Include="FontAwesome.WPF">
<HintPath>..\..\extern\FontAwesome\FontAwesome.WPF.dll</HintPath>
</Reference>
<Reference Include="Greg, Version=1.1.6907.32055, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Greg.1.1.6907.32055\lib\net45\Greg.dll</HintPath>
<Reference Include="Greg, Version=1.1.6913.31484, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Greg.1.1.6913.31484\lib\net47\Greg.dll</HintPath>
</Reference>
<Reference Include="HelixToolkit, Version=2015.1.629.0, Culture=neutral, PublicKeyToken=52aa3500039caf0d, processorArchitecture=MSIL">
<HintPath>..\packages\HelixToolkit.2015.1.629\lib\portable-net4+sl4+wp71+win8\HelixToolkit.dll</HintPath>
Expand Down
27 changes: 0 additions & 27 deletions src/DynamoCoreWpf/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 3 additions & 18 deletions src/DynamoCoreWpf/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@
<value>Hide all text bubble</value>
<comment>Context menu item - Specific to canvas</comment>
</data>
<data name="ContextMenuHideUpstreamPreview" xml:space="preserve">
<value>Hide upstream geometry preview</value>
<comment>Context menu item - Specific to canvas</comment>
</data>
<data name="ContextMenuInsertCodeBlock" xml:space="preserve">
<value>Insert code block</value>
<comment>Context menu item - Specific to canvas</comment>
Expand Down Expand Up @@ -349,10 +345,6 @@
<value>Show all text buble</value>
<comment>Context menu item - Specific to canvas</comment>
</data>
<data name="ContextMenuShowUpstreamPreview" xml:space="preserve">
<value>Show upstream geometry preview</value>
<comment>Context menu item - Specific to canvas</comment>
</data>
<data name="ContextUnGroupFromSelection" xml:space="preserve">
<value>Remove from Group</value>
<comment>Context menu item</comment>
Expand Down Expand Up @@ -881,7 +873,7 @@ It does not contain your graph or any personal data</value>
<comment>Settings menu | Geometry Scaling</comment>
</data>
<data name="DynamoViewSettingsMenuIsolationMode" xml:space="preserve">
<value>Isolate Selected Geometries</value>
<value>Isolate Selected Geometry</value>
</data>
<data name="DynamoViewSettingsMenuShowEdges" xml:space="preserve">
<value>Show Edges</value>
Expand Down Expand Up @@ -1459,10 +1451,6 @@ Uninstall the following dependent packages: {1}?</value>
<value>Preview</value>
<comment>Context menu item - preview geometry</comment>
</data>
<data name="NodeContextMenuPreviewUpstream" xml:space="preserve">
<value>Preview Upstream</value>
<comment>Context menu item - preview geometry of upstream nodes</comment>
</data>
<data name="NodeContextMenuRenameNode" xml:space="preserve">
<value>Rename Node...</value>
<comment>Context menu item - rename this node</comment>
Expand Down Expand Up @@ -1623,10 +1611,10 @@ Next assemblies were loaded several times:
<value>Package Path Added</value>
</data>
<data name="PackagePathAutoAddNotificationShortDescription" xml:space="preserve">
<value>A library (*.dll, *.ds) was recently imported into Dynamo. Its path was automatically added to "Settings > Manage Node and Package Paths..."</value>
<value>A library (*.dll, *.ds) was recently imported into Dynamo. Its path was automatically added to "Settings &gt; Manage Node and Package Paths..."</value>
</data>
<data name="PackagePathAutoAddNotificationDetailedDescription" xml:space="preserve">
<value>The import path "{0}" was added to "Manage Node and Package Paths". If you want to update or remove this path, please open "Settings > Manage Node and Package Paths..."</value>
<value>The import path "{0}" was added to "Manage Node and Package Paths". If you want to update or remove this path, please open "Settings &gt; Manage Node and Package Paths..."</value>
</data>
<data name="PackageSearchStateNoResult" xml:space="preserve">
<value>Search returned no results!</value>
Expand Down Expand Up @@ -1859,9 +1847,6 @@ Want to publish a different package?</value>
<data name="PublishPackageViewPackageVersion" xml:space="preserve">
<value>Version (major minor build)</value>
</data>
<data name="DynamoViewSettingsMenuIsolationMode" xml:space="preserve">
<value>Isolate Selected Geometry</value>
</data>
<data name="PublishPackageViewPackageVersionTooltip" xml:space="preserve">
<value>A version name helps a submitter keep track of updates to the package. A new version of a package will be REJECTED if this is not incremeneted.</value>
</data>
Expand Down
16 changes: 2 additions & 14 deletions src/DynamoCoreWpf/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -740,10 +740,6 @@ It does not contain your graph or any personal data</value>
<value>Preview</value>
<comment>Context menu item - preview geometry</comment>
</data>
<data name="NodeContextMenuPreviewUpstream" xml:space="preserve">
<value>Preview Upstream</value>
<comment>Context menu item - preview geometry of upstream nodes</comment>
</data>
<data name="NodeContextMenuRenameNode" xml:space="preserve">
<value>Rename Node...</value>
<comment>Context menu item - rename this node</comment>
Expand Down Expand Up @@ -1706,10 +1702,6 @@ Do you want to install the latest Dynamo update?</value>
<value>Hide all text bubble</value>
<comment>Context menu item - Specific to canvas</comment>
</data>
<data name="ContextMenuHideUpstreamPreview" xml:space="preserve">
<value>Hide upstream geometry preview</value>
<comment>Context menu item - Specific to canvas</comment>
</data>
<data name="ContextMenuInsertCodeBlock" xml:space="preserve">
<value>Insert code block</value>
<comment>Context menu item - Specific to canvas</comment>
Expand All @@ -1726,10 +1718,6 @@ Do you want to install the latest Dynamo update?</value>
<value>Show all text buble</value>
<comment>Context menu item - Specific to canvas</comment>
</data>
<data name="ContextMenuShowUpstreamPreview" xml:space="preserve">
<value>Show upstream geometry preview</value>
<comment>Context menu item - Specific to canvas</comment>
</data>
<data name="MoreButton" xml:space="preserve">
<value>More</value>
<comment>The "More" button on "Publish a Dynamo Package" dialog</comment>
Expand Down Expand Up @@ -1965,10 +1953,10 @@ Do you want to install the latest Dynamo update?</value>
<value>Package Path Added</value>
</data>
<data name="PackagePathAutoAddNotificationShortDescription" xml:space="preserve">
<value>A library (*.dll, *.ds) was recently imported into Dynamo. Its path was automatically added to "Settings > Manage Node and Package Paths..."</value>
<value>A library (*.dll, *.ds) was recently imported into Dynamo. Its path was automatically added to "Settings &gt; Manage Node and Package Paths..."</value>
</data>
<data name="PackagePathAutoAddNotificationDetailedDescription" xml:space="preserve">
<value>The import path "{0}" was added to "Manage Node and Package Paths". If you want to update or remove this path, please open "Settings > Manage Node and Package Paths..."</value>
<value>The import path "{0}" was added to "Manage Node and Package Paths". If you want to update or remove this path, please open "Settings &gt; Manage Node and Package Paths..."</value>
</data>
<data name="NodeContextMenuIsInput" xml:space="preserve">
<value>Is Input</value>
Expand Down
1 change: 0 additions & 1 deletion src/DynamoCoreWpf/ViewModels/Core/WorkspaceViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,6 @@ private void RefreshViewOnSelectionChange(object sender, NotifyCollectionChanged
RaisePropertyChanged("HasSelection");
RaisePropertyChanged("IsGeometryOperationEnabled");
RaisePropertyChanged("AnyNodeVisible");
RaisePropertyChanged("AnyNodeUpstreamVisible");
RaisePropertyChanged("SelectionArgumentLacing");
}
}
Expand Down
12 changes: 0 additions & 12 deletions src/DynamoCoreWpf/Views/Core/WorkspaceView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -397,18 +397,6 @@
CommandParameter="false"
Visibility="{Binding Path=AnyNodeVisible, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />

<MenuItem IsEnabled="{Binding Path=IsGeometryOperationEnabled}"
Header="{x:Static p:Resources.ContextMenuShowUpstreamPreview}"
Command="{Binding Path=ShowHideAllUpstreamPreviewCommand}"
CommandParameter="true"
Visibility="{Binding Path=AnyNodeUpstreamVisible, Converter={StaticResource InverseBoolToVisibilityCollapsedConverter}}" />

<MenuItem IsEnabled="{Binding Path=IsGeometryOperationEnabled}"
Header="{x:Static p:Resources.ContextMenuHideUpstreamPreview}"
Command="{Binding Path=ShowHideAllUpstreamPreviewCommand}"
CommandParameter="false"
Visibility="{Binding Path=AnyNodeUpstreamVisible, Converter={StaticResource BooleanToVisibilityCollapsedConverter}}" />

<controls:ParentMenuItem Header="{x:Static p:Resources.DynamoViewEditMenuAlignSelection}" x:Name="Align">
<MenuItem Header="{x:Static p:Resources.DynamoViewEditMenuAlignXAverage}"
Command="{Binding AlignSelectedCommand}"
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoCoreWpf/packages.config
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cyotek.Drawing.BitmapFont" version="1.0.2.0" targetFramework="net45" />
<package id="Greg" version="1.1.6907.32055" targetFramework="net47" />
<package id="Greg" version="1.1.6913.31484" targetFramework="net47" />
<package id="HelixToolkit" version="2015.1.629" targetFramework="net45" />
<package id="HelixToolkit.Wpf" version="2015.1.629" targetFramework="net45" />
<package id="HelixToolkit.Wpf.SharpDX" version="2015.1.629" targetFramework="net45" />
Expand Down
4 changes: 2 additions & 2 deletions src/DynamoPackages/DynamoPackages.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Greg, Version=1.1.6907.32055, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Greg.1.1.6907.32055\lib\net45\Greg.dll</HintPath>
<Reference Include="Greg, Version=1.1.6913.31484, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Greg.1.1.6913.31484\lib\net47\Greg.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion src/DynamoPackages/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Greg" version="1.1.6907.32055" targetFramework="net47" />
<package id="Greg" version="1.1.6913.31484" targetFramework="net47" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="RestSharp" version="105.2.3" targetFramework="net47" />
</packages>
1 change: 1 addition & 0 deletions src/Libraries/CoreNodes/CoreNodes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
<Compile Include="Compare.cs" />
<Compile Include="DateTime.cs" />
<Compile Include="FileSystem.cs" />
<Compile Include="Data.cs" />
<Compile Include="List.cs" />
<Compile Include="Math.cs" />
<Compile Include="Object.cs" />
Expand Down
107 changes: 107 additions & 0 deletions src/Libraries/CoreNodes/Data.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Autodesk.DesignScript.Runtime;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace DSCore
{
public static class Data
{
/// <summary>
/// Parse converts an arbitrary JSON string to a value. It is the opposite of JSON.Stringify.
/// </summary>
/// <param name="json">A JSON string</param>
/// <returns name="result">The result type depends on the content of the input string. The result type can be a primitive value (e.g. string, boolean, double), a List, or a Dictionary.</returns>
public static object ParseJSON(string json)
{
return ToNative(JToken.Parse(json));
}

private static object ToNative(JToken token)
{
switch (token.Type)
{
case JTokenType.Object:
var obj = token as JObject;
var dict = new Dictionary<string, object>();
foreach (var kv in obj)
{
dict[kv.Key] = ToNative(kv.Value);
}
return dict;
case JTokenType.Array:
var arr = token as JArray;
return arr.Select(ToNative);
case JTokenType.Null:
return null;
case JTokenType.Integer:
case JTokenType.Float:
case JTokenType.String:
case JTokenType.Boolean:
case JTokenType.Date:
case JTokenType.TimeSpan:
return (token as JValue).Value;
case JTokenType.Guid:
case JTokenType.Uri:
return (token as JValue).Value.ToString();
default:
return null;
}
}

/// <summary>
/// Stringify converts an arbitrary value or a list of arbitrary values to JSON. Replication can be used to apply the operation over a list, producing a list of JSON strings.
/// </summary>
/// <param name="values">A List of values</param>
/// <returns name="json">A JSON string where primitive types (e.g. double, int, boolean), Lists, and Dictionary's will be turned into the associated JSON type.</returns>
public static string StringifyJSON([ArbitraryDimensionArrayImport] object values)
{
return JsonConvert.SerializeObject(values, new DictConverter());
}

/// <summary>
/// Ensures DesignScript.Builtin.Dictionary's, which deliberately don't implement IDictionary, are transformed into JSON objects.
/// </summary>
private class DictConverter : JsonConverter
{
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
object obj;
if (value is DesignScript.Builtin.Dictionary)
{
var dict = value as DesignScript.Builtin.Dictionary;
var rdict = new Dictionary<string, object>();
foreach (var key in dict.Keys)
{
rdict[key] = dict.ValueAtKey(key);
}
obj = rdict;
}
else
{
obj = value;
}

serializer.Serialize(writer, obj);
}

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
throw new NotImplementedException("Unnecessary because CanRead is false. The type will skip the converter.");
}

public override bool CanRead
{
get { return false; }
}

public override bool CanConvert(Type objectType)
{
return objectType == typeof(DesignScript.Builtin.Dictionary);
}
}

}
}
4 changes: 2 additions & 2 deletions src/LibraryViewExtension/LibraryViewExtension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Greg, Version=1.1.6907.32055, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Greg.1.1.6907.32055\lib\net45\Greg.dll</HintPath>
<Reference Include="Greg, Version=1.1.6913.31484, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Greg.1.1.6913.31484\lib\net47\Greg.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Prism, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
Expand Down
2 changes: 1 addition & 1 deletion src/LibraryViewExtension/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<package id="cef.redist.x86" version="3.3325.1758" targetFramework="net452" />
<package id="CefSharp.Common" version="65.0.1" targetFramework="net452" />
<package id="CefSharp.Wpf" version="65.0.1" targetFramework="net452" />
<package id="Greg" version="1.1.6907.32055" targetFramework="net47" />
<package id="Greg" version="1.1.6913.31484" targetFramework="net47" />
<package id="Newtonsoft.Json" version="8.0.3" targetFramework="net45" />
<package id="RestSharp" version="105.2.3" targetFramework="net47" />
</packages>
Loading

0 comments on commit 085fb51

Please sign in to comment.