├── NetPrintsVSIX ├── NetPrintsLogo.ico ├── NetPrintsLogo.png ├── ItemTemplates │ └── NetPrints Class.zip ├── FodyWeavers.xml ├── NetPrintsVSIXUtil.cs ├── LICENSE.txt ├── Properties │ └── AssemblyInfo.cs ├── source.extension.vsixmanifest └── FodyWeavers.xsd ├── NetPrintsEditor ├── NetPrintsLogo.ico ├── Resources │ ├── If_16x.png │ ├── Create_16x.png │ ├── Loop_16x.png │ ├── Method_16x.png │ ├── None_16x.png │ ├── Return_16x.png │ ├── Task_16x.png │ ├── Throw_16x.png │ ├── Type_16x.png │ ├── Convert_16x.png │ ├── Delegate_16x.png │ ├── ListView_16x.png │ ├── Literal_16x.png │ ├── Operator_16x.png │ ├── Property_16x.png │ └── ConditionalRule_16x.png ├── FodyWeavers.xml ├── Controls │ ├── ClassPropertyEditorControl.xaml.cs │ ├── VariableEditorControl.xaml.cs │ ├── MethodPropertyEditorControl.xaml.cs │ ├── SuggestionListItem.xaml.cs │ ├── SuggestionListItem.xaml │ ├── VariableGetSetControl.xaml │ ├── VariableGetSetControl.xaml.cs │ ├── MemberVariableView.xaml.cs │ ├── SearchableComboBox.xaml.cs │ └── NodeControl.xaml.cs ├── ViewModels │ ├── ReferenceListViewModel.cs │ ├── CompilationReferenceVM.cs │ ├── MainEditorVM.cs │ └── ObservableViewModelCollection.cs ├── Dialogs │ ├── MakeDelegateTypeInfo.cs │ ├── SelectTypeDialog.xaml.cs │ ├── SelectMethodDialog.xaml.cs │ ├── SelectMethodDialog.xaml │ └── SelectTypeDialog.xaml ├── Messages │ ├── OpenGraphMessage.cs │ ├── AddNodeMessage.cs │ └── NodeSelectionMessage.cs ├── Commands │ ├── EditorCommands.cs │ └── UndoRedoStack.cs ├── Converters │ ├── VariableModifierConverter.cs │ ├── MethodModifierConverter.cs │ ├── ClassModifierConverter.cs │ ├── ModelToViewModelConverter.cs │ ├── MethodSpecifierConverter.cs │ └── BooleanConverter.cs ├── Reflection │ └── Memoization.cs ├── App.xaml.cs ├── FodyWeavers.xsd ├── ReferenceListWindow.xaml.cs ├── Adorners │ └── DragAdorner.cs ├── NetPrintsEditor.csproj └── ReferenceListWindow.xaml ├── NetPrints ├── Core │ ├── ICompilationReference.cs │ ├── CompilationReference.cs │ ├── AssemblyReference.cs │ ├── ConstructorGraph.cs │ ├── Named.cs │ ├── TypeGraph.cs │ ├── NodeGraph.cs │ ├── FrameworkAssemblyReference.cs │ ├── SourceDirectoryReference.cs │ ├── ExecutionGraph.cs │ ├── ConstructorSpecifier.cs │ ├── BaseType.cs │ ├── NetPrintsUtil.cs │ ├── VariableSpecifier.cs │ ├── GenericType.cs │ ├── OperatorUtil.cs │ └── ObservableRangeCollection.cs ├── FodyWeavers.xml ├── Graph │ ├── NodeExecPin.cs │ ├── TypeReturnNode.cs │ ├── NodeTypePin.cs │ ├── ExecutionEntryNode.cs │ ├── VariableGetterNode.cs │ ├── NodeInputExecPin.cs │ ├── NodeOutputDataPin.cs │ ├── NodeDataPin.cs │ ├── ThrowNode.cs │ ├── ConstructorEntryNode.cs │ ├── VariableSetterNode.cs │ ├── TypeOfNode.cs │ ├── NodeOutputTypePin.cs │ ├── ExecNode.cs │ ├── ClassReturnNode.cs │ ├── NodePin.cs │ ├── MakeArrayTypeNode.cs │ ├── NodeOutputExecPin.cs │ ├── NodeInputTypePin.cs │ ├── DefaultNode.cs │ ├── IfElseNode.cs │ ├── MethodEntryNode.cs │ ├── GenericsHelper.cs │ ├── MakeDelegateNode.cs │ ├── TernaryNode.cs │ ├── RerouteNode.cs │ ├── AwaitNode.cs │ ├── ForLoopNode.cs │ ├── TypeNode.cs │ ├── NodeInputDataPin.cs │ ├── VariableNode.cs │ ├── LiteralNode.cs │ ├── ConstructorNode.cs │ └── ExplicitCastNode.cs ├── NetPrints.csproj ├── Serialization │ └── SerializationHelper.cs ├── Compilation │ ├── ICodeCompiler.cs │ └── CodeCompiler.cs └── FodyWeavers.xsd ├── NetPrintsEditorUnitTests ├── PinTests.cs └── NetPrintsEditorUnitTests.csproj ├── .travis.yml ├── CSharpRuleSet.ruleset ├── NetPrintsCLI ├── NetPrintsCLI.csproj └── Program.cs ├── NetPrintsUnitTests ├── NetPrintsUnitTests.csproj ├── TypeTests.cs ├── DelegateTranslatorTests.cs └── GenericsTests.cs ├── LICENSE ├── README.md └── NetPrints.sln /NetPrintsVSIX/NetPrintsLogo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsVSIX/NetPrintsLogo.ico -------------------------------------------------------------------------------- /NetPrintsVSIX/NetPrintsLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsVSIX/NetPrintsLogo.png -------------------------------------------------------------------------------- /NetPrintsEditor/NetPrintsLogo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/NetPrintsLogo.ico -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/If_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/If_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Create_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Create_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Loop_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Loop_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Method_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Method_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/None_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/None_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Return_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Return_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Task_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Task_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Throw_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Throw_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Type_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Type_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Convert_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Convert_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Delegate_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Delegate_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/ListView_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/ListView_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Literal_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Literal_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Operator_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Operator_16x.png -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/Property_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/Property_16x.png -------------------------------------------------------------------------------- /NetPrintsVSIX/ItemTemplates/NetPrints Class.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsVSIX/ItemTemplates/NetPrints Class.zip -------------------------------------------------------------------------------- /NetPrints/Core/ICompilationReference.cs: -------------------------------------------------------------------------------- 1 | namespace NetPrints.Core 2 | { 3 | public interface ICompilationReference 4 | { 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /NetPrintsEditor/Resources/ConditionalRule_16x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RobinKa/netprints/HEAD/NetPrintsEditor/Resources/ConditionalRule_16x.png -------------------------------------------------------------------------------- /NetPrintsVSIX/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /NetPrints/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /NetPrintsEditor/FodyWeavers.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /NetPrintsEditorUnitTests/PinTests.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.TestTools.UnitTesting; 2 | 3 | namespace NetPrintsEditorUnitTests 4 | { 5 | [TestClass] 6 | public class PinTests 7 | { 8 | 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | os: windows 2 | env: 3 | global: 4 | - DOTNET_CLI_TELEMETRY_OPTOUT: 1 5 | language: csharp 6 | mono: none 7 | script: 8 | - choco install dotnetcore-sdk --pre 9 | - dotnet --version 10 | # - dotnet build NetPrints.sln -c Release 11 | - dotnet test -------------------------------------------------------------------------------- /CSharpRuleSet.ruleset: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /NetPrints/Core/CompilationReference.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace NetPrints.Core 4 | { 5 | [DataContract] 6 | [KnownType(typeof(AssemblyReference))] 7 | [KnownType(typeof(FrameworkAssemblyReference))] 8 | [KnownType(typeof(SourceDirectoryReference))] 9 | public abstract class CompilationReference : ICompilationReference 10 | { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /NetPrints/Graph/NodeExecPin.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace NetPrints.Graph 4 | { 5 | /// 6 | /// Abstract class for execution pins. 7 | /// 8 | [DataContract] 9 | public abstract class NodeExecPin : NodePin 10 | { 11 | protected NodeExecPin(Node node, string name) 12 | : base(node, name) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /NetPrintsEditor/Controls/ClassPropertyEditorControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace NetPrintsEditor.Controls 4 | { 5 | /// 6 | /// Interaction logic for VariableEditorControl.xaml 7 | /// 8 | public partial class ClassPropertyEditorControl : UserControl 9 | { 10 | public ClassPropertyEditorControl() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /NetPrints/Graph/TypeReturnNode.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | [DataContract] 7 | public class TypeReturnNode : Node 8 | { 9 | public NodeInputTypePin TypePin => InputTypePins[0]; 10 | 11 | public TypeReturnNode(TypeGraph graph) 12 | : base(graph) 13 | { 14 | AddInputTypePin("Type"); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /NetPrintsCLI/NetPrintsCLI.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Exe 5 | netcoreapp2.0;net461 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /NetPrintsEditor/ViewModels/ReferenceListViewModel.cs: -------------------------------------------------------------------------------- 1 | using GalaSoft.MvvmLight; 2 | using NetPrints.Core; 3 | 4 | namespace NetPrintsEditor.ViewModels 5 | { 6 | public class ReferenceListViewModel : ViewModelBase 7 | { 8 | public Project Project 9 | { 10 | get; set; 11 | } 12 | 13 | public ReferenceListViewModel(Project project) 14 | { 15 | Project = project; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /NetPrintsEditor/Controls/VariableEditorControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using NetPrintsEditor.ViewModels; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace NetPrintsEditor.Controls 6 | { 7 | /// 8 | /// Interaction logic for VariableEditorControl.xaml 9 | /// 10 | public partial class VariableEditorControl : UserControl 11 | { 12 | public VariableEditorControl() 13 | { 14 | InitializeComponent(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /NetPrintsEditor/Dialogs/MakeDelegateTypeInfo.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | 3 | namespace NetPrintsEditor.Dialogs 4 | { 5 | public class MakeDelegateTypeInfo 6 | { 7 | public TypeSpecifier Type 8 | { 9 | get; 10 | } 11 | 12 | public TypeSpecifier FromType 13 | { 14 | get; 15 | } 16 | 17 | public MakeDelegateTypeInfo(TypeSpecifier type, TypeSpecifier fromType) 18 | { 19 | Type = type; 20 | FromType = fromType; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /NetPrints/Graph/NodeTypePin.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | /// 7 | /// Abstract class for type pins. 8 | /// 9 | [DataContract] 10 | public abstract class NodeTypePin : NodePin 11 | { 12 | public abstract ObservableValue InferredType 13 | { 14 | get; 15 | } 16 | 17 | protected NodeTypePin(Node node, string name) 18 | : base(node, name) 19 | { 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /NetPrintsEditor/Messages/OpenGraphMessage.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace NetPrintsEditor.Messages 7 | { 8 | /// 9 | /// Message for opening a graph. 10 | /// 11 | public class OpenGraphMessage 12 | { 13 | /// 14 | /// Graph to open. 15 | /// 16 | public NodeGraph Graph { get; } 17 | 18 | public OpenGraphMessage(NodeGraph graph) 19 | { 20 | Graph = graph; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /NetPrintsEditor/Controls/MethodPropertyEditorControl.xaml.cs: -------------------------------------------------------------------------------- 1 | using NetPrintsEditor.ViewModels; 2 | using System.Windows; 3 | using System.Windows.Controls; 4 | 5 | namespace NetPrintsEditor.Controls 6 | { 7 | /// 8 | /// Interaction logic for MethodPropertyEditorControl.xaml 9 | /// 10 | public partial class MethodPropertyEditorControl : UserControl 11 | { 12 | public NodeGraphVM Graph 13 | { 14 | get => DataContext as NodeGraphVM; 15 | } 16 | 17 | public MethodPropertyEditorControl() 18 | { 19 | InitializeComponent(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /NetPrints/Core/AssemblyReference.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Core 5 | { 6 | [DataContract] 7 | public class AssemblyReference : CompilationReference 8 | { 9 | [DataMember] 10 | public string AssemblyPath 11 | { 12 | get; 13 | set; 14 | } 15 | 16 | public AssemblyReference(string assemblyPath) 17 | { 18 | AssemblyPath = assemblyPath; 19 | } 20 | 21 | public override string ToString() => $"{Path.GetFileNameWithoutExtension(AssemblyPath)} at {AssemblyPath}"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /NetPrints/Graph/ExecutionEntryNode.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | [DataContract] 7 | public abstract class ExecutionEntryNode : Node 8 | { 9 | /// 10 | /// Output execution pin that initially executes when a method gets called. 11 | /// 12 | public NodeOutputExecPin InitialExecutionPin 13 | { 14 | get { return OutputExecPins[0]; } 15 | } 16 | 17 | public ExecutionEntryNode(ExecutionGraph graph) 18 | : base(graph) 19 | { 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /NetPrints/Graph/VariableGetterNode.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | /// 7 | /// Node that gets the value of a variable. 8 | /// 9 | [DataContract] 10 | public class VariableGetterNode : VariableNode 11 | { 12 | public VariableGetterNode(NodeGraph graph, VariableSpecifier variable) 13 | : base(graph, variable) 14 | { 15 | } 16 | 17 | public override string ToString() 18 | { 19 | string staticText = IsStatic ? $"{TargetType.ShortName}." : ""; 20 | return $"Get {staticText}{VariableName}"; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /NetPrintsUnitTests/NetPrintsUnitTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netcoreapp2.0 4 | 5 | false 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /NetPrintsEditor/Commands/EditorCommands.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Input; 2 | 3 | namespace NetPrintsEditor.Commands 4 | { 5 | public static class EditorCommands 6 | { 7 | /// 8 | /// Command for opening the variables get / set dialog. 9 | /// 10 | public static readonly ICommand OpenVariableGetSet = new RoutedUICommand(nameof(OpenVariableGetSet), nameof(OpenVariableGetSet), typeof(EditorCommands)); 11 | 12 | /// 13 | /// Command for selecting a variable of a method. 14 | /// 15 | public static readonly ICommand SelectVariable = new RoutedUICommand(nameof(SelectVariable), nameof(SelectVariable), typeof(EditorCommands)); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /NetPrintsEditorUnitTests/NetPrintsEditorUnitTests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net461 4 | 5 | false 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /NetPrintsEditor/Controls/SuggestionListItem.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Controls; 2 | 3 | namespace NetPrintsEditor.Controls 4 | { 5 | public class SuggestionListItemBinding 6 | { 7 | public string Text { get; } 8 | public string IconPath { get; } 9 | 10 | public SuggestionListItemBinding(string text, string iconPath) 11 | { 12 | Text = text; 13 | IconPath = iconPath; 14 | } 15 | } 16 | 17 | /// 18 | /// Interaction logic for SuggestionListItem.xaml 19 | /// 20 | public partial class SuggestionListItem : UserControl 21 | { 22 | public SuggestionListItem() 23 | { 24 | InitializeComponent(); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /NetPrints/Graph/NodeInputExecPin.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | /// 7 | /// Pin that can be connected to output execution pins to receive execution. 8 | /// 9 | [DataContract] 10 | public class NodeInputExecPin : NodeExecPin 11 | { 12 | /// 13 | /// Output execution pins connected to this pin. 14 | /// 15 | [DataMember] 16 | public ObservableRangeCollection IncomingPins { get; private set; } = 17 | new ObservableRangeCollection(); 18 | 19 | public NodeInputExecPin(Node node, string name) 20 | : base(node, name) 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /NetPrints/Graph/NodeOutputDataPin.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | /// 7 | /// Pin which outputs a value. Can be connected to input data pins. 8 | /// 9 | [DataContract] 10 | public class NodeOutputDataPin : NodeDataPin 11 | { 12 | /// 13 | /// Connected input data pins. 14 | /// 15 | [DataMember] 16 | public ObservableRangeCollection OutgoingPins { get; private set; } 17 | = new ObservableRangeCollection(); 18 | 19 | public NodeOutputDataPin(Node node, string name, ObservableValue pinType) 20 | : base(node, name, pinType) 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /NetPrints/Core/ConstructorGraph.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Graph; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Runtime.Serialization; 6 | 7 | namespace NetPrints.Core 8 | { 9 | /// 10 | /// Method type. Contains common things usually associated with methods such as its arguments and its name. 11 | /// 12 | [DataContract] 13 | public class ConstructorGraph : ExecutionGraph 14 | { 15 | /// 16 | /// Creates a method given its name. 17 | /// 18 | public ConstructorGraph() 19 | { 20 | EntryNode = new ConstructorEntryNode(this); 21 | } 22 | 23 | public override string ToString() 24 | { 25 | return Class.Name; 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /NetPrints/Graph/NodeDataPin.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | /// 7 | /// Abstract class for data pins. 8 | /// 9 | [DataContract] 10 | public abstract class NodeDataPin : NodePin 11 | { 12 | /// 13 | /// Specifier for the type of this data pin. 14 | /// 15 | [DataMember] 16 | public ObservableValue PinType { get; private set; } 17 | 18 | protected NodeDataPin(Node node, string name, ObservableValue pinType) 19 | : base(node, name) 20 | { 21 | PinType = pinType; 22 | } 23 | 24 | public override string ToString() 25 | { 26 | return $"{Name}: {PinType.Value.ShortName}"; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /NetPrints/Graph/ThrowNode.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System; 3 | using System.Runtime.Serialization; 4 | 5 | namespace NetPrints.Graph 6 | { 7 | /// 8 | /// Node representing an exception throw. 9 | /// 10 | [DataContract] 11 | public class ThrowNode : Node 12 | { 13 | /// 14 | /// Pin for the exception to throw. 15 | /// 16 | public NodeInputDataPin ExceptionPin 17 | { 18 | get { return InputDataPins[0]; } 19 | } 20 | 21 | public ThrowNode(NodeGraph graph) 22 | : base(graph) 23 | { 24 | AddInputExecPin("Exec"); 25 | AddInputDataPin("Exception", TypeSpecifier.FromType()); 26 | } 27 | 28 | public override string ToString() 29 | { 30 | return $"Throw Exception"; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /NetPrints/Core/Named.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.Serialization; 2 | 3 | namespace NetPrints.Core 4 | { 5 | /// 6 | /// Contains a value and its name. Can be implicitly 7 | /// converted to the class itself. 8 | /// 9 | /// Type of the value. 10 | [DataContract] 11 | [KnownType(typeof(MethodParameter))] 12 | public class Named 13 | { 14 | [DataMember] 15 | public string Name { get; set; } 16 | 17 | [DataMember] 18 | public T Value { get; set; } 19 | 20 | public Named(string name, T type) 21 | { 22 | Name = name; 23 | Value = type; 24 | } 25 | 26 | public static implicit operator T (Named namedValue) => namedValue.Value; 27 | 28 | public override string ToString() 29 | { 30 | return $"{Name}: {Value}"; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /NetPrintsVSIX/NetPrintsVSIXUtil.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using NetPrints.Serialization; 3 | using NetPrints.Translator; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace NetPrints.VSIX 12 | { 13 | public static class CompilationUtil 14 | { 15 | public static void CompileNetPrintsClass(string path, string outputPath) 16 | { 17 | CompileNetPrintsClass(SerializationHelper.LoadClass(path), outputPath); 18 | } 19 | 20 | public static void CompileNetPrintsClass(ClassGraph classGraph, string outputPath) 21 | { 22 | ClassTranslator classTranslator = new ClassTranslator(); 23 | 24 | string translated = classTranslator.TranslateClass(classGraph); 25 | 26 | File.WriteAllText(outputPath, translated); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /NetPrints/Graph/ConstructorEntryNode.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System; 3 | using System.Runtime.Serialization; 4 | using System.Linq; 5 | 6 | namespace NetPrints.Graph 7 | { 8 | /// 9 | /// Node representing the initial execution node of a constructor. 10 | /// 11 | [DataContract] 12 | public class ConstructorEntryNode : ExecutionEntryNode 13 | { 14 | public ConstructorGraph ConstructorGraph 15 | { 16 | get => (ConstructorGraph)Graph; 17 | } 18 | 19 | public ConstructorEntryNode(ConstructorGraph constructor) 20 | : base(constructor) 21 | { 22 | AddOutputExecPin("Exec"); 23 | 24 | // TODO: Add output data and type pins for constructor graph 25 | } 26 | 27 | public override string ToString() 28 | { 29 | return $"{ConstructorGraph.Class.Name} Constructor Entry"; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /NetPrints/NetPrints.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | netstandard2.0 4 | NetPrints 5 | 0.0.7 6 | MIT 7 | Robin Kahlow 2018 8 | ../CSharpRuleSet.ruleset 9 | preview 10 | 11 | 12 | 13 | all 14 | runtime; build; native; contentfiles; analyzers; buildtransitive 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /NetPrints/Core/TypeGraph.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Graph; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Runtime.Serialization; 6 | 7 | namespace NetPrints.Core 8 | { 9 | /// 10 | /// Type graph that returns a type. 11 | /// 12 | [DataContract] 13 | public class TypeGraph : NodeGraph 14 | { 15 | /// 16 | /// Return node of this type graph that receives the type. 17 | /// 18 | public TypeReturnNode ReturnNode 19 | { 20 | get => Nodes.OfType().Single(); 21 | } 22 | 23 | /// 24 | /// TypeSpecifier for the type this graph returns. 25 | /// 26 | public TypeSpecifier ReturnType 27 | { 28 | get => (TypeSpecifier)ReturnNode.TypePin.InferredType?.Value ?? TypeSpecifier.FromType(); 29 | } 30 | 31 | public TypeGraph() 32 | { 33 | _ = new TypeReturnNode(this); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /NetPrintsEditor/Dialogs/SelectTypeDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using MahApps.Metro.Controls; 2 | using NetPrints.Core; 3 | using System.Windows; 4 | 5 | namespace NetPrintsEditor.Dialogs 6 | { 7 | /// 8 | /// Interaction logic for SelectTypeDialog.xaml 9 | /// 10 | public partial class SelectTypeDialog : MetroWindow 11 | { 12 | public static readonly DependencyProperty SelectedTypeProperty = DependencyProperty.Register( 13 | nameof(SelectedType), typeof(TypeSpecifier), typeof(SelectTypeDialog)); 14 | 15 | public TypeSpecifier SelectedType 16 | { 17 | get => (TypeSpecifier)GetValue(SelectedTypeProperty); 18 | set => SetValue(SelectedTypeProperty, value); 19 | } 20 | 21 | public SelectTypeDialog() 22 | { 23 | InitializeComponent(); 24 | 25 | SelectedType = TypeSpecifier.FromType(); 26 | } 27 | 28 | private void OnSelectButtonClicked(object sender, RoutedEventArgs e) 29 | { 30 | DialogResult = true; 31 | Close(); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Robin Kahlow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NetPrintsEditor/Converters/VariableModifierConverter.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace NetPrintsEditor.Converters 7 | { 8 | [ValueConversion(typeof(VariableModifiers), typeof(string))] 9 | public class VariableModifierConverter : IValueConverter 10 | { 11 | private VariableModifiers modifiers; 12 | 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (value is VariableModifiers m && parameter is VariableModifiers mask) 16 | { 17 | modifiers = m; 18 | return (mask & m) != 0; 19 | } 20 | 21 | return null; 22 | } 23 | 24 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 25 | { 26 | if (parameter is VariableModifiers mask) 27 | { 28 | modifiers ^= mask; 29 | return modifiers; 30 | } 31 | 32 | return null; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /NetPrintsEditor/Converters/MethodModifierConverter.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace NetPrintsEditor.Converters 7 | { 8 | [ValueConversion(typeof(MethodModifiers), typeof(string))] 9 | public class MethodModifierConverter : IValueConverter 10 | { 11 | private MethodModifiers modifiers; 12 | 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (value is MethodModifiers m && parameter is MethodModifiers mask) 16 | { 17 | modifiers = m; 18 | return (mask & m) != 0; 19 | } 20 | 21 | return MethodModifiers.None; 22 | } 23 | 24 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 25 | { 26 | if (parameter is MethodModifiers mask) 27 | { 28 | modifiers ^= mask; 29 | return modifiers; 30 | } 31 | 32 | return MethodModifiers.None; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /NetPrintsEditor/Controls/SuggestionListItem.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /NetPrintsVSIX/LICENSE.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Robin Kahlow 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /NetPrintsEditor/Converters/ClassModifierConverter.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System; 3 | using System.Globalization; 4 | using System.Windows.Data; 5 | 6 | namespace NetPrintsEditor.Converters 7 | { 8 | [ValueConversion(typeof(ClassModifiers), typeof(string))] 9 | public class ClassModifierConverter : IValueConverter 10 | { 11 | private ClassModifiers modifiers; 12 | 13 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 14 | { 15 | if (value is ClassModifiers m && parameter is ClassModifiers mask) 16 | { 17 | modifiers = m; 18 | return (mask & m) != 0; 19 | } 20 | 21 | throw new NotImplementedException(); 22 | } 23 | 24 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 25 | { 26 | if (parameter is ClassModifiers mask) 27 | { 28 | modifiers ^= mask; 29 | return modifiers; 30 | } 31 | 32 | throw new NotImplementedException(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /NetPrints/Graph/VariableSetterNode.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | /// 7 | /// Node that sets the value of a variable. 8 | /// 9 | [DataContract] 10 | public class VariableSetterNode : VariableNode 11 | { 12 | /// 13 | /// Input data pin for the new value of the variable. 14 | /// 15 | public NodeInputDataPin NewValuePin 16 | { 17 | get { return IsStatic ? InputDataPins[0] : InputDataPins[1]; } 18 | } 19 | 20 | public VariableSetterNode(NodeGraph graph, VariableSpecifier variable) 21 | : base(graph, variable) 22 | { 23 | AddInputExecPin("Exec"); 24 | AddOutputExecPin("Exec"); 25 | 26 | AddInputDataPin("NewValue", variable.Type); 27 | } 28 | 29 | public override string ToString() 30 | { 31 | string staticText = IsStatic ? $"{TargetType.ShortName}." : ""; 32 | return $"Set {staticText}{VariableName}"; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /NetPrints/Graph/TypeOfNode.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System; 3 | using System.Runtime.Serialization; 4 | 5 | namespace NetPrints.Graph 6 | { 7 | /// 8 | /// Node representing a literal value. 9 | /// 10 | [DataContract] 11 | public class TypeOfNode : Node 12 | { 13 | /// 14 | /// Output data pin for the Type value. 15 | /// 16 | public NodeOutputDataPin TypePin 17 | { 18 | get { return OutputDataPins[0]; } 19 | } 20 | 21 | /// 22 | /// Input type pin for the Type value. 23 | /// 24 | public NodeInputTypePin InputTypePin 25 | { 26 | get { return InputTypePins[0]; } 27 | } 28 | 29 | public TypeOfNode(NodeGraph graph) 30 | : base(graph) 31 | { 32 | AddInputTypePin("Type"); 33 | AddOutputDataPin("Type", TypeSpecifier.FromType()); 34 | } 35 | 36 | public override string ToString() 37 | { 38 | return $"Type Of"; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /NetPrints/Core/NodeGraph.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Graph; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Core 5 | { 6 | [DataContract] 7 | [KnownType(typeof(MethodGraph))] 8 | [KnownType(typeof(ConstructorGraph))] 9 | [KnownType(typeof(ClassGraph))] 10 | [KnownType(typeof(TypeGraph))] 11 | public abstract class NodeGraph 12 | { 13 | /// 14 | /// Collection of nodes in this graph. 15 | /// 16 | [DataMember] 17 | public ObservableRangeCollection Nodes 18 | { 19 | get; 20 | private set; 21 | } = new ObservableRangeCollection(); 22 | 23 | /// 24 | /// Class this graph is contained in. 25 | /// 26 | [DataMember] 27 | public ClassGraph Class 28 | { 29 | get; 30 | set; 31 | } 32 | 33 | /// 34 | /// Project the graph is part of. 35 | /// 36 | public Project Project 37 | { 38 | get; 39 | set; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /NetPrintsEditor/ViewModels/CompilationReferenceVM.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using GalaSoft.MvvmLight; 3 | using NetPrints.Core; 4 | 5 | namespace NetPrintsEditor.ViewModels 6 | { 7 | public class CompilationReferenceVM : ViewModelBase 8 | { 9 | public bool ShowIncludeInCompilationCheckBox => 10 | Reference is SourceDirectoryReference; 11 | 12 | public bool IncludeInCompilation 13 | { 14 | get => Reference is SourceDirectoryReference sourceReference && sourceReference.IncludeInCompilation; 15 | set 16 | { 17 | if (Reference is SourceDirectoryReference sourceDirectoryReference) 18 | { 19 | sourceDirectoryReference.IncludeInCompilation = value; 20 | } 21 | else 22 | { 23 | throw new InvalidOperationException(); 24 | } 25 | } 26 | } 27 | 28 | public CompilationReference Reference { get; } 29 | 30 | public CompilationReferenceVM(CompilationReference compilationReference) 31 | { 32 | Reference = compilationReference; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /NetPrints/Graph/NodeOutputTypePin.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | /// 7 | /// Pin which outputs a type. Can be connected to input type pins. 8 | /// 9 | [DataContract] 10 | public class NodeOutputTypePin : NodeTypePin 11 | { 12 | /// 13 | /// Connected input data pins. 14 | /// 15 | [DataMember] 16 | public ObservableRangeCollection OutgoingPins { get; private set; } 17 | = new ObservableRangeCollection(); 18 | 19 | public override ObservableValue InferredType 20 | { 21 | get => outputType; 22 | } 23 | 24 | [DataMember] 25 | private ObservableValue outputType; 26 | 27 | public NodeOutputTypePin(Node node, string name, ObservableValue outputType) 28 | : base(node, name) 29 | { 30 | this.outputType = outputType; 31 | } 32 | 33 | public override string ToString() 34 | { 35 | return outputType.Value?.ShortName ?? "None"; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /NetPrints/Graph/ExecNode.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | /// 7 | /// Abstract class for nodes that can be executed. 8 | /// 9 | [DataContract] 10 | [KnownType(typeof(CallMethodNode))] 11 | [KnownType(typeof(ConstructorNode))] 12 | public abstract class ExecNode : Node 13 | { 14 | protected ExecNode(NodeGraph graph) 15 | : base(graph) 16 | { 17 | AddExecPins(); 18 | } 19 | 20 | private void AddExecPins() 21 | { 22 | AddInputExecPin("Exec"); 23 | AddOutputExecPin("Exec"); 24 | } 25 | 26 | protected override void SetPurity(bool pure) 27 | { 28 | base.SetPurity(pure); 29 | 30 | if (pure) 31 | { 32 | GraphUtil.DisconnectInputExecPin(InputExecPins[0]); 33 | InputExecPins.RemoveAt(0); 34 | 35 | GraphUtil.DisconnectOutputExecPin(OutputExecPins[0]); 36 | OutputExecPins.RemoveAt(0); 37 | } 38 | else if (!pure) 39 | { 40 | AddExecPins(); 41 | } 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /NetPrints/Graph/ClassReturnNode.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Runtime.Serialization; 6 | using System.Text; 7 | 8 | namespace NetPrints.Graph 9 | { 10 | [DataContract] 11 | public class ClassReturnNode : Node 12 | { 13 | public NodeInputTypePin SuperTypePin 14 | { 15 | get => InputTypePins[0]; 16 | } 17 | 18 | public IEnumerable InterfacePins 19 | { 20 | get => InputTypePins.Skip(1); 21 | } 22 | 23 | public ClassReturnNode(ClassGraph graph) 24 | : base(graph) 25 | { 26 | AddInputTypePin("BaseType"); 27 | } 28 | 29 | public void AddInterfacePin() 30 | { 31 | AddInputTypePin($"Interface{InputTypePins.Count}"); 32 | } 33 | 34 | public void RemoveInterfacePin() 35 | { 36 | var interfacePin = InterfacePins.LastOrDefault(); 37 | 38 | if (interfacePin != null) 39 | { 40 | GraphUtil.DisconnectInputTypePin(interfacePin); 41 | InputTypePins.Remove(interfacePin); 42 | } 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /NetPrints/Graph/NodePin.cs: -------------------------------------------------------------------------------- 1 | using PropertyChanged; 2 | using System.Runtime.Serialization; 3 | 4 | namespace NetPrints.Graph 5 | { 6 | /// 7 | /// Abstract base class for node pins. 8 | /// 9 | [DataContract] 10 | [KnownType(typeof(NodeInputDataPin))] 11 | [KnownType(typeof(NodeOutputDataPin))] 12 | [KnownType(typeof(NodeInputExecPin))] 13 | [KnownType(typeof(NodeOutputExecPin))] 14 | [KnownType(typeof(NodeInputTypePin))] 15 | [KnownType(typeof(NodeOutputTypePin))] 16 | [AddINotifyPropertyChangedInterface] 17 | public abstract class NodePin 18 | { 19 | /// 20 | /// Name of the pin. 21 | /// 22 | [DataMember] 23 | public string Name 24 | { 25 | get; 26 | set; 27 | } 28 | 29 | /// 30 | /// Node this pin is contained in. 31 | /// 32 | [DataMember] 33 | public Node Node 34 | { 35 | get; 36 | private set; 37 | } 38 | 39 | protected NodePin(Node node, string name) 40 | { 41 | Node = node; 42 | Name = name; 43 | } 44 | 45 | public override string ToString() 46 | { 47 | return Name; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /NetPrints/Core/FrameworkAssemblyReference.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Runtime.Serialization; 4 | 5 | namespace NetPrints.Core 6 | { 7 | [DataContract] 8 | public class FrameworkAssemblyReference : AssemblyReference 9 | { 10 | /// 11 | /// Path relative to reference assemblies path. 12 | /// 13 | public string FrameworkRelativePath 14 | { 15 | get => frameworkRelativePath; 16 | private set 17 | { 18 | frameworkRelativePath = value; 19 | UpdateFrameworkPath(); 20 | } 21 | } 22 | 23 | [DataMember] 24 | private string frameworkRelativePath; 25 | 26 | public FrameworkAssemblyReference(string relativePath) 27 | : base(null) 28 | { 29 | FrameworkRelativePath = relativePath; 30 | } 31 | 32 | private void UpdateFrameworkPath() 33 | { 34 | AssemblyPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "Reference Assemblies", "Microsoft", "Framework", FrameworkRelativePath); 35 | } 36 | 37 | public override string ToString() => 38 | $"Framework reference assembly {FrameworkRelativePath} found at {AssemblyPath}"; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /NetPrintsEditor/Converters/ModelToViewModelConverter.cs: -------------------------------------------------------------------------------- 1 | using NetPrints.Core; 2 | using NetPrints.Graph; 3 | using NetPrintsEditor.ViewModels; 4 | using System; 5 | using System.Globalization; 6 | using System.Windows.Data; 7 | 8 | namespace NetPrintsEditor.Converters 9 | { 10 | public class ModelToViewModelConverter : IValueConverter 11 | { 12 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 13 | { 14 | if (value is NodeGraph graph) 15 | { 16 | return new NodeGraphVM(graph); 17 | } 18 | else if (value is Node node) 19 | { 20 | return new NodeVM(node); 21 | } 22 | else if (value is ClassGraph cls) 23 | { 24 | return new ClassEditorVM(cls); 25 | } 26 | else if (value is NodePin pin) 27 | { 28 | return new NodePinVM(pin); 29 | } 30 | else if (value is CompilationReference reference) 31 | { 32 | return new CompilationReferenceVM(reference); 33 | } 34 | 35 | throw new ArgumentException(); 36 | } 37 | 38 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 39 | { 40 | throw new NotImplementedException(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /NetPrintsEditor/Controls/VariableGetSetControl.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |