Пример #1
0
        /// <summary>
        /// 编译代码
        /// </summary>
        /// <returns></returns>
        public string Editor()
        {
            string EditorMessage = "";

            ///如果是C#代码
            if (ProjectLanguage == "C#")
            {
                if (MyProjectClassFile.Count == 0)
                {
                    MessageBox.Show("还没有创建任何项目!");
                    return(EditorMessage = "error");
                }
                ///编译所有的项目
                for (int nowcount = 0; nowcount < MySolution.Count; nowcount++)
                {
                    ProjectClass         proclass   = MySolution[nowcount];
                    string[]             CodeString = new string[proclass.MyListPicPage.Count];
                    int                  i          = 0;
                    XPicCodeToCSharpCode codeEditor = new XPicCodeToCSharpCode(proclass.ProjectName);
                    foreach (PicTabPage page in proclass.MyListPicPage.Values)
                    {
                        CodeString[i] = codeEditor.XPicCodeEditor(page);
                    }
                    string ErrorString = "";
                    CodeDestoryClass.AnalyTicalCode(CodeString, out ErrorString, proclass.OutPath, proclass.GetDllFilePathString(), proclass.ProjectName);
                    EditorMessage += ErrorString + "\r\n";
                }
            }
            else if (ProjectLanguage == "C")
            {
                if (MyProjectClassFile.Count == 0)
                {
                    MessageBox.Show("还没有创建任何项目!");
                    return(EditorMessage = "error");
                }

                ProjectClass             proclass   = GetFirstProject();
                string                   CodeString = "";
                XPicCodeToCLanguagesCode codeEditor = new XPicCodeToCLanguagesCode(proclass.ProjectName);
                CodeString = codeEditor.XPicCodeEditor(proclass.GetFirstPicTabPage());
                string ErrorString = "";
                CodeDestoryClass.AnalyTicalCode(CodeString, out ErrorString, proclass.OutPath, proclass.ProjectName);
                EditorMessage += ErrorString + "\r\n";
            }
            return(EditorMessage);
        }
Пример #2
0
        /// <summary>
        /// 获取翻译后的代码
        /// </summary>
        /// <returns>返回翻译后的代码</returns>
        private string[] GetCode()
        {
            ///如果是C#代码
            if (ProjectLanguage == "C#")
            {
                if (MyProjectClassFile.Count == 0)
                {
                    MessageBox.Show("还没有创建任何项目!");
                    return(null);
                }
                ///编译所有的项目
                for (int nowcount = 0; nowcount < MySolution.Count; nowcount++)
                {
                    ProjectClass         proclass   = MySolution[nowcount];
                    string[]             CodeString = new string[proclass.MyListPicPage.Count];
                    int                  i          = 0;
                    XPicCodeToCSharpCode codeEditor = new XPicCodeToCSharpCode(proclass.ProjectName);
                    foreach (PicTabPage page in proclass.MyListPicPage.Values)
                    {
                        CodeString[i] = codeEditor.XPicCodeEditor(page);
                    }
                    return(CodeString);
                }
                return(null);
            }
            else if (ProjectLanguage == "C")
            {
                if (MyProjectClassFile.Count == 0)
                {
                    MessageBox.Show("还没有创建任何项目!");
                    return(null);
                }

                ProjectClass             proclass   = GetFirstProject();
                string []                CodeString = new string[1];
                XPicCodeToCLanguagesCode codeEditor = new XPicCodeToCLanguagesCode(proclass.ProjectName);
                CodeString[0] = codeEditor.XPicCodeEditor(proclass.GetFirstPicTabPage());
                return(CodeString);
            }
            else
            {
                return(null);
            }
        }