/**
     * Begins a node and attaches the coroutine to this object
     * If you use this method you MUST call the node.OnComplete method
     * after it yields
     */
    public Coroutine BeginNode(BehaviorNode node)
    {
        node.mReturnValue = BehaviorReturn.Running;

        //process
        return StartCoroutine(node.Process(this));
    }
Beispiel #2
0
        public override NodeViewData CreateNodeViewData(NodeViewData parent, BehaviorNode rootBehavior)
        {
            NodeViewData nvd = base.CreateNodeViewData(parent, rootBehavior);
            nvd.ChangeShape(this.IsEndState ? NodeShape.RoundedRectangle : NodeShape.Rectangle);

            return nvd;
        }
Beispiel #3
0
		public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
		{
			if(_genericChildren.ChildCount <1)
				result.Add( new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.DecoratorHasNoChildError) );

			base.CheckForErrors(rootBehavior, result);
		}
Beispiel #4
0
 public ExporterCpp(BehaviorNode node, string outputFolder, string filename, List<string> includedFilenames = null)
     : base(node, outputFolder, filename, includedFilenames)
 {
     //automatically create an extra level of path
     _outputFolder = Path.Combine(Path.GetFullPath(_outputFolder), "behaviac_generated");
     _filename = "behaviors/generated_behaviors.h";
 }
Beispiel #5
0
        public override NodeViewData CreateNodeViewData(NodeViewData parent, BehaviorNode rootBehavior)
        {
            NodeViewData nvd = base.CreateNodeViewData(parent, rootBehavior);
            nvd.ChangeShape(NodeShape.Ellipse);

            return nvd;
        }
Beispiel #6
0
		public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
		{
			if(_genericChildren.ChildCount <2)
				result.Add( new Node.ErrorCheck(this, ErrorCheckLevel.Warning, Resources.SelectorOnlyOneChildError) );
			else if(_genericChildren.ChildCount <1)
				result.Add( new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.SelectorNoChildrenError) );

			base.CheckForErrors(rootBehavior, result);
		}
Beispiel #7
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            if (this._signal.ChildCount == 0)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.ImpulseWithoutEventError));
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #8
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            if (this.Children.Count < 2)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "There should be at least 2 condition children."));
            }

            base.CheckForErrors(rootBehavior, result);
        }
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            if (this._method == null)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Warning, Resources.RandomGeneratorNotSpecified));
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #10
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result) {
            if (_do_sequence_error_check) {
                if (_genericChildren.EnableChildCount < 1)
                { result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.SequenceNoChildrenError)); }

                else if (_genericChildren.EnableChildCount < 2)
                { result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Warning, Resources.SequenceOnlyOneChildError)); }
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #11
0
 internal static void SetProperty(BehaviorNode behavior, string agentTypename, string agentName, string valueName, string valueStr)
 {
     foreach(ParametersDock dock in _parameterDocks)
     {
         if (dock.AgentName == agentName)
         {
             dock.setProperty(behavior, valueName, valueStr);
             break;
         }
     }
 }
Beispiel #12
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            Type valueType = this._time.GetValueType();

            if (valueType != typeof(float))
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Time must be a float type!"));
            }

            base.CheckForErrors(rootBehavior, result);
        }
    public BehaviorReturn mReturnValue = BehaviorReturn.Invalid; /**< as process is ran in coroutines returning a BehaviorReturn type is not allowed. So we store it here and check it with ReturnValue property */

    #endregion Fields

    #region Constructors

    public BehaviorNode(BehaviorNode parent)
    {
        Composite compNode = parent as Composite;
        if (compNode != null)
            compNode.AddChild(this);
        else
        {
            Decorator decNode = parent as Decorator;
            if (decNode != null)
                decNode.AddChild(this);
        }
    }
    /**
     * Ctor
     * @param stack The BehaviorVariable id of stack to push to
     * @param item The BehaviorVariable id item variable
     */
    public PushToStack(BehaviorNode parent, string stack, string item)
        : base(parent)
    {
        mStack = stack;
        mItem = item;

        //make sure input is instantiated
        if(input == null)
        {
            input = new object[1];
        }
    }
 public NodeViewDataStyled(NodeViewData parent, BehaviorNode rootBehavior, Node node, Pen borderPen, Brush backgroundBrush, Brush draggedBackgroundBrush, string label, string description, int minWidth = 120, int minHeight = 35) :
     base(parent, rootBehavior, node,
          NodeShape.RoundedRectangle,
          new Style(backgroundBrush, null, Brushes.White),
          new Style(null, DefaultCurrentBorderPen, null),
          new Style(null, __defaultSelectedBorderPen, null),
          new Style(draggedBackgroundBrush, null, null),
          new Style(null, __highlightedBorderPen, null),
          new Style(null, __updatedBorderPen, null),
          new Style(null, __prefabBorderPen, null),
          label, __defaultLabelFont, __profileLabelFont, __profileLabelBoldFont, minWidth, minHeight, description) {
 }
Beispiel #16
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            foreach (BaseNode child in _genericChildren.Children)
            {
                if (!(child is WithPrecondition))
                {
                    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.SelectorLoopChildChildError));
                }
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #17
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            base.CheckForErrors(rootBehavior, result);

            if (this._bDoneWithinFrame)
            {
                long count = this.GetCount();

                if (count == -1)
                {
                    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "when 'DoneWithinFrame' is selected, Count should not be -1 as an endless loop!"));
                }
            }
        }
Beispiel #18
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            if (_Task.Child == null)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.NoMethosError));
            }

            if (!(this.Parent is Task))
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.MethodParentError));
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #19
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            Type valueType = this._time.GetValueType();

            string typeName = Plugin.GetNativeTypeName(valueType.FullName);

            if (Plugin.IsIntergerNumberType(typeName))
            { }
            else
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Time should be an integer number type!"));
            }

            base.CheckForErrors(rootBehavior, result);
        }
    /**
     * Coroutine to begin the BehaviorTree
     * @param node The root node
     * @return IEnumerator (see Unity Coroutine)
     */
    private IEnumerator Coroutine_Execute(BehaviorNode node)
    {
        //set this to true as the behavior tree is running
        mStatus = BehaviorReturn.Running;

        mCurrent = node;

        yield return BeginNode(mCurrent);

        //the status of this tree will be whatever the value of the first node was
        mStatus = mCurrent.mReturnValue;

        Debug.Log("BEHAVIOR COMPLETE " + mStatus);
        mCurrent = null;
    }
Beispiel #21
0
 		/// <summary>
		/// Creates a new XML file manager to load and save behaviours.
		/// </summary>
		/// <param name="filename">The file we want to load from or save to.</param>
		/// <param name="node">The node we want to save. When loading, use null.</param>
       public DaxImporter(string filename, BehaviorNode node)
           : base(filename, node)
		{
            if (filename.Length > 0)
            {
                if (filename.StartsWith ("http://"))
                {
                    _filename=filename;
                }
                else{
                _filename = Path.GetFullPath(filename);
                }
            }
            _node = node;
        }
Beispiel #22
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<Node.ErrorCheck> result)
        {
            if (this.Opl == null || this.Opr == null)
            {
                result.Add(new Node.ErrorCheck(this.Node, this.Label, ErrorCheckLevel.Error, "Operand is not complete!"));
            }
            else if (this.Opl.ValueType != typeof(bool) &&
                (this.Operator == OperatorType.And || this.Operator == OperatorType.Or))
            {
                //and and or are only valid for bool
                result.Add(new Node.ErrorCheck(this.Node, this.Label, ErrorCheckLevel.Error, "And and Or are only valid for bool!"));
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #23
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            Type valueType = (this._time != null) ? this._time.ValueType : null;

            if (valueType == null)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Time is not set!"));
            }
            else if (!Plugin.IsIntergerType(valueType) && !Plugin.IsFloatType(valueType))
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Time must be a float type!"));
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #24
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            if (this.Attachments.Count == 0)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.ImpulseWithoutEventError));
            }
            else
            {
                foreach (Attachment attach in this.Attachments)
                {
                    attach.CheckForErrors(rootBehavior, result);
                }
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #25
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            if (_Precondition.Child == null)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Warning, Resources.NoPreconditionError));
            }
            if (_Action.Child == null)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Warning, Resources.NoActionError));
            }
            if (!(this.Parent is SelectorLoop))
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.WithPreconditionParentError));
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #26
0
        public DaxExporter(BehaviorNode node, string outputFolder, string filename)
            : base(node, outputFolder, filename + ".btx")
		{

            if (filename.Length > 0)
            {
                if (filename.StartsWith("http://"))
                {
                    _filename = filename;
                }
                else
                {
                    _filename = Path.GetFullPath(filename);
                }
            }

		}
Beispiel #27
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            Type valueType = this._count.GetValueType();

            string typeName = Plugin.GetNativeTypeName(valueType.FullName);

            if (Plugin.IsIntergerNumberType(typeName))
            {
                if (this._count.ValueClass == VariableDef.kConst)
                {
                    string valueString = this._count.Value.ToString();
                    if (valueType == typeof(long) || valueType == typeof(int) || valueType == typeof(short) || valueType == typeof(sbyte))
                    {
                        long count = long.Parse(valueString);
                        if (count <= 0)
                        {
                            if (count != -1)
                            {
                                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Count should be larger than 0 or -1 for endless loop!"));
                            }
                        }
                    }
                    else if (valueType == typeof(ulong) || valueType == typeof(uint) || valueType == typeof(ushort) || valueType == typeof(byte))
                    {
                        ulong count = ulong.Parse(valueString);
                        if (count >= 100000000)
                        {
                            result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Warning, "Count is a huge number it could be wrong!"));
                        }
                    }
                    else
                    {
                        string errMsg = string.Format("Count is a '{0}', it is not a number!", valueType.Name);
                        result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, errMsg));
                    }
                }
            }
            else
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Count should be an integer number type!"));
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #28
0
        public ExportDialog(BehaviorTreeList behaviorTreeList, BehaviorNode node, bool ignoreErrors, TreeNode selectedTreeRoot, int formatIndex) {
            _initialized = false;

            InitializeComponent();

            _behaviorTreeList = behaviorTreeList;
            _node = node;
            _ignoreErrors = ignoreErrors;
            _selectedTreeRoot = selectedTreeRoot;

            // add all valid exporters to the format combobox
            Debug.Check(Workspace.Current != null);
            int exportIndex = -1;

            for (int i = 0; i < Plugin.Exporters.Count; ++i) {
                ExporterInfo info = Plugin.Exporters[i];

                if (node != null || info.MayExportAll) {
                    int index = this.exportSettingGridView.Rows.Add();
                    DataGridViewRow row = this.exportSettingGridView.Rows[index];

                    bool isExported = Workspace.Current.ShouldBeExported(info.ID);
                    if (info.ID == Plugin.SourceLanguage && this.ExportCustomizedMeta())
                    {
                        isExported = true;
                    }
                    row.Cells["Enable"].Value = isExported;
                    row.Cells["Format"].Value = info.Description;
                    row.Cells["Format"].ReadOnly = true;
                    row.Cells["Setting"].Value = info.HasSettings ? "..." : "";
                    row.Cells["Setting"].ReadOnly = true;

                    if (Workspace.Current.ShouldBeExported(info.ID) &&
                        (exportIndex == -1 || info.HasSettings)) {
                        exportIndex = i;
                    }
                }
            }

            changeExportFormat(exportIndex);

            _initialized = true;
        }
        public override void CheckForErrors(BehaviorNode rootBehavior, List <ErrorCheck> result)
        {
            Type valueType = (this._frames != null) ? this._frames.ValueType : null;

            if (valueType == null)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Frames is not set!"));
            }
            else
            {
                string typeName = Plugin.GetNativeTypeName(valueType.FullName);

                if (!Plugin.IsIntergerNumberType(typeName))
                {
                    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Frames should be an integer number type!"));
                }
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #30
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List <ErrorCheck> result)
        {
            if (this.Domain == string.Empty && this._descriptors.Count == 0)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Invalid query without domain or any descriptors"));
            }

            for (int i = 0; i < this._descriptors.Count; ++i)
            {
                Descriptor_t dw = this._descriptors[i];

                if (dw.Attribute != null && dw.Weight == 0.0f)
                {
                    string msg = string.Format("Descriptors[{0}]'s Weight is 0.0f!", i);
                    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, msg));
                }
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #31
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List<ErrorCheck> result)
        {
            Type valueType = (this._frames != null) ? this._frames.ValueType : null;

            if (valueType == null)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Frames is not set!"));
            }
            else
            {
                string typeName = Plugin.GetNativeTypeName(valueType.FullName);

                if (!Plugin.IsIntergerNumberType(typeName))
                {
                    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Frames should be an integer number type!"));
                }
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #32
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List <ErrorCheck> result)
        {
            Type valueType = this._count.GetValueType();

            string typeName = Plugin.GetNativeTypeName(valueType.FullName);

            if (Plugin.IsIntergerNumberType(typeName))
            {
                if (this._count.ValueClass == VariableDef.kConst)
                {
                    string valueString = this._count.Value.ToString();
                    if (valueType == typeof(long) || valueType == typeof(int) || valueType == typeof(short) || valueType == typeof(sbyte))
                    {
                        long count = long.Parse(valueString);
                        if (count <= 0)
                        {
                            result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Count should be larger than -1!"));
                        }
                    }
                    else if (valueType == typeof(ulong) || valueType == typeof(uint) || valueType == typeof(ushort) || valueType == typeof(byte))
                    {
                        ulong count = ulong.Parse(valueString);
                        if (count >= 100000000)
                        {
                            result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Warning, "Count is a huge number it could be wrong!"));
                        }
                    }
                    else
                    {
                        string errMsg = string.Format("Count is a '{0}', it is not a number!", valueType.Name);
                        result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, errMsg));
                    }
                }
            }
            else
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, "Count should be an integer number type!"));
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #33
0
        /// <summary>
        /// Exports a behaviour to the given file.
        /// </summary>
        /// <param name="file">The file we want to export to.</param>
        /// <param name="behavior">The behaviour we want to export.</param>
        protected void ExportBehavior(BsonSerializer file, BehaviorNode behavior)
        {
            file.WriteComment("EXPORTED BY TOOL, DON'T MODIFY IT!");
            file.WriteComment("Source File: " + behavior.MakeRelative(behavior.FileManager.Filename));

            file.WriteStartElement("behavior");

            Behavior b = behavior as Behavior;

            Debug.Check(b != null);
            Debug.Check(b.Id == -1);

            //'\\' ->'/'
            string behaviorName = b.MakeRelative(b.Filename);

            behaviorName = behaviorName.Replace('\\', '/');
            int pos = behaviorName.IndexOf(".xml");

            if (pos != -1)
            {
                behaviorName = behaviorName.Remove(pos);
            }

            file.WriteString(behaviorName);
            file.WriteString(b.AgentType.AgentTypeName);
            file.WriteString(b.Version.ToString());

            this.ExportProperties(file, b);

            this.ExportParameters(file, (Node)behavior);

            this.ExportAttachments(file, b);

            // export the children
            foreach (Node child in ((Node)behavior).Children)
            {
                this.ExportNode(file, behavior, (Node)behavior, child);
            }

            file.WriteEndElement();
        }
Beispiel #34
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List <Node.ErrorCheck> result)
        {
            if (this.Opl == null || this.Opr == null)
            {
                result.Add(new Node.ErrorCheck(this.Node, this.Id, this.Label, ErrorCheckLevel.Error, "Precondition Operand is not complete!"));
            }
            else if (this.Opl.ValueType != typeof(bool) &&
                     (this.Operator == OperatorType.And || this.Operator == OperatorType.Or))
            {
                //and and or are only valid for bool
                result.Add(new Node.ErrorCheck(this.Node, this.Id, this.Label, ErrorCheckLevel.Error, "And and Or are only valid for bool!"));
            }

            if (this._opl != null && this._opl.Method != null &&
                this._opl.Method.AgentType != null && !this._opl.Method.AgentType.IsCustomized && this._opl.Method.IsCustomized)
            {
                result.Add(new Node.ErrorCheck(this.Node, this.Id, this.Label, ErrorCheckLevel.Error, Resources.CustomizedMethodError));
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #35
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List <ErrorCheck> result)
        {
            if (this.Opl == null || this.Opr == null || this.Opl.ToString() == "" || this.Opr.ToString() == "")
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.OperatandIsNotComplete));
            }
            else if (this.Opl.ValueType != typeof(bool) &&
                     (this.Operator == OperatorType.And || this.Operator == OperatorType.Or))
            {
                // And and Or are only valid for bool
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.AndOrOnlyValidForBool));
            }

            if (this.Opl != null && this.Opl.IsMethod && this.Opl.Method != null && this.Opl.Method.IsCustomized ||
                this.Opr != null && this.Opr.IsMethod && this.Opr.Method != null && this.Opr.Method.IsCustomized)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.CustomizedMethodError));
            }

            base.CheckForErrors(rootBehavior, result);
        }
        public override void CheckForErrors(BehaviorNode rootBehavior, List <Node.ErrorCheck> result)
        {
            {
                if (this._opl == null)
                {
                    result.Add(new Node.ErrorCheck(this.Node, ErrorCheckLevel.Error, "Left operand is not specified!"));
                }

                if (this._opr2 == null)
                {
                    result.Add(new Node.ErrorCheck(this.Node, ErrorCheckLevel.Error, "Right operand is not specified!"));
                }

                if (this._opl != null && this._opl.Method != null && this._opl.Method.IsCustomized)
                {
                    result.Add(new Node.ErrorCheck(this.Node, this.Id, this.Label, ErrorCheckLevel.Error, Resources.CustomizedMethodError));
                }
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #37
0
        public void Restore(BehaviorNode source)
        {
            Debug.Check(source is Nodes.Node);

            Behavior sourceBehavior = (Behavior)source;
            Behavior targetBehavior = (Behavior)this;

            // Restore the agent type.
            targetBehavior.AgentType = sourceBehavior.AgentType;

            // Restore the child connector.
            targetBehavior._genericChildren = sourceBehavior._genericChildren;

            Node sourceNode = (Node)source;
            Node targetNode = (Node)this;

            // Restore the hierarchy.
            targetNode.ReplaceChildren(sourceNode);

            sourceBehavior.CloneProperties(this);
        }
Beispiel #38
0
        protected void ExportBehaviorToServer(StreamWriter file, BehaviorNode behavior)
        {
            if (_behaviorServer == null) return;
            if (_behaviorServer.Length == 0) return;

            string namspace = GetNamespace(_usedNamespace, _filename);
            string classname = Path.GetFileNameWithoutExtension(behavior.FileManager.Filename).Replace(" ", string.Empty);
            string behaviorURL = _behaviorServer + "/behavior/"+classname+".BTX";

            HttpWebRequest httpRequest = (HttpWebRequest)WebRequest.Create(behaviorURL);
            httpRequest.Method = WebRequestMethods.Http.Post;

            //httpRequest.ContentType = "application/x-www-form-urlencoded";
            httpRequest.ContentType = "text/xml";
            //httpRequest.ContentLength = 0;
            StreamWriter requestWriter = new StreamWriter(httpRequest.GetRequestStream(), System.Text.Encoding.ASCII);
            
           // requestWriter.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
           // requestWriter.Write("<aiml version=\"1.0\">\r\n");
           // requestWriter.Write("  <state name=\"*\">\r\n");


            // write comments
           // requestWriter.Write(string.Format("\t<!-- Exported behavior: {0} --> \r\n", _filename));
           // requestWriter.Write(string.Format("\t<!-- Exported file:     {0} -->\r\n\r\n", behavior.FileManager.Filename));

            // export nodes
            int nodeID = 0;
            // export the children
            foreach (Node child in ((Node)behavior).Children)
                ExportNode(requestWriter, namspace, behavior, "this", child, 3, ref nodeID);

            // close constructor
           // requestWriter.Write("  </state>\r\n");
            //requestWriter.Write("</aiml>\r\n");

            requestWriter.Close();
            WebResponse responseGet = httpRequest.GetResponse();

        }
Beispiel #39
0
        public bool SetProperty(BehaviorNode behavior, string valueName, string valueStr)
        {
            DesignerPropertyEditor propertyEditor = getPropertyEditor(valueName);

            if (propertyEditor == null && behavior != null)
            {
                Node root = behavior as Node;

                foreach (PropertyDef p in root.LocalVars)
                {
                    if (!p.IsArrayElement && p.BasicName == valueName)
                    {
                        propertyEditor = addRowControl(p);
                        break;
                    }
                }
            }

            if (propertyEditor == null)
            {
                return(false);
            }

            VariableDef var = propertyEditor.GetVariable();

            if (var.Value.ToString().ToLower() != valueStr.ToLower())
            {
                Plugin.InvokeTypeParser(null, var.ValueType, valueStr, (object value) => var.Value = value, null);

                propertyEditor.ValueWasnotAssigned();

                propertyEditor.SetVariable(var, null);

                propertyEditor.ValueWasAssigned();

                return(true);
            }

            return(false);
        }
Beispiel #40
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List <ErrorCheck> result)
        {
            if (!this._isVisiting)
            {
                this._isVisiting = true;

                // check if the node has any children
                if (_genericChildren.ChildCount < 1)
                {
                    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.BehaviorIsEmptyError));
                }

                if (this._agentType == null)
                {
                    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.NoAgent));
                }

                base.CheckForErrors(rootBehavior, result);

                this._isVisiting = false;
            }
        }
Beispiel #41
0
    public IEnumerator EvaluateNode()
    {
        // If the condition for behavior does not hold up,
        // stop here.
        if (!Condition())
        {
            yield break;
        }

        // If a behavior has been specified, execute that before
        // performing any other behaviors.
        if (Behavior != null)
        {
            Behavior();
        }

        for (int i = 0; i < Children.Count; i++)
        {
            BehaviorNode node = Children[i];
            yield return(node.EvaluateNode());
        }
    }
        /// <summary>
        /// Exports a behaviour to the given file.
        /// </summary>
        /// <param name="file">The file we want to export to.</param>
        /// <param name="behavior">The behaviour we want to export.</param>
        protected void ExportBehavior(StreamWriter file, BehaviorNode behavior)
        {
            string namspace  = GetNamespace(_usedNamespace, _filename);
            string classname = Path.GetFileNameWithoutExtension(behavior.FileManager.Filename).Replace(" ", string.Empty);

            // write comments
            file.Write(string.Format("// Exported behavior: {0}\r\n", _filename));
            file.Write(string.Format("// Exported file:     {0}\r\n\r\n", behavior.FileManager.Filename));

            // create namespace and class
            file.Write(string.Format("namespace {0}\r\n{{\r\n", namspace));
            file.Write(string.Format("\tpublic sealed class {0} : {1}\r\n\t{{\r\n", classname, ((Node)behavior).ExportClass));

            // create instance and accessors
            file.Write(string.Format("\t\tprivate static {0} _instance = null;\r\n", classname));
            file.Write(string.Format("\t\tpublic static {0} Instance\r\n\t\t{{\r\n", classname));
            file.Write("\t\t\tget\r\n\t\t\t{\r\n");
            file.Write("\t\t\t\tif(_instance == null)\r\n");
            file.Write(string.Format("\t\t\t\t\t_instance = new {0}();\r\n\r\n", classname));
            file.Write("\t\t\t\treturn _instance;\r\n\t\t\t}\r\n\t\t}\r\n\r\n");

            // create constructor
            file.Write(string.Format("\t\tprivate {0}()\r\n\t\t{{\r\n", classname));

            // export nodes
            int nodeID = 0;

            // export the children
            foreach (Node child in ((Node)behavior).Children)
            {
                ExportNode(file, namspace, behavior, "this", child, 3, ref nodeID);
            }

            // close constructor
            file.Write("\t\t}\r\n");

            // close namespace and class
            file.Write("\t}\r\n}\r\n");
        }
Beispiel #43
0
        /// <summary>
        /// Exports a node to the given file.
        /// </summary>
        /// <param name="file">The file we want to export to.</param>
        /// <param name="behavior">The behaviour we are currently exporting.</param>
        /// <param name="node">The node we want to export.</param>
        protected void ExportNode(BsonSerializer file, BehaviorNode behavior, Node node)
        {
            if (!node.Enable)
            {
                return;
            }

            file.WriteStartElement("node");

            file.WriteString(node.ExportClass);
            file.WriteString(node.Id.ToString());

            {
                // export the properties
                this.ExportProperties(file, node);

                this.ExportAttachments(file, node);

                if (!node.IsFSM && !(node is ReferencedBehavior))
                {
                    // export the child nodes
                    foreach (Node child in node.Children)
                    {
                        if (!node.GetConnector(child).IsAsChild)
                        {
                            file.WriteStartElement("custom");
                            this.ExportNode(file, behavior, child);
                            file.WriteEndElement();
                        }
                        else
                        {
                            this.ExportNode(file, behavior, child);
                        }
                    }
                }
            }

            file.WriteEndElement();
        }
Beispiel #44
0
        protected void ExportBehavior(StreamWriter file, BehaviorNode behavior)
        {
            string filename  = behavior.FileManager.Filename;
            string nameSpace = _usedNamespace;
            string classname = Path.GetFileNameWithoutExtension(behavior.FileManager.Filename).Replace(" ", string.Empty);

            if (filename.StartsWith("http://"))
            {
                _filename = Path.GetFileName(filename);
                ExportBehaviorToServer(file, behavior);
            }
            else
            {
                _filename = Path.GetFullPath(filename);
                nameSpace = GetNamespace(_usedNamespace, _filename);
                classname = Path.GetFileNameWithoutExtension(behavior.FileManager.Filename).Replace(" ", string.Empty);

                file.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n");
                file.Write("<aiml version=\"1.0\">\r\n");
                file.Write("  <state name=\"*\">\r\n");


                // write comments
                file.Write(string.Format("\t<!-- Exported behavior: {0} --> \r\n", _filename));
                file.Write(string.Format("\t<!-- Exported file:     {0} -->\r\n\r\n", behavior.FileManager.Filename));

                // export nodes
                int nodeID = 0;
                // export the children
                foreach (Node child in ((Node)behavior).Children)
                {
                    ExportNode(file, nameSpace, behavior, "this", child, 3, ref nodeID);
                }

                // close constructor
                file.Write("  </state>\r\n");
                file.Write("</aiml>\r\n");
            }
        }
        /// <summary>
        /// Creates a new referenced behaviour.
        /// </summary>
        /// <param name="rootBehavior">The behaviour this node belongs not. NOT the one is references.</param>
        /// <param name="referencedBehavior">The behaviour you want to reference.</param>
        public ReferencedBehavior(BehaviorNode rootBehavior, BehaviorNode referencedBehavior)
            : base(((Node)referencedBehavior).Label, Resources.ReferencedBehaviorDesc)
        {
            // when this node is saved, the children won't as they belong to another behaviour
            _saveChildren = false;

            _referencedBehavior = referencedBehavior;

            ((Node)_referencedBehavior).WasModified += new WasModifiedEventDelegate(referencedBehavior_WasModified);
            _referencedBehavior.WasRenamed          += new Behavior.WasRenamedEventDelegate(referencedBehavior_WasRenamed);

            // assign the connector of the behaviour
            _genericChildren = _referencedBehavior.GenericChildren;
            _children.SetConnector(_genericChildren);

            List <ParInfo> pars = ((Node)_referencedBehavior).Pars;

            foreach (ParInfo p in pars)
            {
                _pars.Add(p.Clone());
            }
        }
        public override void CheckForErrors(BehaviorNode rootBehavior, List <ErrorCheck> result)
        {
            if (_referencedBehavior == null)
            {
                LoadReferencedBehavior();
            }

            // if we have a circular reference we must stop here
            if (_referencedBehavior == null || _referencedBehavior == rootBehavior)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.ReferencedBehaviorCircularReferenceError));
                return;
            }

            // if our referenced behaviour could be loaded, check it as well for errors
            if (_referencedBehavior != null)
            {
                foreach (Node child in ((Node)_referencedBehavior).Children)
                {
                    child.CheckForErrors(rootBehavior, result);
                }
            }
        }
        /// <summary>
        /// Returns if any of the node's parents is a given behaviour.
        /// </summary>
        /// <param name="behavior">The behavior we want to check if it is an ancestor of this node.</param>
        /// <returns>Returns true if this node is a descendant of the given behavior.</returns>
        public override bool HasParentBehavior(BehaviorNode behavior)
        {
            if (behavior == null)
            {
                return(false);
            }

            ReferencedBehaviorNode refb = (ReferencedBehaviorNode)_node;

            Debug.Check(refb.Reference != null);

            if (refb.Reference == behavior)
            {
                return(true);
            }

            if (_parent == null)
            {
                return(false);
            }

            return(_parent.HasParentBehavior(behavior));
        }
Beispiel #48
0
        public ExportDialog(BehaviorTreeList behaviorTreeList, BehaviorNode node, bool ignoreErrors, TreeNode selectedTreeRoot, int formatIndex)
        {
            InitializeComponent();

            _behaviorTreeList = behaviorTreeList;
            _node             = node;
            _ignoreErrors     = ignoreErrors;
            _selectedTreeRoot = selectedTreeRoot;

            // add all valid exporters to the format combobox
            Debug.Check(Workspace.Current != null);
            int exportIndex = -1;

            for (int i = 0; i < Plugin.Exporters.Count; ++i)
            {
                ExporterInfo info = Plugin.Exporters[i];
                if (node != null || info.MayExportAll)
                {
                    int             index = this.exportSettingGridView.Rows.Add();
                    DataGridViewRow row   = this.exportSettingGridView.Rows[index];

                    row.Cells["Enable"].Value     = Workspace.Current.ShouldBeExported(info.ID);
                    row.Cells["Format"].Value     = info.Description;
                    row.Cells["Format"].ReadOnly  = true;
                    row.Cells["Setting"].Value    = info.ExportToUniqueFile ? "..." : "";
                    row.Cells["Setting"].ReadOnly = true;

                    if (Workspace.Current.ShouldBeExported(info.ID) &&
                        (exportIndex == -1 || info.ExportToUniqueFile))
                    {
                        exportIndex = i;
                    }
                }
            }

            changeExportFormat(exportIndex);
        }
        public BehaviorNodeTraceTag(BehaviorNode node, RequestLog log) : base("li")
        {
            var description = Description.For(node);

            AddClass("node-trace").Data("node-id", node.UniqueId.ToString());

            var container = Add("div").AddClass("node-trace-container");

            container.Text(description.Title);

            var start  = log.FindStep <BehaviorStart>(x => x.Correlation.Node == node);
            var finish = log.FindStep <BehaviorFinish>(x => x.Correlation.Node == node);

            if (start == null)
            {
                AddClass("gray");
                return;
            }

            // TODO -- What *should* happen here?
            if (finish == null)
            {
                return;
            }

            var exception = log.FindStep <ExceptionReport>(x => node.UniqueId.Equals(x.CorrelationId));

            if (exception != null || !finish.Log.Succeeded)
            {
                AddClass("exception");
            }

            var duration = finish.RequestTimeInMilliseconds - start.RequestTimeInMilliseconds;

            container.Add("span").Text(duration.ToString() + " ms").AddClass("node-trace-duration");
        }
Beispiel #50
0
        private void updateParameters(AgentType agentType, string agentName, int frame)
        {
            if (string.IsNullOrEmpty(agentName))
            {
                return;
            }

            string       typeName         = (agentType == null) ? agentName : agentType.ToString();
            string       agentFullname    = (agentType == null) ? agentName : agentType.ToString() + "#" + agentName;
            string       behaviorFilename = FrameStatePool.GetBehaviorFilename(agentFullname, frame);
            BehaviorNode behavior         = null;

            if (agentFullname == Plugin.DebugAgentInstance)
            {
                behavior = UIUtilities.ShowBehavior(behaviorFilename);
            }

            List <AgentDataPool.ValueMark> values = AgentDataPool.GetValidValues(agentType, agentFullname, frame);

            foreach (AgentDataPool.ValueMark value in values)
            {
                ParametersDock.SetProperty(behavior, typeName, agentName, value.Name, value.Value);
            }
        }
Beispiel #51
0
        private void SetTask(string referencedBehaviorFileName)
        {
            string fullPath = FileManagers.FileManager.GetFullPath(referencedBehaviorFileName);

            BehaviorNode referencedBehavior = BehaviorManager.Instance.GetBehavior(fullPath);

            if (referencedBehavior != null)
            {
                //when expand planning process, don't update _task, as it will be set wrongly
                if (Plugin.EditMode == EditModes.Design)
                {
                    Behavior refTree_ = referencedBehavior as Behavior;

                    if (refTree_.Children.Count > 0 && refTree_.Children[0] is Task)
                    {
                        Task rootTask = refTree_.Children[0] as Task;
                        if (rootTask.Prototype != null)
                        {
                            this._task = (MethodDef)rootTask.Prototype.Clone();
                        }
                    }
                }
            }
        }
Beispiel #52
0
        public override void CheckForErrors(BehaviorNode rootBehavior, List <ErrorCheck> result)
        {
            if (_Precondition.Child == null)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Warning, Resources.NoPreconditionError));
            }

            if (_Action.Child == null)
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Warning, Resources.NoActionError));
            }

            //if (_Effector.Child == null)
            //{
            //    result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Warning, Resources.NoEffectorError));
            //}

            if (!(this.Parent is Task))
            {
                result.Add(new Node.ErrorCheck(this, ErrorCheckLevel.Error, Resources.MethodParentError));
            }

            base.CheckForErrors(rootBehavior, result);
        }
Beispiel #53
0
        public override void PostLoad(BehaviorNode behavior)
        {
            if (this.LocalVars != null && this.Children.Count > 0)
            {
                BaseNode child = this.Children[0];
                if (child is Task)
                {
                    Task           task = child as Task;
                    List <ParInfo> pars = new List <ParInfo>();

                    task.CollectTaskPars(ref pars);

                    foreach (ParInfo par in pars)
                    {
                        if (this.LocalVars.Find((p) => p.Name == par.Name) == null)
                        {
                            this.LocalVars.Add(par);
                        }
                    }
                }
            }

            base.PostLoad(behavior);
        }
Beispiel #54
0
        private void ExportNodeClass(StreamWriter file, string btClassName, string agentType, BehaviorNode behavior, Node node)
        {
            string nodeName = string.Format("node{0}", node.Id);

            NodeCsExporter nodeExporter = NodeCsExporter.CreateInstance(node);

            nodeExporter.GenerateClass(node, file, "", nodeName, agentType, btClassName);

            ExportAttachmentClass(file, btClassName, node);

            if (!(node is ReferencedBehavior))
            {
                foreach (Node child in node.Children)
                {
                    ExportNodeClass(file, btClassName, agentType, behavior, child);
                }
            }
        }
Beispiel #55
0
 public ExporterCs(BehaviorNode node, string outputFolder, string filename, List <string> includedFilenames = null)
     : base(node, outputFolder, filename, includedFilenames)
 {
     _outputFolder = Path.GetFullPath(_outputFolder);
     _filename     = _filename.Replace('\\', '/');
 }
Beispiel #56
0
        private void ExportBody(StreamWriter file, BehaviorNode behavior)
        {
            string filename = Path.ChangeExtension(behavior.RelativePath, "").Replace(".", "");

            filename = filename.Replace('\\', '/');

            // write comments
            file.WriteLine("\t// Source file: {0}\r\n", filename);

            string btClassName = string.Format("bt_{0}", filename.Replace('/', '_'));
            string agentType   = behavior.AgentType.AgentTypeName;

            // create the class definition of its attachments
            ExportAttachmentClass(file, btClassName, (Node)behavior);

            // create the class definition of its children
            foreach (Node child in ((Node)behavior).Children)
            {
                ExportNodeClass(file, btClassName, agentType, behavior, child);
            }

            // create the bt class
            file.WriteLine("\tpublic static class {0}\r\n\t{{", btClassName);

            // export the build function
            file.WriteLine("\t\tpublic static bool build_behavior_tree(BehaviorTree bt)\r\n\t\t{");
            file.WriteLine("\t\t\tbt.SetClassNameString(\"BehaviorTree\");");
            file.WriteLine("\t\t\tbt.SetId(-1);");
            file.WriteLine("\t\t\tbt.SetName(\"{0}\");", filename);
            file.WriteLine("#if !BEHAVIAC_RELEASE");
            file.WriteLine("\t\t\tbt.SetAgentType(\"{0}\");", agentType.Replace("::", "."));
            file.WriteLine("#endif");
            if (!string.IsNullOrEmpty(((Behavior)behavior).Domains))
            {
                file.WriteLine("\t\t\tbt.SetDomains(\"{0}\");", ((Behavior)behavior).Domains);
            }
            if (((Behavior)behavior).DescriptorRefs.Count > 0)
            {
                file.WriteLine("\t\t\tbt.SetDescriptors(\"{0}\");", DesignerPropertyUtility.RetrieveExportValue(((Behavior)behavior).DescriptorRefs));
            }

            ExportPars(file, "bt", (Node)behavior, "\t\t");

            // export its attachments
            ExportAttachment(file, btClassName, agentType, "bt", (Node)behavior, "\t\t\t");

            file.WriteLine("\t\t\t// children");

            // export its children
            foreach (Node child in ((Node)behavior).Children)
            {
                ExportNode(file, btClassName, agentType, "bt", child, 3);
            }

            file.WriteLine("\t\t\treturn true;");

            // close the build function
            file.WriteLine("\t\t}");

            // close class
            file.WriteLine("\t}\r\n");
        }
Beispiel #57
0
 public ExporterCs(BehaviorNode node, string outputFolder, string filename, List <string> includedFilenames = null)
     : base(node, outputFolder, filename + ".cs", includedFilenames)
 {
     _outputFolder = Path.Combine(Path.GetFullPath(_outputFolder), "behaviac_generated");
 }
Beispiel #58
0
        /// <summary>
        /// Check the tree nodes according to the behaviors which are ought to be exported.
        /// </summary>
        /// <param name="pool">The pool we are checking.</param>
        /// <param name="node">The behavior we want to export. Use null if all behaviors may be exported.</param>
        public void CheckExportTreeNodes(TreeView tv, TreeNodeCollection pool, BehaviorNode node, bool ignoreErrors, TreeNode subTreeRoot, List <string> referencedFiles)
        {
            foreach (TreeNode tnode in pool)
            {
                NodeTag nodetag           = (NodeTag)tnode.Tag;
                bool    shouldDoubleCheck = false;

                // if no behavior is given enable all behaviors to be exported.
                if (node == null)
                {
                    tnode.Checked     = (subTreeRoot != null) ? isChildOf(tnode, subTreeRoot) : true;
                    shouldDoubleCheck = tnode.Checked;
                }
                else
                {
                    // if the behavior is new one compare the label
                    if (node.FileManager == null)
                    {
                        tnode.Checked = (tnode.Text == ((Node)node).Label);
                    }

                    // otherwise compare the filename
                    else
                    {
                        bool shouldCheck = (nodetag.Filename == node.Filename);

                        if (!shouldCheck && referencedFiles.Count > 0)
                        {
                            string relativeFile = FileManagers.FileManager.GetRelativePath(nodetag.Filename);
                            shouldCheck = referencedFiles.Contains(relativeFile);
                        }

                        tnode.Checked     = shouldCheck;
                        shouldDoubleCheck = true;
                    }
                }

                if (tnode.Checked && (node != null || subTreeRoot != null))
                {
                    tv.SelectedNode = tnode;
                }

                if (nodetag.Type == NodeTagType.Behavior)
                {
                    if (shouldDoubleCheck)
                    {
                        if (!ignoreErrors && (node == null || tnode.Text == ((Node)node).Label))
                        {
                            // Get or load the behavior.
                            BehaviorNode behavior = _behaviorTreeList.GetBehavior(nodetag, tnode.Text);

                            if (behavior != null && behavior is Behavior)
                            {
                                // Check errors for this behavior.
                                List <Node.ErrorCheck> result = new List <Node.ErrorCheck>();
                                ((Behavior)behavior).CheckForErrors(behavior, result);

                                // If there is any error, this node should be disabled.
                                if (Plugin.GetErrorChecks(result).Count > 0)
                                {
                                    tnode.Checked   = false;
                                    tnode.ForeColor = SystemColors.GrayText;
                                }
                            }
                        }
                    }
                    else
                    {
                        tnode.Checked = false;
                    }
                }
                else
                {
                    tnode.Checked = false;
                }

                // check the child nodes
                CheckExportTreeNodes(tv, tnode.Nodes, node, ignoreErrors, subTreeRoot, referencedFiles);

                if (!tnode.Checked && tnode.Nodes.Count > 0)
                {
                    int checkedChildCount = 0;
                    foreach (TreeNode childNode in tnode.Nodes)
                    {
                        NodeTag childTag = (NodeTag)childNode.Tag;
                        if (childNode.Checked || childTag.Type != NodeTagType.Behavior && childNode.Nodes.Count == 0)
                        {
                            checkedChildCount++;
                        }
                    }

                    if (checkedChildCount == tnode.Nodes.Count)
                    {
                        tnode.Checked = true;
                    }
                }
            }
        }
Beispiel #59
0
 public override void CheckForErrors(BehaviorNode rootBehavior, List <ErrorCheck> result)
 {
     base.CheckForErrors(rootBehavior, result);
 }
Beispiel #60
0
        private void changeExportFormat(int exportIndex)
        {
            if (exportIndex < 0)
            {
                return;
            }

            _isCheckingByTypeChanged = true;

            this.treeView.Hide();
            this.treeView.Nodes.Clear();

            TreeNode root    = _behaviorTreeList.GetBehaviorGroup();
            TreeNode newRoot = new TreeNode(root.Text, 0, 0);

            newRoot.Tag = root.Tag;

            this.treeView.Nodes.Add(newRoot);

            CopyTreeNodes(root.Nodes, newRoot.Nodes);

            TreeNode     subTreeRoot = (_selectedTreeRoot != null) ? getNodeByTag(this.treeView.Nodes, _selectedTreeRoot.Tag) : null;
            ExporterInfo exporter    = Plugin.Exporters[exportIndex];
            //BehaviorNode node = exporter.HasSettings ? null : _node;
            BehaviorNode node         = _node;
            bool         ignoreErrors = exporter.HasSettings ? false : _ignoreErrors;

            List <string> referencedFiles = new List <string>();

            if (node != null && node is Node)
            {
                ((Node)node).GetReferencedFiles(ref referencedFiles);
            }

            CheckExportTreeNodes(this.treeView, this.treeView.Nodes, node, ignoreErrors, subTreeRoot, referencedFiles);

            this.treeView.ExpandAll();

            if (node != null)
            {
                TreeNode treeNode = getNodeByFilename(this.treeView.Nodes, node.Filename);

                if (treeNode != null)
                {
                    treeNode.EnsureVisible();
                }
            }
            else if (this.treeView.Nodes.Count > 0)
            {
                this.treeView.Nodes[0].EnsureVisible();
            }

            this.treeView.Select();

            int errorsFilesCount = SetFileCountLabel();

            bool showFaultBehaviors = _initialized ? onlyShowErrorsCheckBox.Checked : (errorsFilesCount > 0);

            exportBehaviorsLabel.Text = showFaultBehaviors ? Resources.FaultBehaviors : Resources.ExportBehaviors;
            if (!_initialized && showFaultBehaviors)
            {
                onlyShowErrorsCheckBox.Checked = true;
            }

            ShowNodes(this.treeView.Nodes, showFaultBehaviors);

            RemoveEmptyNodes(this.treeView.Nodes);

            this.treeView.Show();

            _isCheckingByTypeChanged = false;
        }