Example #1
0
        public static EAAPI.Method AddMethod(this EAAPI.Element parent, string name, string returnType = "void")
        {
            EAAPI.Method method = (EAAPI.Method)parent.Methods.AddNew(name, returnType);             // 2nd parameter == return type
            method.Update();
            parent.Refresh();

            return(method);
        }
        public static EAAPI.Element GetClassifier(this EAAPI.Method method, EAAPI.Repository repository)
        {
            EAAPI.Element result = null;

            int classifierID = 0;

            if (int.TryParse(method.ClassifierID, out classifierID))
            {
                if (classifierID != 0)
                {
                    result = repository.GetElementByID(classifierID);
                }
            }

            return(result);
        }
        public static string GetClassifierName(this EAAPI.Method method, EAAPI.Repository repository)
        {
            string result = "";

            int classifierID = 0;

            if (int.TryParse(method.ClassifierID, out classifierID))
            {
                if (classifierID != 0)
                {
                    result = repository.GetElementByID(classifierID).Name;
                }
                else
                {
                    result = method.ReturnType;
                }
            }

            return(result);
        }