コード例 #1
0
        public List <FileManager.ManagerProjects.INFO_BLOCK> GetInfoBlocks(List <LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK> blocks, LMD_GUI.LMD_BottomPanel info,
                                                                           LMD_GUI.LMD_FastInformationPanel fast_info)
        {
            info.ClearDate();
            List <FileManager.ManagerProjects.INFO_BLOCK> bl = new List <FileManager.ManagerProjects.INFO_BLOCK>();

            ListInfoBlocks.Clear();
            PrevTextCode.Clear();
            level = 0;
            ME.Clear();
            int count_block = blocks.Count;

            info.AddItemText("Сохранение проекта... " + count_block);

            String lang = "";

            switch (ML.PresentLanguage)
            {
            case Language.ManagerLanguage.LANGUAGE.C_PLUS_PLUS: lang = "C++"; break;

            case Language.ManagerLanguage.LANGUAGE.C_SHARP: lang = "C#"; break;

            case Language.ManagerLanguage.LANGUAGE.JAVA: lang = "Java"; break;

            case Language.ManagerLanguage.LANGUAGE.PASCALABC: lang = "Pascal"; break;
            }
            PrevTextCode.Add("Язык построения: " + lang);
            PrevTextCode.Add("");
            info.AddItemText("Язык построения: " + lang);

            LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK block_begin = null;
            for (int i = 0; i < count_block; i++)
            {
                blocks[i].ID = i;
                if (blocks[i].Type == LMD_GUI.TYPE_BLOCK.begin)
                {
                    block_begin = blocks[i];
                }
            }

            LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK block_next = block_begin;

            info.AddItemText("Построение последовательности блоков");

            ResolutionBlocksSave(block_next, info);

            info.AddItemText("Сохранение выполнено успешно");

            return(ListInfoBlocks);
        }
コード例 #2
0
        public void RunCoreCompile(FileManager.INFO_PROJECT info_project, LMD_GUI.LMD_BottomPanel info, List <LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK> blocks,
                                   LMD_GUI.LMD_FastInformationPanel fast_info)
        {
            Language.ManagerLanguage.LANGUAGE old_language = ML.PresentLanguage;
            ML.SetLanguage(Language.ManagerLanguage.LANGUAGE.C_SHARP);

            level = 0;
            ME.Clear();

            LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK block_begin = null;
            for (int i = 0; i < blocks.Count; i++)
            {
                if (blocks[i].Type == LMD_GUI.TYPE_BLOCK.begin)
                {
                    block_begin = blocks[i];
                }
            }

            LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK block_next = block_begin;

            ResolutionBlocks(block_next, info);

            String res_code = "";
            List <Language.BLOCK_CODE_CONTROL_ERROR> BCCE = ME.GetItems();
            int lines = 0;

            for (int i = 0; i < BCCE.Count; i++)
            {
                for (int j = 0; j < BCCE[i].code.Length; j++)
                {
                    lines++;
                    info.AddItemText(BCCE[i].code[j]);
                    res_code += BCCE[i].code[j];
                    BCCE[i].lines.Add(lines);
                }
            }

            CompileCode(res_code, null, true);
            ML.SetLanguage(old_language);
        }
コード例 #3
0
        public static void SaveProject(LMD_Compiling.CompilingManager cm, List <LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK> blocks, LMD_GUI.LMD_BottomPanel info,
                                       LMD_GUI.LMD_FastInformationPanel fast_info)
        {
            INFO_ALL_PROJECTS info_project = GetPresentProject();

            if (info_project != null)
            {
                List <INFO_BLOCK> info_list = cm.GetInfoBlocks(blocks, info, fast_info);

                if (info_list.Count > 0)
                {
                    String path = present_project.Path + present_project.Name + @"\Blocks.xml";

                    XmlSerializer ser = new XmlSerializer(typeof(List <INFO_BLOCK>));

                    using (Stream stream = new FileStream(path, FileMode.Create))
                    {
                        ser.Serialize(stream, info_list);
                    }
                }
            }
        }
コード例 #4
0
        public int Run(List <LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK> blocks, LMD_GUI.LMD_BottomPanel info,
                       LMD_GUI.LMD_FastInformationPanel fast_info)
        {
            info.ClearDate();
            fast_info.SetCurrentText("Начато построение");
            PrevTextCode.Clear();
            level = 0;
            ME.Clear();
            int count_block = blocks.Count;

            // Set setting from projects to compile
            FileManager.INFO_PROJECT info_project = FileManager.ManagerProjects.GetPresentProjectInfo();
            ML.SetLanguage(info_project.Language);

            info.AddItemText("Информация о проекте: ");
            info.AddItemText("Название: " + info_project.name);
            info.AddItemText("Путь: " + Environment.CurrentDirectory + "\\" + info_project.path);
            info.AddItemText("Тип проекта: " + info_project.Type);

            info.AddItemText("Колличество блоков: " + count_block);
            fast_info.ProgressBar.Value = 20;
            String lang = "";

            switch (ML.PresentLanguage)
            {
            case Language.ManagerLanguage.LANGUAGE.C_PLUS_PLUS: lang = "C++"; break;

            case Language.ManagerLanguage.LANGUAGE.C_SHARP: lang = "C#"; break;

            case Language.ManagerLanguage.LANGUAGE.JAVA: lang = "Java"; break;

            case Language.ManagerLanguage.LANGUAGE.PASCALABC: lang = "Pascal"; break;
            }
            PrevTextCode.Add("Язык построения: " + lang);
            PrevTextCode.Add("");
            info.AddItemText("Язык построения: " + lang);

            LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK block_begin = null;
            for (int i = 0; i < count_block; i++)
            {
                if (blocks[i].Type == LMD_GUI.TYPE_BLOCK.begin)
                {
                    block_begin = blocks[i];
                }
            }

            LMD_BLOCKS.BLOCK_JOINT.BASE_BLOCK block_next = block_begin;

            info.AddItemText("Построение последовательности блоков");

            ResolutionBlocks(block_next, info);
            fast_info.ProgressBar.Value = 60;
            info.AddItemText("Собирается код");
            String res_code = "";
            List <Language.BLOCK_CODE_CONTROL_ERROR> BCCE = ME.GetItems();
            int lines = 0;

            for (int i = 0; i < BCCE.Count; i++)
            {
                for (int j = 0; j < BCCE[i].code.Length; j++)
                {
                    lines++;
                    PrevTextCode.Add(BCCE[i].code[j]);
                    info.AddItemText(BCCE[i].code[j]);
                    res_code += BCCE[i].code[j];
                    BCCE[i].lines.Add(lines);
                }
            }
            fast_info.ProgressBar.Value = 80;
            switch (info_project.Type)
            {
            case FileManager.TYPE_PROJECT.DLL: this.name_project = info_project.name + ".dll"; CompileCode(res_code, info, false); break;

            case FileManager.TYPE_PROJECT.EXE: this.name_project = info_project.name + ".exe"; RunCoreCompile(info_project, info, blocks, fast_info); break;

            case FileManager.TYPE_PROJECT.NONE: break;

            case FileManager.TYPE_PROJECT.TXT: FileManager.ManagerProjects.CreateTXTCode(res_code); break;
            }

            info.AddItemText("Собирание проекта завершено");
            fast_info.SetCurrentText("Готово");
            fast_info.ProgressBar.Value = 100;
            return(0);
        }