├── 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