<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using WorldSmith.DataClasses;
using WorldSmith.Documents;
using WorldSmith.NodeGraph;
using Graph;
using Graph.Compatibility;
using WorldSmith.NodeGraph.Items;

namespace WorldSmith.Panels
{

    public class ActionCompatStrategy : ICompatibilityStrategy
    {
        public bool CanConnect(NodeConnector from, NodeConnector to)
        {
            if (from.Item.GetType() == to.Item.GetType()) return true;
            return false;
        }
    }

    public partial class DotaAbilityEditor : DockContent, IEditor
    {
        public DotaAbilityEditor()
        {
            InitializeComponent();

            graphControl1.CompatibilityStrategy = new ActionCompatStrategy();

            AddEvents();
            AddActions();

            this.FormClosing += DotaAbilityEditor_FormClosing;

            graphControl1.ConnectionAdded += GraphControl1_ConnectionAdded;
        }

        bool GeneratingGraph = false;

        private void GraphControl1_ConnectionAdded(object sender, AcceptNodeConnectionEventArgs e)
        {
            if (GeneratingGraph) return;
            Console.WriteLine("Connected " + e.Connection.From.Node.Title + " to " + e.Connection.To.Node.Title);

            if(((e.Connection.From.Node is VariableNode && e.Connection.To.Node is ActionNode)
                || (e.Connection.To.Node is VariableNode && e.Connection.From.Node is ActionNode))) //If we are connecting a variable to a action<commit_msg>Don't allow the connection of Two output items or two input items.<commit_after>﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using WorldSmith.DataClasses;
using WorldSmith.Documents;
using WorldSmith.NodeGraph;
using Graph;
using Graph.Compatibility;
using WorldSmith.NodeGraph.Items;

namespace WorldSmith.Panels
{

    public class ActionCompatStrategy : ICompatibilityStrategy
    {
        public bool CanConnect(NodeConnector from, NodeConnector to)
        {
            if (from.Item.ItemType == to.Item.ItemType) return false;
            if (from.Item.GetType() == to.Item.GetType()) return true;            
            return false;
        }
    }

    public partial class DotaAbilityEditor : DockContent, IEditor
    {
        public DotaAbilityEditor()
        {
            InitializeComponent();

            graphControl1.CompatibilityStrategy = new ActionCompatStrategy();

            AddEvents();
            AddActions();

            this.FormClosing += DotaAbilityEditor_FormClosing;

            graphControl1.ConnectionAdded += GraphControl1_ConnectionAdded;
        }

        bool GeneratingGraph = false;

        private void GraphControl1_ConnectionAdded(object sender, AcceptNodeConnectionEventArgs e)
        {
            if (GeneratingGraph) return;
            Console.WriteLine("Connected " + e.Connection.From.Node.Title + " to " + e.Connection.To.Node.Title);

            if(((e.Connection.From.Node is VariableNode && e.Connection.To.Node is ActionNode)
                || (e.Connection.To.Node is VariableNode && e.Connection.From.Node is ActionNode))) //If we are connecting a variable to a action
{'fraction_non_alphanumeric': 0.08630868709586731, 'fraction_numerical': 0.002249086308687096, 'mean_word_length': 2.9228224917309813, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3383802', 'n_tokens_mistral': 950, 'n_tokens_neox': 920, 'n_words': 227}