Beispiel #1
0
        public static void programGenerator(string fileName, string namespaceName, Ac4yClass ac4y, string outputPath, string templatesFolder)
        {
            List <Ac4yProperty> values = ac4y.PropertyList;

            string[] text     = readIn(fileName, templatesFolder);
            string   replaced = "";
            string   newLine  = "";

            for (int i = 0; i < text.Length; i++)
            {
                if (text[i].Equals("#values#"))
                {
                    newLine = newLine + text[i + 1].Replace("#valueName#", ac4y.Name.Substring(0, 1).ToLower()).Replace("#className#", ac4y.Name) + "\n";

                    replaced = replaced + newLine;
                    newLine  = "";

                    i = i + 2;
                }
                else if (text[i].Equals("#adds#"))
                {
                    newLine = newLine + text[i + 1].Replace("#valueName#", ac4y.Name.Substring(0, 1).ToLower()).Replace("#className#", ac4y.Name) + "\n";

                    replaced = replaced + newLine;
                    newLine  = "";

                    i = i + 2;
                }
                replaced = replaced + text[i] + "\n";
            }
            replaced = replaced.Replace("#namespaceName#", namespaceName).Replace("#classContextName#", ac4y.Name + "Context");

            writeOut(replaced, ac4y.Name + "SaveTest", outputPath);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            //Date: 2019. 11. 4. 14:20

            log.Debug("path:" + GetAppConfigStringParameter(APPSETTINGS_CLASSNAME));

            try
            {
                string[] files =
                    Directory.GetFiles(APPSETTINGS_INPATH, "*.xml", SearchOption.TopDirectoryOnly);

                foreach (var _file in files)
                {
                    string _filename = Path.GetFileNameWithoutExtension(_file);
                    Console.WriteLine(_filename);

                    Ac4yClass ac4y = DeserialiseMethod.deser(_file);

                    GenerateClass.generateClass(ac4y, APPSETTINGS_OUTPUTPATH, files, APPSETTINGS_NAMESPACE);
                }
            } catch (Exception _exception)
            {
                log.Error(_exception.StackTrace);
            }
        }
Beispiel #3
0
        //Date: 2019. 11. 09. 15:40
        public void SerializeClasses(Type anyType, string PATH)
        {
            string _guidValue = "";

            try
            {
                GUID _guid = (GUID)anyType.GetCustomAttributes(typeof(GUID), true).First();
                _guidValue = _guid.getGuid();
            }
            catch (Exception _exception)
            {
            }
            PropertyInfo[] _propInf = anyType.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance);

            Ac4yClass _ac4yClass1 = new Ac4yClass(anyType.Name);

            _ac4yClass1.Namespace = anyType.Namespace;
            _ac4yClass1.Ancestor  = anyType.BaseType.Name;
            _ac4yClass1.GUID      = _guidValue;
            foreach (var _prop in _propInf)
            {
                _ac4yClass1.PropertyList.Add(new Ac4yProperty(_prop.Name, _prop.PropertyType.Name));
            }
            SerializeAsXml2TextFile(_ac4yClass1.GetType(), _ac4yClass1, _ac4yClass1.Name, PATH);
        }
Beispiel #4
0
        public static void MainMethod(string _inpath, string _outpath, string _defaultNamespace, string templatesFolder)
        {
            //Date: 2019. 11. 09. 18:30
            if (!Directory.Exists(_outpath + "PrePrcessed"))
            {
                Directory.CreateDirectory(_outpath + "PreProcessed");
            }

            if (!Directory.Exists(_outpath + "Algebra"))
            {
                Directory.CreateDirectory(_outpath + "Algebra");
            }

            if (!Directory.Exists(_outpath + "Final"))
            {
                Directory.CreateDirectory(_outpath + "Final");
            }

            string[] files =
                Directory.GetFiles(_inpath, "*.xml", SearchOption.TopDirectoryOnly);

            foreach (var _file in files)
            {
                string _filename = Path.GetFileNameWithoutExtension(_file);
                Console.WriteLine(_filename);

                Ac4yClass ac4y = DeserialiseMethod.deser(_file);

                GenerateClass.generateClass(ac4y, _outpath, files, _defaultNamespace, templatesFolder);
            }
        }
Beispiel #5
0
        } // Generate

        public RESTServiceODataControllerGeneratorAc4yClass Generate(Ac4yClass type)
        {

            Type = type;

            return Generate();

        } // Generate
        } // Generate

        public PlanObjectGenerator Generate(Ac4yClass type)
        {

            Type = type;

            return Generate();

        } // Generate
Beispiel #7
0
        } // Generate

        public string Generate(Ac4yClass type)
        {

            Type = type;

            return Generate();

        } // Generate
Beispiel #8
0
        } // Generate

        public UpsertServiceResponseGeneratorAc4yClass Generate(Ac4yClass type)
        {

            Type = type;

            return Generate();

        } // Generate
        } // Generate

        public ObjectServiceGeneratorAc4yClass Generate(Ac4yClass type)
        {

            Type = type;

            return Generate();

        } // Generate
        } // Generate

        public JSObjectServiceGenerator Generate(Ac4yClass ac4yClass)
        {

            Ac4yClass = ac4yClass;

            return Generate();

        } // Generate
Beispiel #11
0
        } // Generate

        public UpsertControllerGeneratorAc4yClass Generate(Ac4yClass type)
        {

            Type = type;

            return Generate();

        } // Generate
        } // Generate

        public JavaScriptClassGenerator Generate(Ac4yClass ac4yClass)
        {

            Ac4yClass = ac4yClass;

            return Generate();

        } // Generate
Beispiel #13
0
        } // Generate

        public ContextGeneratorAc4yClass Generate(Ac4yClass type)
        {

            Type = type;

            return Generate();

        } // Generate
Beispiel #14
0
        } // Generate

        public Ac4yRestServiceClientGeneratorAc4yClass Generate(Ac4yClass type)
        {

            Type = type;

            return Generate();

        } // Generate
        } // Generate

        public FilterExpressionVisitorGenerator Generate(Ac4yClass type)
        {

            Ac4yClass = type;

            return Generate();

        } // Generate
Beispiel #16
0
        } // Generate

        public HibernateCapGenerator Generate(Ac4yClass type, Ac4yModule module)
        {

            Ac4yClass = type;

            Module = module;

            return Generate();

        } // Generate
        } // GetConvertedType

        public OpenApiObject GenerateExample(Ac4yClass ac4yClass)
        {
            OpenApiObject resultExample = new OpenApiObject();

            foreach (Ac4yProperty property in ac4yClass.PropertyList)
            {
                if (!property.Name.Equals("Id"))
                {
                    if (GetConvertedType(property.TypeName, FormaKonverziok).Equals("int32") || GetConvertedType(property.TypeName, FormaKonverziok).Equals("int64"))
                    {
                        resultExample.Add(property.Name, new OpenApiInteger(
                                              Int32.Parse(property.ExampleValue)
                                              ));
                    }

                    if (GetConvertedType(property.TypeName, FormaKonverziok).Equals("float"))
                    {
                        resultExample.Add(property.Name, new OpenApiFloat(
                                              float.Parse(property.ExampleValue)
                                              ));
                    }

                    if (GetConvertedType(property.TypeName, FormaKonverziok).Equals("double"))
                    {
                        resultExample.Add(property.Name, new OpenApiDouble(
                                              Double.Parse(property.ExampleValue)
                                              ));
                    }

                    if (GetConvertedType(property.TypeName, FormaKonverziok).Equals("date"))
                    {
                        resultExample.Add(property.Name, new OpenApiDate(DateTime.Now.Date));
                    }

                    if (GetConvertedType(property.TypeName, FormaKonverziok).Equals("date-time"))
                    {
                        resultExample.Add(property.Name, new OpenApiDateTime(DateTime.Now));
                    }

                    if (GetConvertedType(property.TypeName, TipusKonverziok).Equals("string") && GetConvertedType(property.TypeName, FormaKonverziok).Equals(""))
                    {
                        resultExample.Add(property.Name, new OpenApiString(property.ExampleValue));
                    }

                    if (GetConvertedType(property.TypeName, TipusKonverziok).Equals("boolean") && GetConvertedType(property.TypeName, FormaKonverziok).Equals(""))
                    {
                        resultExample.Add(property.Name, new OpenApiBoolean(
                                              Boolean.Parse(property.ExampleValue)
                                              ));
                    }
                }
            }
            ;
            return(resultExample);
        }
Beispiel #18
0
        public static void generateApiMethods(string package, Ac4yClass anyType, string outputPath, string templatesFolder)
        {
            string className = anyType.Name;

            string[] text = readIn("Template", templatesFolder);

            List <Ac4yProperty> map = anyType.PropertyList;

            string replaced = "";
            string newLine  = "";

            for (int i = 0; i < text.Length; i++)
            {
                if (text[i].Contains("#getFirstBy#"))
                {/*
                  * foreach (var pair in map)
                  * {
                  *     newLine = text[i + 1].Replace("#Prop#", pair.Name.Substring(0, 1).ToUpper() + pair.Name.Substring(1))
                  *                             .Replace("#type#", pair.Type) + "\n" + text[i + 2] + "\n" + text[i + 3] + "\n\n";
                  *     newLine = newLine + text[i + 5].Replace("#className#", className)
                  *                                     .Replace("#Prop#", pair.Name.Substring(0, 1).ToUpper() + pair.Name.Substring(1)) + "\n";
                  *     newLine = newLine + "\n" + text[i + 6] + "\n" + text[i + 7] + "\n" + text[i + 8] + "\n" + text[i + 9]
                  + "\n" + text[i + 10];
                  +     replaced = replaced + newLine + "\n\n";
                  +
                  + }
                  +
                  + i = i + 10;*/
                }
                else if (text[i].Equals("#getListBy#"))
                {/*
                  * foreach (var pair in map)
                  * {
                  *     newLine = text[i + 1].Replace("#Prop#", pair.Name.Substring(0, 1).ToUpper() + pair.Name.Substring(1))
                  *                             .Replace("#type#", pair.Type) + "\n" + text[i + 2] + "\n" + text[i + 3] + "\n";
                  *     newLine = newLine + text[i + 4].Replace("#className#", className)
                  *                                     .Replace("#Prop#", pair.Name.Substring(0, 1).ToUpper() + pair.Name.Substring(1)) + "\n";
                  *     newLine = newLine + "\n" + text[i + 6].Replace("#className#", className) + "\n" + text[i + 7] + "\n" + text[i + 8] + "\n" + text[i + 9]
                  + "\n" + text[i + 10] + "\n" + text[i + 11] + "\n";
                  +     replaced = replaced + newLine + "\n\n";
                  + }
                  + i = i + 11;*/
                }
                else
                {
                    replaced = replaced + newLine + text[i] + "\n";
                }

                newLine = "";
            }
            replaced = replaced.Replace("#namespaceName#", package + "Api");
            replaced = replaced.Replace("#className#", className);

            writeOut(replaced, className, outputPath);
        }
Beispiel #19
0
        //Date: 2019. 11. 09. 15:40
        public void SerializeClasses(Type anyType, string PATH)
        {
            string       _guidValue   = "";
            Persistent   persistent   = null;
            Boolean      isPersistent = false;
            Ac4yEmbedded embedded     = null;

            try
            {
                persistent = (Persistent)anyType.GetCustomAttribute(typeof(Persistent), true);
                if (persistent != null)
                {
                    isPersistent = true;
                }
                GUID _guid = (GUID)anyType.GetCustomAttributes(typeof(GUID), true).First();
                _guidValue = _guid.getGuid();
            }
            catch (Exception _exception)
            {
                Console.WriteLine(_exception.Message);
            }
            PropertyInfo[] _propInf = anyType.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.Instance);

            Ac4yClass _ac4yClass1 = new Ac4yClass(anyType.Name);

            _ac4yClass1.Namespace = anyType.Namespace;
            _ac4yClass1.Ancestor  = anyType.BaseType.Name;
            _ac4yClass1.GUID      = _guidValue;
            foreach (var _prop in _propInf)
            {
                if (_prop.PropertyType.ToString().StartsWith("System.Collections.Generic."))
                {
                    string type           = _prop.PropertyType.ToString();
                    string outType        = type.Substring(0, type.IndexOf("`")).Replace("System.Collections.Generic.", "");
                    string innerType      = type.Substring(type.IndexOf("`"));
                    string finalInnerType = innerType.Substring(innerType.LastIndexOf(".") + 1).Replace("]", "");
                    Console.WriteLine(finalInnerType);

                    _ac4yClass1.PropertyList.Add(new Ac4yProperty(_prop.Name, outType + "<" + finalInnerType + ">"));
                }
                else
                {
                    //ezt szeretném debuggolni h lássam mit ír a string-be
                    IEnumerable <CustomAttributeData> attributes = _prop.CustomAttributes;
                    foreach (var attribute in attributes)
                    {
                        string type = attribute.AttributeType.ToString();
                    }
                    _ac4yClass1.PropertyList.Add(new Ac4yProperty(_prop.Name, _prop.PropertyType.Name));
                }
            }
            SerializeAsXml2TextFile(_ac4yClass1.GetType(), _ac4yClass1, _ac4yClass1.Name, PATH, isPersistent);
        }
Beispiel #20
0
        public static Ac4yClass deser(string path)
        {
            Ac4yClass ac4y = null;

            XmlSerializer serializer = new XmlSerializer(typeof(Ac4yClass));

            StreamReader reader = new StreamReader(path);

            ac4y = (Ac4yClass)serializer.Deserialize(reader);
            reader.Close();

            return(ac4y);
        }
Beispiel #21
0
        public string GeneratePlanObject()
        {
            Ac4yUtility utility   = new Ac4yUtility();
            Ac4yClass   ac4yClass = (Ac4yClass)utility.Xml2Object(RunWithXmlRequest.ac4yClassXml, typeof(Ac4yClass));

            string result = new PlanObjectGenerator()
            {
                OutputPath = RunWithXmlRequest.RootDirectory + RunWithXmlRequest.PlanObjectFolderName
            }
            .Generate(ac4yClass);

            return(EncodeTo64(result));
        }
        public string GetConnectedPropertyNames(Ac4yClass ac4yClass)
        {
            string result = "";

            foreach (Ac4yProperty property in ac4yClass.PropertyList)
            {
                if (property.Cardinality.Equals("COLLECTION"))
                {
                    result = result + property.Name + ", ";
                }
            }

            return(result);
        }
Beispiel #23
0
        public static void MainMethod(string _inpath, string _outpath, string _defaultNamespace, string templatesFolder)
        {
            //Date: 2019. 11. 09. 18:20
            if (!Directory.Exists(_outpath + "PersistentMethods"))
            {
                Directory.CreateDirectory(_outpath + "PersistentMethods");
            }

            string[] files =
                Directory.GetFiles(_inpath, "*.xml", SearchOption.TopDirectoryOnly);

            foreach (var _file in files)
            {
                string _filename = Path.GetFileNameWithoutExtension(_file);
                Console.WriteLine(_filename);

                Ac4yClass ac4y = DeserialiseMethod.deser(_file);
            }

            EntityGenerate.entityGenerateMethods(files, _defaultNamespace, _outpath, templatesFolder);
        }
Beispiel #24
0
        static void Main(string[] args)
        {
            try
            {
                string[] files =
                    Directory.GetFiles(_inpath, "*.xml", SearchOption.TopDirectoryOnly);

                CSPersistentGeneratorLib.EntityGenerate.entityGenerateMethods(files, _defaultNamespace, _outpath, templatesFolder);
                CSRestApiGeneratorLib.Program.MainMethod(_inpath, _outpath, _defaultNamespace, templatesFolder);

                foreach (var _file in files)
                {
                    string _filename = Path.GetFileNameWithoutExtension(_file);
                    Console.WriteLine(_filename);

                    Ac4yClass ac4y = DeserialiseMethod.deser(_file);

                    GenerateClass.generateClass(ac4y, _outpath, files, _defaultNamespace, templatesFolder);
                }
            } catch (Exception exception)
            {
                _naplo.Error(exception.StackTrace);
            }
        }
Beispiel #25
0
        static void Main(string[] args)
        {
            GUID    _guid   = new GUID();
            Student student = new Student();

            try
            {
                _guid = (GUID)typeof(Student).GetCustomAttributes(typeof(GUID), true).First();
            } catch (Exception _exception)
            {
            }
            PropertyInfo[] _propInf = typeof(Student).GetProperties();

            // 1. verzió:
            Ac4yClass _ac4yClass1 = new Ac4yClass(student.GetType().Name);

            _ac4yClass1.Ancestor = student.GetType().BaseType.Name;
            _ac4yClass1.GUID     = _guid.getGuid();
            foreach (var _prop in _propInf)
            {
                _ac4yClass1.PropertyList.Add(new Ac4yProperty(_prop.Name, _prop.PropertyType.Name));
            }
            SerializeAsXml2TextFile(_ac4yClass1.GetType(), _ac4yClass1, _ac4yClass1.Name, PATH);
        }
Beispiel #26
0
        public static void generateEntityMethods(string fileName, string namespaceName, Ac4yClass ac4y, string outputPath, string templatesFolder)
        {
            List <Ac4yProperty> props = ac4y.PropertyList;

            string[] text     = readIn(fileName, templatesFolder);
            string   replaced = "";
            string   newLine  = "";

            if (namespaceName == null || namespaceName.Equals(""))
            {
                namespaceName = ConfigurationManager.AppSettings["namespace"];
            }

            int y = 0;

            for (int i = 0; i < text.Length; i++)
            {
                if (text[i].Equals("#findFirstBy#"))
                {
                    foreach (var prop in props)
                    {
                        for (int x = 1; x < 15; x++)
                        {
                            newLine = newLine + text[i + x] + "\n";
                        }
                        newLine = newLine.Replace("#className#", ac4y.Name).Replace("#propName#", prop.Name)
                                  .Replace("#PropName#", prop.Name.Substring(0, 1).ToUpper() + prop.Name.Substring(1))
                                  .Replace("#type#", prop.Type).Replace("#valueName#", ac4y.Name.Substring(0, 1).ToLower())
                                  .Replace("#classContextName#", ac4y.Name + "Context").Replace("#contextPropName#", ac4y.Name + "s");
                    }
                    y = y + 1;

                    replaced = replaced + newLine;
                    newLine  = "";

                    i = i + 14;
                    y = 0;
                }
                else if (text[i].Equals("#exists#"))
                {
                    foreach (var prop in props)
                    {
                        for (int x = 1; x < 22; x++)
                        {
                            newLine = newLine + text[i + x] + "\n";
                        }
                        newLine = newLine.Replace("#className#", ac4y.Name).Replace("#propName#", prop.Name)
                                  .Replace("#PropName#", prop.Name.Substring(0, 1).ToUpper() + prop.Name.Substring(1))
                                  .Replace("#type#", prop.Type).Replace("#valueName#", ac4y.Name.Substring(0, 1).ToLower())
                                  .Replace("#classContextName#", ac4y.Name + "Context").Replace("#contextPropName#", ac4y.Name + "s");
                    }
                    y = y + 1;

                    replaced = replaced + newLine;
                    newLine  = "";

                    i = i + 21;
                    y = 0;
                }
                else if (text[i].Equals("#findListBy#"))
                {
                    foreach (var prop in props)
                    {
                        if (!prop.Name.Equals("id") || !prop.Name.Equals("Id") || !prop.Name.Equals("ID"))
                        {
                            for (int x = 1; x < 14; x++)
                            {
                                newLine = newLine + text[i + x] + "\n";
                            }
                            newLine = newLine.Replace("#className#", ac4y.Name).Replace("#propName#", prop.Name)
                                      .Replace("#PropName#", prop.Name.Substring(0, 1).ToUpper() + prop.Name.Substring(1))
                                      .Replace("#type#", prop.Type).Replace("#valueName#", ac4y.Name.Substring(0, 1).ToLower())
                                      .Replace("#classContextName#", ac4y.Name + "Context").Replace("#contextPropName#", ac4y.Name + "s");
                        }
                    }
                    y = y + 1;

                    replaced = replaced + newLine;
                    newLine  = "";

                    i = i + 13;
                    y = 0;
                }
                else if (text[i].Contains("#update#"))
                {
                    newLine = text[i + 1].Replace("#className#", ac4y.Name) + "\n" + text[i + 2] + "\n";
                    newLine = newLine + text[i + 3].Replace("#classContextName#", ac4y.Name + "Context") + "\n" + text[i + 4] + "\n";
                    newLine = newLine + text[i + 5].Replace("#contextPropName#", ac4y.Name + "s").Replace("#className#", ac4y.Name)
                              + "\n" + text[i + 6].Replace("#className#", ac4y.Name) + "\n\n";

                    foreach (var prop in props)
                    {
                        newLine = newLine + text[i + 8].Replace("#className#", ac4y.Name).Replace("#prop#", prop.Name) + "\n";
                    }

                    newLine = newLine + text[i + 9] + "\n" + text[i + 10] + "\n" + text[i + 11] + "\n";

                    replaced = replaced + newLine + "\n";

                    i = i + 11;
                }
                else if (text[i].Equals("#deleteById#"))
                {
                    foreach (var prop in props)
                    {
                        if (prop.Name.Equals("id") || prop.Name.Equals("Id") || prop.Name.Equals("ID"))
                        {
                            for (int x = 1; x < 11; x++)
                            {
                                newLine = newLine + text[i + x] + "\n";
                            }
                            newLine = newLine.Replace("#className#", ac4y.Name).Replace("#propName#", prop.Name)
                                      .Replace("#PropName#", prop.Name.Substring(0, 1).ToUpper() + prop.Name.Substring(1))
                                      .Replace("#type#", prop.Type).Replace("#valueName#", ac4y.Name.Substring(0, 1).ToLower())
                                      .Replace("#classContextName#", ac4y.Name + "Context").Replace("#contextPropName#", ac4y.Name + "s");
                        }
                        y = y + 1;
                    }
                    replaced = replaced + newLine;
                    newLine  = "";

                    i = i + 10;
                    y = 0;
                }
                else if (text[i].Equals("#adds#"))
                {
                    for (int x = 1; x < 11; x++)
                    {
                        newLine = newLine + text[i + x] + "\n";
                    }
                    newLine = newLine.Replace("#className#", ac4y.Name).Replace("#classContextName#", ac4y.Name + "Context")
                              .Replace("#contextPropName#", ac4y.Name + "s");

                    y = y + 1;

                    replaced = replaced + newLine;
                    newLine  = "";

                    i = i + 10;
                    y = 0;
                }
                else
                {
                    replaced = replaced + text[i] + "\n";
                }
                newLine = "";
            }

            replaced = replaced.Replace("#className#", ac4y.Name).Replace("#namespaceName#", namespaceName);
            replaced = replaced.Replace("#mainClassName#", ac4y.Name);

            writeOut(replaced, ac4y.Name + "EntityMethods", outputPath);
        }
        } // Generate

        public JavaJPAGenerator Generate(Ac4yClass type)
        {
            Type = type;

            return(Generate());
        } // Generate
        public static void generatePersistentService(string templateName, string package, Ac4yClass ac4y, string outputPath, string templatesFolder)
        {
            string[] text = readIn(templateName, templatesFolder);

            string replaced = "";
            string newLine  = "";

            for (int i = 0; i < text.Length; i++)
            {
                if (text[i].Contains("#getFirstBy#"))
                {/*
                  * foreach (var pair in map)
                  * {
                  *     newLine = text[i + 1].Replace("#Prop#", pair.Name.Substring(0, 1).ToUpper() + pair.Name.Substring(1))
                  *                             .Replace("#type#", pair.Type).Replace("#prop#", pair.Name) +
                  *                             "\n" + text[i + 2] + "\n" + text[i + 3] + "\n" + text[i + 4] + "\n" + text[i + 5] + "\n";
                  *     newLine = newLine + text[i + 6].Replace("#className#", className)
                  *                                     .Replace("#Prop#", pair.Name.Substring(0, 1).ToUpper() + pair.Name.Substring(1))
                  *                                     .Replace("#prop#", pair.Name) + "\n";
                  *     for (int x = 7; x < 16; x++)
                  *     {
                  *         newLine = newLine + text[i + x] + "\n";
                  *     }
                  *
                  *     replaced = replaced + newLine + "\n\n";
                  * }
                  *
                  * i = i + 16;*/
                }
                else if (text[i].Equals("#getListBy#"))
                {/*
                  * foreach (var pair in map)
                  * {
                  *     newLine = text[i + 1].Replace("#Prop#", pair.Name.Substring(0, 1).ToUpper() + pair.Name.Substring(1))
                  *                             .Replace("#type#", pair.Type).Replace("#prop#", pair.Name) +
                  *                             "\n" + text[i + 2] + "\n" + text[i + 3] + "\n" + text[i + 4] + "\n" + text[i + 5] + "\n";
                  *     newLine = newLine + text[i + 6].Replace("#className#", className)
                  *                                     .Replace("#Prop#", pair.Name.Substring(0, 1).ToUpper() + pair.Name.Substring(1))
                  *                                     .Replace("#prop#", pair.Name) + "\n";
                  *     for (int x = 7; x < 16; x++)
                  *     {
                  *         newLine = newLine + text[i + x] + "\n";
                  *     }
                  *
                  *     replaced = replaced + newLine + "\n\n";
                  * }
                  *
                  * i = i + 16;*/
                }
                else
                {
                    replaced = replaced + newLine + text[i] + "\n";
                }

                newLine = "";
            }
            replaced = replaced.Replace("#namespaceName#", package);
            replaced = replaced.Replace("#className#", ac4y.Name);

            writeOut(replaced, ac4y.Name, outputPath + "\\PersistentMethods\\");
        }
        } // Generate

        public SAPTableViewGenerator Generate(Ac4yClass type)
        {
            Type = type;

            return(Generate());
        } // Generate
        public static void generateClass(Ac4yClass anyType, string outputPath, string[] files, string namespaceName, string templatesFolder)
        {
            string  className  = anyType.Name;
            string  package    = namespaceName;
            Boolean guidExists = false;

            //get the properties and its type
            List <Ac4yProperty> map = anyType.PropertyList;

            string[] text = new String[0];

            text = readIn("Template", templatesFolder);

            string replaced = "";

            for (int i = 0; i < text.Length; i++)
            {
                if (text[i].Contains("#constructor#"))
                {
                    string newLine = "";
                    string props   = "";
                    foreach (var _prop in map)
                    {
                        props = props + _prop.Name + ", ";
                    }
                    newLine = text[i + 1].Replace("#allProps#", props) + "\n";

                    foreach (var _prop in map)
                    {
                        newLine = newLine + text[i + 2].Replace("#prop#", _prop.Name) + "\n";
                    }
                    replaced = replaced + "\n" + newLine;

                    i = i + 2;
                }
                else if (text[i].Contains("#parentLibrary#"))
                {
                    //Még kellhet
                }
                else if (text[i].Contains("#parentClass#"))
                {
                    string newLine = "";

                    if (anyType.Ancestor != null && !anyType.Ancestor.Equals("") && !anyType.Ancestor.Equals("Object"))
                    {
                        newLine = text[i].Replace("#parentClass#", ": " + anyType.Ancestor) + "\n";
                    }
                    else
                    {
                        newLine = text[i].Replace("#parentClass#", "") + "\n";
                    }

                    replaced = replaced + "\n" + newLine;
                }
                else if (text[i].Equals("#properties#"))
                {
                    foreach (var pair in map)
                    {
                        if (pair.Name.Equals("GUID"))
                        {
                            guidExists = true;
                        }

                        string newLine = "";

                        newLine = newLine + text[i + 1].Replace("#type#", pair.Type);
                        newLine = newLine.Replace("#prop#", pair.Name);

                        replaced = replaced + "\n" + newLine;
                    }

                    if (!guidExists)
                    {
                        string newLine = "";

                        newLine = newLine + text[i + 1].Replace("#type#", "string");
                        newLine = newLine.Replace("#prop#", "GUID");

                        replaced = replaced + "\n" + newLine;
                    }
                    i++;
                }

                else if (text[i].Equals("#getter#"))
                {
                    foreach (var pair in map)
                    {
                        string newLine = text[i + 1].Replace("#type#", pair.Type);
                        newLine = newLine.Replace("#prop#", pair.Name.Substring(0, 1).ToUpper() + pair.Name.Substring(1));

                        replaced = replaced + "\n" + newLine;

                        newLine  = text[i + 2].Replace("#prop#", pair.Name);
                        replaced = replaced + "\n" + newLine + "\n        }\n";
                    }
                    i = i + 3;
                }
                else if (text[i].Equals("#setter#"))
                {
                    foreach (var pair in map)
                    {
                        string newLine = text[i + 1].Replace("#prop#", pair.Name.Substring(0, 1).ToUpper() + pair.Name.Substring(1));
                        newLine = newLine.Replace("#type#", pair.Type);

                        replaced = replaced + "\n" + newLine;

                        newLine  = text[i + 2].Replace("#prop#", pair.Name);
                        replaced = replaced + "\n" + newLine + "\n        }\n";
                    }
                    i = i + 3;
                }

                else if (text[i].Contains("#guid#"))
                {
                    string newLine = "";
                    if (anyType.GUID == null)
                    {
                        Guid id = Guid.NewGuid();

                        newLine  = text[i].Replace("#guid#", id + "");
                        replaced = replaced + "\n" + newLine;
                    }
                    else
                    {
                        newLine  = text[i].Replace("#guid#", anyType.GUID + "");
                        replaced = replaced + "\n" + newLine;
                    }
                }
                else if (text[i].Contains("#classGUID#"))
                {
                    Guid   id      = Guid.NewGuid();
                    string newLine = "";

                    if (anyType.GUID == null)
                    {
                        newLine = text[i].Replace("#classGUID#", "            [GUID(\"" + id + "\")]");
                    }
                    else if (anyType.GUID != null)
                    {
                        newLine = text[i].Replace("#classGUID#", "            [GUID(\"" + anyType.GUID + "\")]");
                    }

                    replaced = replaced + "\n" + newLine;
                }
                else
                {
                    replaced = replaced + "\n" + text[i];
                }
            }
            replaced = replaced.Replace("#namespaceName#", package);

            replaced = replaced.Replace("#className#", className + "PreProcessed");
            writeOut(replaced, className, outputPath);

            GenerateClassAlgebra.generateClass("Template", package, className, map, outputPath, files, templatesFolder);
            //ApiMethodGenerator.generateApiMethods("Template", package, className, map, outputPath, templatesFolder);
            //GeneratePersistentService.generatePersistentService("Template", package, className, map, outputPath, templatesFolder);
            //GenerateResponseModel.generateResponseModel(className, outputPath);
        }