Ejemplo n.º 1
0
 private static int GetBaseCommandId(string statement)
 {
     if (Namespace.IsMatch(statement))
     {
         return(99);
     }
     if (ClassStart.IsMatch(statement))
     {
         return(19);
     }
     if (IfStart.IsMatch(statement))
     {
         return(1);
     }
     if (ElseStart.IsMatch(statement.Trim()))
     {
         return(10);
     }
     if (LoopStart.IsMatch(statement))
     {
         return(3);
     }
     if (MethodStart.IsMatch(statement) && !ExcludeMethodDefRegex.IsMatch(statement))
     {
         return(8);
     }
     if (InterfaceStart.IsMatch(statement))
     {
         return(88);                                   // set end interface 89
     }
     if (EnumStart.IsMatch(statement))
     {
         return(78);                              // set end enum 79
     }
     if (SwitchStartRegex.IsMatch(statement))
     {
         return(58);                                     // set end switch 59
     }
     if (StructStart.IsMatch(statement))
     {
         return(48);                                // set end struct 49
     }
     return(0);
 }
Ejemplo n.º 2
0
        public void GetAllClass()
        {
            XmlNode lnkXmlNode = GetLink(ID);

            if (lnkXmlNode != null)
            {
                if ((lnkXmlNode["extendedProperties"] != null) &&
                    (lnkXmlNode["extendedProperties"].Attributes["associationclass"] != null))
                {
                    AssociationClass = Program.ProjectData.GetClassByID(lnkXmlNode["extendedProperties"].Attributes["associationclass"].Value);
                    AssociationClass.AssociationClass = true;
                }

                if ((lnkXmlNode["properties"] != null) && (lnkXmlNode["properties"].Attributes["direction"] != null))
                {
                    Direction = lnkXmlNode["properties"].Attributes["direction"].Value.ToLower();
                }


                ClassStart = Program.ProjectData.GetClassByID(ClassStartID);

                if (lnkXmlNode["target"]["role"].Attributes["name"] != null)
                {
                    PropertyEndID = lnkXmlNode["target"]["role"].Attributes["name"].Value;
                    PropertyEnd   = ClassStart.GetProperty(PropertyEndID);

                    if (Kind.Equals(KindLink.Aggregate))
                    {
                        if (lnkXmlNode["target"]["type"].Attributes["aggregation"].Value.Equals("composite"))
                        {
                            Kind = KindLink.Compose;
                        }
                    }

                    if (lnkXmlNode["target"]["type"].Attributes["multiplicity"] != null)
                    {
                        MultiplicityEnd = lnkXmlNode["target"]["type"].Attributes["multiplicity"].Value;
                    }
                }


                ClassEnd = Program.ProjectData.GetClassByID(ClassEndID);

                if (lnkXmlNode["source"]["role"].Attributes["name"] != null)
                {
                    PropertyStartID = lnkXmlNode["source"]["role"].Attributes["name"].Value;
                    PropertyStart   = ClassEnd.GetProperty(PropertyStartID);

                    if (lnkXmlNode["source"]["type"].Attributes["multiplicity"] != null)
                    {
                        MultiplicityStart = lnkXmlNode["source"]["type"].Attributes["multiplicity"].Value;
                    }
                }

                if (!Kind.Equals(KindLink.Generalize))
                {
                    if ((PropertyEnd == null) && (PropertyStart == null))
                    {
                        MessageBox.Show("Erreur: Lien incorrect entre les classes " + ClassStart.Name + " et " + ClassEnd.Name);
                        Application.Exit();
                    }

                    if (PropertyStart != null)
                    {
                        PropertyStart.LinkData = this;
                    }
                    if (PropertyEnd != null)
                    {
                        PropertyEnd.LinkData = this;
                    }
                }
                else
                {
                    //
                }

                switch (Kind)
                {
                case KindLink.Aggregate:
                {
                    //PropertyEnd.LinkData = this;
                    //PropertyEnd.LinkData = this;
                    break;
                }

                case KindLink.Compose:
                {
                    //PropertyEnd.LinkData = this;
                    break;
                }

                case KindLink.Generalize:
                {
                    break;
                }

                case KindLink.Associate:
                {
                    //PropertyStart.LinkData = this;

                    break;
                }
                }
            }
        }