Ejemplo n.º 1
0
        private void ShowTemplate(TemplateInfo templ)
        {
            var selected = cboLanguage.SelectedItem is NetLanguage
                   ? (NetLanguage)cboLanguage.SelectedItem
                   : NetLanguage.CSharp;

            if (templ == null)
                ShowTemplate("", selected);
            else
            {
                string res = templ.TemplateBody;
                if( mWizardInfo.ClassBuilder != null )
                    res = res.Replace("${ClassName}", mWizardInfo.ClassBuilder.ClassName);

                ShowTemplate(res, selected);
            }
        }
Ejemplo n.º 2
0
        private void ShowTemplate(TemplateInfo templ)
        {
            if (templ == null)
                sdTemplOut.Text = "";
            else
            {
                string res = templ.TemplateBody;
                res = res.Replace("${ClassName}", mWizardInfo.ClassBuilder.ClassName);

                sdTemplOut.Text = res;
                //txtTemplOut.Text = res;

            }

        }
Ejemplo n.º 3
0
        private void ShowTemplate(TemplateInfo templ)
        {
            if (templ == null)
                ShowTemplate("", (cboLanguage.SelectedItem as NetLanguageList.LanguageType).Language);
            else
            {
                string res = templ.TemplateBody;
                if( mWizardInfo.ClassBuilder != null )
                    res = res.Replace("${ClassName}", mWizardInfo.ClassBuilder.ClassName);

                ShowTemplate(res, (cboLanguage.SelectedItem as NetLanguageList.LanguageType).Language);
            }
        }
Ejemplo n.º 4
0
        //ArrayList mTemplates = new ArrayList();

        private void ReloadTemplates()
        {
            mLoading = true;

            if (cboLanguage.SelectedIndex == 0)
            {
                CodeEditorSyntaxLoader.SetSyntax(txtTemplOut, SyntaxLanguage.VBNET);
                CodeEditorSyntaxLoader.SetSyntax(txtTemplOut, SyntaxLanguage.CSharp);
            }
            else
            {
                CodeEditorSyntaxLoader.SetSyntax(txtTemplOut, SyntaxLanguage.CSharp);
                CodeEditorSyntaxLoader.SetSyntax(txtTemplOut, SyntaxLanguage.VBNET);
            }

            string lengPrefix;

            switch (cboLanguage.SelectedIndex)
            {
                case 0:
                    lengPrefix = "CS -";
                    break;

                case 1:
                    lengPrefix = "VB -";
                    break;

                default:
                    lengPrefix = "";
                    break;
            }

            DirectoryInfo di = new DirectoryInfo(Path.GetDirectoryName(Application.ExecutablePath) + @"\Templates");

            FileInfo[] files = di.GetFiles(lengPrefix + "*.tpl");

            TemplateInfo[] templates = new TemplateInfo[files.Length];

            for (int i = 0; i < files.Length; i++)
            {
                templates[i] = new TemplateInfo();
                templates[i].TemplateName = files[i].Name.Remove(0, lengPrefix.Length).Replace(".tpl", "").Trim();
                templates[i].TemplateBody = File.ReadAllText(files[i].FullName);
            }

            cboTemplate.Items.Clear();
            foreach (TemplateInfo temp in templates)
            {
                cboTemplate.Items.Add(temp);
            }

            mLoading = false;

            if (cboTemplate.Items.Count > 0)
            {
                cboTemplate.SelectedIndex = 0;
                ShowTemplate((TemplateInfo)cboTemplate.SelectedItem);
            }


        }