Esempio n. 1
0
        public void LoadLinks(IArchive linksArchive)
        {
            var links = linksArchive.ReadAll <Archive>();

            foreach (var link in links)
            {
                var input   = link.Read <Archive>(nameof(Link.Input));
                var inNode  = input.Read <Guid>(nameof(Node));
                var inIndex = input.Read <int>("Index");

                var output   = link.Read <Archive>(nameof(Link.Output));
                var outNode  = output.Read <Guid>(nameof(Node));
                var outIndex = output.Read <int>("Index");

                var firstNode  = Nodes.FirstOrDefault(n => n.Id == inNode);
                var secondNode = Nodes.FirstOrDefault(n => n.Id == outNode);

                if (firstNode != null && secondNode != null)
                {
                    if (firstNode.Input.Count > inIndex && secondNode.Output.Count > outIndex)
                    {
                        var inputPin  = firstNode.Input[inIndex];
                        var outputPin = secondNode.Output[outIndex];

                        TryToConnectPins(inputPin, outputPin);
                    }
                    else
                    {
                        _output.Write($"Could not create link in node {outNode}: Input.Index={inIndex} and Output.Index={outIndex}",
                                      _cmdProvider.Create(() => Focus(firstNode)),
                                      OutputType.Warning);
                    }
                }
            }
        }
Esempio n. 2
0
 public NodeEntry Get(Guid templateId)
 {
     if (!_data.TryGetValue(templateId, out NodeEntry value))
     {
         _output.Write($"Node {templateId} could not be found.", OutputType.Warning);
     }
     return(value);
 }
Esempio n. 3
0
        static void Main(string[] args)
        {
            _settingsHandler = new CommandLineArgumentSettingsHandler();
            _dataManager     = new NetworkDataManager(_settingsHandler);
            _outputManager   = new ConsoleOutputManager();

            _settingsHandler.LoadSettings(args);
            var data = _dataManager.GatherNetworkData();

            _outputManager.Write(data);
        }
Esempio n. 4
0
        public void OpenInEditor(Guid instanceId)
        {
            var graph = GetGraphFile(instanceId);

            if (graph != null)
            {
                _editor.TryOpenFileEditor(graph);
            }
            else
            {
                _output.Write($"Could not open graph {instanceId}. Maybe it's not compiled.", OutputType.Info);
            }
        }
Esempio n. 5
0
        static void ShowInstructions(IOutputManager output)
        {
            var sb = new StringBuilder();
            sb.AppendLine("You can:");
            sb.AppendLine("Post a message using: [your user name] -> [your message]");
            sb.AppendLine("  For example: john -> Such a wonderful day today!");
            sb.AppendLine("Read your messages using: [your user name]");
            sb.AppendLine("  For example: john");
            sb.AppendLine("Follow a user using: [your user name] follows [user name to follow]");
            sb.AppendLine("  For example: john follows bob");
            sb.AppendLine("Read your wall using: [your user name] wall");
            sb.AppendLine("  For example: john wall");

            output.Write(sb.ToString());
        }
Esempio n. 6
0
        public string GetUserName()
        {
            try
            {
                _log.Info("BTG - Get the name from input.");
                do
                {
                    _outputManager.Write("Input player Name: ");
                    _player.Name = Read();
                }while (string.IsNullOrEmpty(_player.Name.Trim()));
                _log.Info("BTG - Get the name - Completed!");
            }
            catch (Exception e)
            {
                _log.Error($"BTG - Error when trying to get the name :{e}");
            }

            return(_player.Name);
        }