Exemple #1
0
        /// <summary>
        /// This event deletes a selected node.
        /// </summary>
        /// <param name="sender">
        /// Name of the object.
        /// </param>
        /// <param name="e">
        /// This class contains no event data; it is used by events that do not pass state information to an event
        /// handler when an event is raised. If the event handler requires state information, the application must
        /// derive a class from this class to hold the data.
        /// </param>
        public void clickMenuRemoveSCL(object sender, EventArgs e)
        {
            WindowTreeViewLNType windowTreeViewLNType;

            OpenSCL.Object sCL = new OpenSCL.Object();
            sCL.Configuration = (SCL)this.treeSCL.TreeView.Nodes["root"].Nodes["SCL"].Tag;
            if (!this.treeSCL.TreeView.SelectedNode.Tag.GetType().Equals(typeof(SCL)))
            {
                switch (this.treeSCL.TreeView.SelectedNode.Tag.GetType().Name)
                {
                case "tDOI[]":
                case "tDOI":
                case "tDAI[]":
                case "tDAI":
                case "tSDI[]":
                case "tSDI":
                case "tVal[]":
                case "tVal":
                    this.treeSCL = this.treeViewSCL.SearchUPForBaseTypeAndGetSCLTreeNode(this.treeSCL.TreeView.SelectedNode, (typeof(tAnyLN)));
                    if (this.treeSCL != null)
                    {
                        windowTreeViewLNType = new WindowTreeViewLNType(this.treeSCL, sCL.Configuration, this.treeSCL.Tag, "Edit");
                        windowTreeViewLNType.ReloadLNType();
                        windowTreeViewLNType.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("It doesn't load the class");
                    }
                    break;

                case "tGSEControl":
                    treeViewSCL.RemoveGSEandSMV(this.treeSCL, this.objectManagement.FindVariable(this.treeSCL.TreeView.SelectedNode.Tag, "name").ToString(), "tGSE");
                    break;

                case "tSampledValueControl":
                    treeViewSCL.RemoveGSEandSMV(this.treeSCL, this.objectManagement.FindVariable(this.treeSCL.TreeView.SelectedNode.Tag, "name").ToString(), "tSMV");
                    break;

                default:
                    if (MessageBox.Show("Warning!, Do you want to remove this node?", "Removing Node", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly, false) == DialogResult.Yes)
                    {
                        AutomataForValidateToTreeNode automataForValidateToTreeNode;
                        RegularExpressionTree         regularExpressionTree = new RegularExpressionTree();
                        automataForValidateToTreeNode = new AutomataForValidateToTreeNode(this.treeSCL.TreeView.SelectedNode, regularExpressionTree.GetRegExpToDelete(this.treeSCL.TreeView.SelectedNode));
                        automataForValidateToTreeNode.InterpretString();
                    }
                    break;
                }
            }
            else
            {
                MessageBox.Show("Warning!, The SCL node can not be removed!!!");
            }
        }
        /// <summary>
        /// This event creates the nodes on the main SCL TreeNode according to the Data selected.
        /// </summary>
        /// <param name="sender">
        /// Name of the object.
        /// </param>
        /// <param name="e">
        /// This class contains no event data; it is used by events that do not pass state information to an event
        /// handler when an event is raised. If the event handler requires state information, the application must
        /// derive a class from this class to hold the data.
        /// </param>
        void ButtonOkClick(object sender, EventArgs e)
        {
            AutomataForValidateToTreeNode automataForValidateToTreeNode;

            if (treeNodeLN.Nodes.Count != 0)
            {
                RegularExpressionTree regularExpressionTree = new RegularExpressionTree();
                automataForValidateToTreeNode = new AutomataForValidateToTreeNode(treeNodeLN.Nodes[0], regularExpressionTree.GetRegExpToDelete(treeNodeLN.Nodes[0]));
                automataForValidateToTreeNode.InterpretString();
            }
            if (this.bandModify)
            {
                automataForValidateToTreeNode = new AutomataForValidateToTreeNode(this.treeNodeLN, "-DOI/%&*0");
                automataForValidateToTreeNode.InterpretString();
                this.treeViewLNType.EmptyTreeNodeLNType(true);
            }
            else
            {
                this.treeViewLNType.EmptyTreeNodeLNType(false);
            }
            this.Close();
        }
 /// <summary>
 /// This event saves the information of the DataSet.
 /// </summary>
 /// <param name="sender">
 /// Name of the object.
 /// </param>
 /// <param name="e">
 /// This class contains no event data; it is used by events that do not pass state information to an event
 /// handler when an event is raised. If the event handler requires state information, the application must
 /// derive a class from this class to hold the data.
 /// </param>
 private void OKButtonClick(object sender, EventArgs e)
 {
     if (this.DestinyDataSetListBox.Items.Count > 0)
     {
         this.treeSCL.TreeView.SelectedNode = this.treeViewSCL.SearchUPForBaseTypeAndGetSCLTreeNode(treeSCL, typeof(tAnyLN));
         object lN = this.treeSCL.TreeView.SelectedNode.Tag;
         if (this.dataSetSCL != null)
         {
             this.dataSetSCL.FCDA = null;
         }
         else
         {
             this.dataSetSCL = new tDataSet();
         }
         tFCDA[] fCDAs = new tFCDA[this.DestinyDataSetListBox.Items.Count];
         for (int x = 0; x < this.DestinyDataSetListBox.Items.Count; x++)
         {
             fCDAs[x] = (this.DestinyDataSetListBox.Items[x] as FCDAListBox).fCDA;
         }
         this.dataSetSCL.FCDA = fCDAs;
         this.dataSetSCL.name = this.NameTextBox.Text;
         this.dataSetSCL.desc = this.DescTextBox.Text;
         this.objectManagement.AddObjectToArrayObjectOfParentObject(this.dataSetSCL, lN);
         treeViewSCL.GetNodesItemOfArray((lN as tAnyLN).DataSet, lN.GetType(), this.treeSCL.TreeView.SelectedNode);
         if (this.bandModify)
         {
             RegularExpressionTree         regularExpressionTree         = new  RegularExpressionTree();
             AutomataForValidateToTreeNode automataForValidateToTreeNode = new AutomataForValidateToTreeNode(this.treeSCL,
                                                                                                             regularExpressionTree.GetRegExpToDelete(this.treeSCL));
             automataForValidateToTreeNode.InterpretString();
         }
         this.Close();
     }
     else
     {
         MessageBox.Show("No data has been added to the DataSet");
     }
 }
Exemple #4
0
        /// <summary>
        /// Thisd method gets a string and analize it to eliminate the objects that are acording to the string.
        /// </summary>
        /// <returns>
        /// If an error occurs when the analisis is made then it returns an error list.
        /// </returns>
        public List <ErrorsManagement> InterpretString()
        {
            if (this.index < this.keys.Length)
            {
                switch (this.keys.Substring(this.index, 1))
                {
                case "/":
                    this.nameProperty  = this.ConcatenateProperty();
                    this.valueProperty = this.objectManagement.FindVariable(this.objectSCL, nameProperty);
                    if (!this.valueProperty.ToString().Equals("null") && this.valueProperty.GetType().IsArray)
                    {
                        for (int i = 0; i < this.node.Nodes.Count; i++)
                        {
                            if (this.node.Nodes[i].Text.Equals(this.nameProperty))
                            {
                                this.node = this.node.Nodes[i];
                                this.index++;
                                this.InterpretString();
                                break;
                            }
                        }
                    }
                    else if (!this.valueProperty.ToString().Equals("null"))
                    {
                        this.node   = this.node.Nodes[this.valueProperty.GetType().Name.ToString()];
                        this.index += 1;
                        this.InterpretString();
                    }
                    else
                    {
                        this.index += 2;
                        this.InterpretString();
                    }

                    break;

                case "%":
                    AutomataForValidateToTreeNode automataForValidateToTreeNode;
                    TreeNode temporalNode = this.selectNodeToDelete;
                    if (this.keys.Substring(this.index + 1, 1).Equals("%"))
                    {
                        this.index += 2;
                        automataForValidateToTreeNode = new AutomataForValidateToTreeNode(this.node,
                                                                                          this.regularExpressionTree.GetRegExpToDelete(this.node));
                        automataForValidateToTreeNode.InterpretString();
                        this.node = temporalNode;
                        this.InterpretString();
                    }
                    else
                    {
                        for (int x = 0; x < this.node.Nodes.Count;)
                        {
                            automataForValidateToTreeNode = new AutomataForValidateToTreeNode(this.node.Nodes[x],
                                                                                              this.regularExpressionTree.GetRegExpToDelete(this.node.Nodes[x]));
                            automataForValidateToTreeNode.InterpretString();
                        }
                        this.node = temporalNode;
                        this.index++;
                        this.InterpretString();
                    }
                    break;

                case "[":
                    this.index++;
                    this.ConcatenateNumber();
                    if (this.keys.Substring(this.index, 1).Equals("]"))
                    {
                        this.number = this.ConcatenateProperty();
                        this.valueProperties.Add(this.valueProperties[(int)System.Convert.ChangeType(this.number, typeof(int))]);
                        this.ValidateEmptyString(this.valueProperties[(int)System.Convert.ChangeType(this.number, typeof(int))]);
                        this.index++;
                        this.InterpretString();
                    }
                    else
                    {
                        this.ListErrors.Add(new ErrorsManagement("One of the brakets is missing"));
                        return(this.ListErrors);
                    }
                    break;

                case "-":
                    this.nameProperty = this.ConcatenateProperty();
                    if (this.keys.Substring(this.index + 1, 1).Equals(">"))
                    {
                        if (this.keys.Substring(this.index + 2, 1).Equals("["))
                        {
                            this.index += 3;
                            this.ConcatenateNumber();
                            this.number = this.ConcatenateProperty();
                            int valueNumber = (int)System.Convert.ChangeType(this.number, typeof(int));
                            if (this.keys.Substring(this.index, 1).Equals("]"))
                            {
                                if (valueNumber > this.valueProperties.Count - 1)
                                {
                                    for (int count = this.valueProperties.Count - 1; count < valueNumber; count++)
                                    {
                                        this.valueProperties.Add("");
                                    }
                                }
                                this.valueProperty = this.objectManagement.FindVariable(this.objectSCL, this.nameProperty);
                                this.ValidateEmptyString(this.valueProperty);
                                this.valueProperties[valueNumber] = this.valueProperty;
                                this.index++;
                                this.InterpretString();
                            }
                            else
                            {
                                this.ListErrors.Add(new ErrorsManagement("One of the brakets is missing"));
                                return(this.ListErrors);
                            }
                        }
                        else
                        {
                            this.index        += 2;
                            this.valueProperty = this.objectManagement.FindVariable(this.objectSCL, this.nameProperty);
                            if (this.keys.Substring(this.index + 1, 1).Equals("="))
                            {
                                this.index--;
                                this.ValidateEmptyString(this.valueProperty);
                                this.index++;
                                if (this.valueProperty != null)
                                {
                                    this.valueProperties.Add(this.valueProperty);
                                }
                                else
                                {
                                    this.valueProperties.Add("");
                                }
                            }
                            else if (this.valueProperty != null)
                            {
                                this.valueProperties.Add(this.valueProperty);
                            }
                            else
                            {
                                this.ListErrors.Add(new ErrorsManagement("Incorrect string: this.property" + this.nameProperty + "unknow "));
                                return(this.ListErrors);
                            }
                            this.InterpretString();
                        }
                    }
                    else
                    {
                        this.operation = '-';
                        this.index++;
                        this.InterpretString();
                    }
                    break;

                case "&":
                    this.index++;
                    this.InterpretString();
                    break;

                case ".":
                    this.node      = this.node.Parent;
                    this.objectSCL = this.node.Tag;
                    this.index++;
                    this.InterpretString();
                    break;

                case "=":
                    if (this.keys.Substring(this.index + 1, 1).Equals("="))
                    {
                        this.index += 2;
                        this.InterpretString();
                    }
                    else
                    {
                        this.namesPropertiesObject.Add(this.ConcatenateProperty());
                        this.index++;
                        this.InterpretString();
                    }
                    break;

                case "^":
                    this.flags.Add(this.flag);
                    this.flag = true;
                    this.index++;
                    this.InterpretString();
                    break;

                case "#":
                    this.valueProperties.RemoveAt(valueProperties.Count - 1);
                    this.index++;
                    this.InterpretString();
                    break;

                case ";":
                    if (this.flags[0])
                    {
                        this.FindReference(this.node.TreeView.Nodes);
                        if (this.index + 2 < this.keys.Length && this.keys.Substring(this.index + 1, 2).Equals("%%"))
                        {
                            this.index += 3;
                            this.InterpretString();
                        }
                    }
                    else if (this.keys.Substring(this.index + 1, 2).Equals("%%"))
                    {
                        this.index += 3;
                        this.InterpretString();
                    }
                    for (this.indexOfObject = 0; this.indexOfObject < this.namesPropertiesObject.Count; this.indexOfObject++)
                    {
                        this.valueProperties.RemoveAt(0);
                    }
                    this.namesPropertiesObject.Clear();
                    this.flags.RemoveAt(0);
                    this.index++;
                    this.InterpretString();
                    break;

                case "*":
                    if ((int)System.Convert.ChangeType(this.keys.Substring(this.index + 1, 1), typeof(int)) == 1)
                    {
                        switch (this.operation)
                        {
                        case '-':
                            this.treeViewSCL.Remove(this.selectNodeToDelete);
                            break;
                        }
                    }
                    this.index += 2;
                    this.InterpretString();
                    break;

                default:
                    if (regularExpression.IsWordCharacter(this.keys.Substring(this.index, 1)))
                    {
                        this.ConcatenateLetter();
                        this.InterpretString();
                    }
                    else
                    {
                        this.index++;
                    }
                    break;
                }
            }
            return(this.ListErrors);
        }