Esempio n. 1
0
        public void generateCode()
        {
            try
            {
                string am         = comboBoxAM.Text;
                string returnType = comboBoxReturn.Text;
                string getSet     = string.Empty;
                if (radioButtonNormal.Checked)
                {
                    if (comboBoxProperty.Text == "GET/SET")
                    {
                        getSet = "{get; set;}";
                    }
                    else if (comboBoxProperty.Text == "GET")
                    {
                        getSet = "{get;}";
                    }
                    if (comboBoxProperty.Text == "SET")
                    {
                        getSet = "{set;}";
                    }
                    foreach (string item in elementList)
                    {
                        string formattedProperty = "\r\t" + am + " " + returnType + " " + XmlOperation.LowercaseFirst(item) + " " + getSet;
                        textBoxDestination.Text = textBoxDestination.Text + Environment.NewLine + formattedProperty;
                    }
                }
                else
                {
                    foreach (string item in elementList)
                    {
                        string shortExp = XmlOperation.LowercaseFirst(item);
                        string longExp  = XmlOperation.UppercaseFirst(item);

                        if (shortExp == longExp)
                        {
                            shortExp = "_" + shortExp;
                            if (comboBoxProperty.Text == "GET/SET")
                            {
                                getSet = Environment.NewLine + "\r\t" + "{" + Environment.NewLine + "\r\t" + "\r\t" + "get { return " + shortExp + "; }" + Environment.NewLine + "\r\t" + "\r\t" + "set {" + shortExp + " = value; }" + Environment.NewLine + "\r\t" + "}";
                            }
                            else if (comboBoxProperty.Text == "GET")
                            {
                                getSet = Environment.NewLine + "\r\t" + "{" + Environment.NewLine + "\r\t" + "\r\t" + "get { return " + shortExp + "; }" + Environment.NewLine + "\r\t" + "}";
                            }
                            if (comboBoxProperty.Text == "SET")
                            {
                                getSet = Environment.NewLine + "\r\t" + "{" + Environment.NewLine + "\r\t" + "\r\t" + "set {" + shortExp + " = value; }" + Environment.NewLine + "\r\t" + "}";
                            }
                        }
                        else
                        {
                            if (comboBoxProperty.Text == "GET/SET")
                            {
                                getSet = Environment.NewLine + "\r\t" + "{" + Environment.NewLine + "\r\t" + "\r\t" + "get { return " + shortExp + "; }" + Environment.NewLine + "\r\t" + "\r\t" + "set {" + shortExp + " = value; }" + Environment.NewLine + "\r\t" + "}";
                            }
                            else if (comboBoxProperty.Text == "GET")
                            {
                                getSet = Environment.NewLine + "\r\t" + "{" + Environment.NewLine + "\r\t" + "\r\t" + "get { return " + shortExp + "; }" + Environment.NewLine + "\r\t" + "}";
                            }
                            if (comboBoxProperty.Text == "SET")
                            {
                                getSet = Environment.NewLine + "\r\t" + "{" + Environment.NewLine + "\r\t" + "\r\t" + "set {" + shortExp + " = value; }" + Environment.NewLine + "\r\t" + "}";
                            }
                        }
                        string formattedProperty = "\r\t" + am + " " + returnType + " " + shortExp + ";" + Environment.NewLine;
                        formattedProperty       = formattedProperty + "\r\t" + am + " " + returnType + " " + longExp + " \n" + getSet;
                        textBoxDestination.Text = textBoxDestination.Text + Environment.NewLine + formattedProperty;
                    }
                }
            }
            catch { }
        }