public void open_prj(string prj_name) { clear_form(); cls_prj prj_func=new cls_prj(); prj_func.create_prj_dir("distr",prj_name,false); prj_func.create_prj_dir("system",prj_name,false); cls_main main_func = new cls_main(); System.Collections.ObjectModel.Collection<string> lst_temp = new System.Collections.ObjectModel.Collection<string>(); update_list_with_plans(); //load style list System.Collections.ObjectModel.Collection<string> lst_temp3 = new System.Collections.ObjectModel.Collection<string>(); lst_temp3 = main_func.get_dir(appdir + "Styles\\disk_styles\\"); lst_disk_styles.Items.Clear(); if (lst_temp3.Count != 0) { for (int i = 0; i < lst_temp3.Count; i++) { if (File.Exists(appdir + "Styles\\disk_styles\\" + lst_temp3[i].ToString() + "\\style.info")) { lst_disk_styles.Items.Add(lst_temp3[i].ToString()); } } } //load prj_file System.Collections.ObjectModel.Collection<string> lst_temp1 = new System.Collections.ObjectModel.Collection<string>(); lst_temp1 = main_func.read_textfile_by_line(prj_folder + prj_name + "\\index.prj"); if (lst_temp1.Count > 0) { for (int i = 0; i < lst_temp1.Count; i++) { string s_temp = lst_temp1[i].ToString(); string[] str_temp = s_temp.Split(Convert.ToChar("=")); switch (str_temp[0].ToString()) { case "prj_create_date": prj_create_date = str_temp[1].ToString(); break; case "prj_disk_name": txt_disk_name.Text = str_temp[1].ToString(); break; case "prj_author_name": txt_author_name.Text = str_temp[1].ToString(); break; case "prj_splash_path": txt_splash_path.Text = str_temp[1].ToString(); break; case "prj_menu_edu_caption": txt_menu_edu.Text = str_temp[1].ToString(); break; case "prj_menu_edu_path": txt_menu_edu_path.Text = str_temp[1].ToString(); break; case "prj_menu_control_caption": txt_menu_control.Text = str_temp[1].ToString(); break; case "prj_menu_control_path": txt_menu_control_path.Text = str_temp[1].ToString(); break; case "prj_menu_about_caption": txt_menu_about.Text = str_temp[1].ToString(); break; case "prj_menu_about_path": txt_menu_about_path.Text = str_temp[1].ToString(); break; case "prj_menu_help_path": txt_menu_help_path.Text = str_temp[1].ToString(); break; case "prj_disk_volume_label": textBoxLabel.Text = str_temp[1].ToString(); break; case "splash_enabled": if (str_temp[1].ToString()=="True") { chk_splash_enabled.Checked = true; } else { chk_splash_enabled.Checked=false; } break; case "help_enabled": if ( Microsoft.VisualBasic.Strings.LCase(str_temp[1].ToString()) == "true") { chk_help_enabled.Checked = true; } else { chk_help_enabled.Checked = false; } break; case "umk_enabled": if (Microsoft.VisualBasic.Strings.LCase(str_temp[1].ToString()) == "true") { chk_edu_enabled.Checked = true; } else { chk_edu_enabled.Checked = false; } break; case "test_enabled": if (Microsoft.VisualBasic.Strings.LCase(str_temp[1].ToString()) == "true") { chk_control_enabled.Checked = true; } else { chk_control_enabled.Checked = false; } break; case "about_enabled": if (Microsoft.VisualBasic.Strings.LCase(str_temp[1].ToString()) == "true") { chk_about_enabled.Checked = true; } else { chk_about_enabled.Checked = false; } break; case "prj_splash_type": combo_splash.SelectedItem = str_temp[1].ToString(); if (str_temp[1].ToString() == "page" | str_temp[1].ToString() == "image" | str_temp[1].ToString() == "") { btn_add_splash.Visible = true; label23.Text = "Название файла с заставочной картинкой:"; } else { btn_add_splash.Visible = false; label23.Text = "URL заставки:"; } break; case "prj_menu_help_type": combo_menu_help.SelectedItem = str_temp[1].ToString(); if (str_temp[1].ToString() == "page" | str_temp[1].ToString() =="") { btn_add_help_file.Visible = true; label38.Text = "Название файла с меню:"; } else { btn_add_help_file.Visible = false; label38.Text = "URL меню:"; } break; case "prj_menu_edu_type": combo_menu_edu.SelectedItem = str_temp[1].ToString(); if (str_temp[1].ToString() != "url") { lbl_edu_path.Visible = false; txt_menu_edu_path.Visible = false; } break; case "prj_menu_control_type": combo_menu_control.SelectedItem = str_temp[1].ToString(); if (str_temp[1].ToString() != "url") { lbl_control_path.Visible = false; txt_menu_control_path.Visible = false; } break; case "prj_menu_about_type": combo_menu_about.SelectedItem = str_temp[1].ToString(); if (str_temp[1].ToString() == "page" | str_temp[1].ToString() == "") { btn_add_about_file.Visible = true; label37.Text = "Название файла с меню:"; } else { btn_add_about_file.Visible = false; label37.Text = "URL меню:"; } break; case "prj_create_autorun_inf": if (Microsoft.VisualBasic.Strings.LCase(str_temp[1].ToString()) == "true") { chk_create_autorun_inf.Checked = true; } else { chk_create_autorun_inf.Checked = false; } break; case "prj_disk_style": disk_style=str_temp[1].ToString(); lst_style_preview_list.BeginUpdate(); for (int i2 = 0; i2 < lst_disk_styles.Items.Count; i2++) { if (lst_disk_styles.Items[i2].ToString() == disk_style) { lst_disk_styles.SelectedIndex = i2; } } int selectedIndex = lst_disk_styles.SelectedIndex; if (selectedIndex<0) { selectedIndex=0; }; int topIndex = lst_disk_styles.IndexFromPoint(0, 0); lst_disk_styles.TopIndex = topIndex; lst_disk_styles.SetSelected(selectedIndex, false); lst_disk_styles.SetSelected(selectedIndex, true); lst_style_preview_list.EndUpdate(); read_style(str_temp[1].ToString()); break; case "prj_student_profession": txt_profession.Text = str_temp[1].ToString(); break; case "prj_student_specialization": txt_specialization.Text = str_temp[1].ToString(); break; case "prj_student_year": txt_year.Text = str_temp[1].ToString(); break; case "prj_student_total_year": txt_total_year.Text = str_temp[1].ToString(); break; case "prj_copy_service": if (Microsoft.VisualBasic.Strings.LCase(str_temp[1].ToString()) == "true") { chk_service_enabled.Checked = true; } else { chk_service_enabled.Checked = false; } break; case "prj_create_search": if (Microsoft.VisualBasic.Strings.LCase(str_temp[1].ToString()) == "true") { chk_search_enabled.Checked = true; } else { chk_search_enabled.Checked = false; } break; case "prj_glass_enabled": if (Microsoft.VisualBasic.Strings.LCase(str_temp[1].ToString()) == "true") { chk_glass_enabled.Checked = true; } else { chk_glass_enabled.Checked = false; } break; case "prj_ziptests_enabled": if (Microsoft.VisualBasic.Strings.LCase(str_temp[1].ToString()) == "true") { chk_zip_tests_enabled.Checked = true; } else { chk_zip_tests_enabled.Checked = false; } break; case "prj_convert_files_to": combo_convert_to.SelectedItem = str_temp[1].ToString(); break; case "prj_licence": txt_licence_path.Text = str_temp[1].ToString(); break; case "prj_licence_enabled": if (Microsoft.VisualBasic.Strings.LCase(str_temp[1].ToString()) == "true") { check_licence.Checked = true; } else { check_licence.Checked = false; } break; case "prj_licence_type": combo_licence.SelectedItem = str_temp[1].ToString(); if (str_temp[1].ToString() == "page" | str_temp[1].ToString() == "") { label50.Text = "Название файла с соглашением:"; btn_add_licence.Visible = true; } else { label50.Text = "URL соглашения:"; btn_add_licence.Visible = false; } break; case "prj_eplan": combo_plans.SelectedItem = str_temp[1].ToString(); break; } } } //load build information file System.Collections.ObjectModel.Collection<string> lst_temp2 = new System.Collections.ObjectModel.Collection<string>(); lst_temp2 = main_func.read_textfile_by_line(prj_folder + prj_name + "\\build.info"); if (lst_temp2.Count > 0) { for (int i = 0; i < lst_temp2.Count; i++) { string s_temp = lst_temp2[i].ToString(); string[] str_temp = s_temp.Split(Convert.ToChar("=")); switch (str_temp[0].ToString()) { case "prj_is_built": if (Microsoft.VisualBasic.Strings.LCase(str_temp[1]) == "true") { prj_IS_built = true; } else { prj_IS_built = false; }; break; case "prj_build_date": prj_build_date = str_temp[1].ToString(); break; } } } if (prj_build_date != "") { lbl_structurize_build_date.Text = prj_build_date; btn_explore_distr.Enabled = true; } else { lbl_structurize_build_date.Text = "Никогда"; } if (lst_disk_styles.SelectedIndex >= 0) { read_style(lst_disk_styles.SelectedItem.ToString()); } pict_save.Enabled = true; pict_save.Image = Properties.Resources.save2_n; prj_open_name = prj_name; if (Directory.Exists(appdir + "system\\service") == false) { chk_service_enabled.Enabled = false; } else { chk_service_enabled.Enabled = true; } prj_open = 1; tab_prj.Visible = true; gb_new_prj.Visible = false; gb_open_prj.Visible = false; pict_save.Visible = true; pict_actions.Visible = true; if (File.Exists(prj_folder + prj_name + "\\temp\\autorun\\disk_icon.ico")) { pic_disk_icon.Load(prj_folder + prj_name + "\\temp\\autorun\\disk_icon.ico"); } else { pic_disk_icon.Image = null; } }
private void backgroundStructurWorker_DoWork(object sender, DoWorkEventArgs e) { try { //start_create_structure(); m_isStructurising = true; string temp_str = ""; developers_components_lib.cls_filesystem filesys_func = new developers_components_lib.cls_filesystem(); developers_components_lib.cls_converter convert_func = new developers_components_lib.cls_converter(); cls_prj prj_func = new cls_prj(); cls_main main_func = new cls_main(); System.Collections.ObjectModel.Collection<string> db_files = new System.Collections.ObjectModel.Collection<string>(); System.Collections.ObjectModel.Collection<string> db_temp_list = new System.Collections.ObjectModel.Collection<string>(); System.Collections.ObjectModel.Collection<string> lst_files = new System.Collections.ObjectModel.Collection<string>(); System.Collections.ObjectModel.Collection<string> lst_plan = new System.Collections.ObjectModel.Collection<string>(); System.Collections.ObjectModel.Collection<string> lst_eplan_rows = new System.Collections.ObjectModel.Collection<string>(); lst_plan = open_plan(s_plan_name); db_files.Clear(); prj_func.create_prj_dir("distr", prj_open_name, true); string control_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\control\\index.htm"); string control_row_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\control\\row_template.htm"); string control_rows_str = ""; string umk_row_year_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\row_year.htm"); string umk_row_year_temp_str = ""; string umk_rows_str = ""; string umk_final_rows_str = ""; string sub_umk_rows_str = ""; string sub_umk_template_temp = ""; string subumk_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\sub_umk.htm"); string subumk_row_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\subumk_row_template.htm"); string umk_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\index.htm"); string umk_row_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\row_template.htm"); // //copying system files // backgroundStructurWorker.ReportProgress(10); if (chk_service_enabled.Enabled == true & chk_service_enabled.Checked == true) { main_func.DirectoryCopy(appdir + "system\\service", appdir + "Projects\\" + prj_open_name + "\\distr\\SERVICE", true); } main_func.DirectoryCopy(appdir + "system\\umk", appdir + "Projects\\" + prj_open_name + "\\distr\\", true); // //copying UMK FILES // backgroundStructurWorker.ReportProgress(20); if (lst_plan.Count > 0) { //create test if ( s_control_type == "page") { main_func.DirectoryCopy(appdir + "Styles\\disk_styles\\" + disk_style + "\\control\\files", appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\control\\", true); control_template = control_template.Replace("{CAPTION}", txt_menu_control.Text); } //create education if (s_edu_type == "page") { main_func.DirectoryCopy(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\files", appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\", true); umk_template = umk_template.Replace("{SPECIALIZATION}", txt_specialization.Text); umk_template = umk_template.Replace("{all_years}", txt_total_year.Text); //umk_template = umk_template.Replace("{SPECIALIZATION}", txt_specialization.Text); //umk_template = umk_template.Replace("{SPECIALIZATION}", txt_specialization.Text); } main_func.clear_lst_to_file(); main_func.add_to_lst_to_file("version=" + shell_search_db_version); string type = ""; int n = 0; int Col = 0; string umk_name = ""; backgroundStructurWorker.ReportProgress(30); for (int h = 0; h < 7; h++) { Col = 0; for (int i = 0; i < lst_plan.Count; i++) { string ss = lst_plan[i]; string[] plan_data = ss.Split(Convert.ToChar(";")); if (plan_data[3] == h.ToString()) { lst_files.Clear(); lst_files = main_func.get_files_indir(umk_folder + "\\" + plan_data[2]); if (lst_files.Count > 0) { if (Directory.Exists(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name)) { umk_name = main_func.get_filename(plan_data[2]) + "_" + h.ToString() + i.ToString(); } else { umk_name = main_func.get_filename(plan_data[2]); } Directory.CreateDirectory(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name); if (s_control_type == "page") { Directory.CreateDirectory(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\test"); } Directory.CreateDirectory(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html"); temp_str = umk_row_template; n++; int nt = i + 1; string cur_umk = umk_folder + "\\" + plan_data[2] + "\\info.dat"; temp_str = temp_str.Replace("{n}", nt.ToString()); temp_str = temp_str.Replace("{name}", plan_data[0]); temp_str = temp_str.Replace("{HOURS}", main_func.get_value_from_infofile(cur_umk, "hours")); temp_str = temp_str.Replace("{LINK}", umk_name + "/html/index.htm"); temp_str = temp_str.Replace("{CODE}", plan_data[1]); sub_umk_template_temp = subumk_template; sub_umk_template_temp = sub_umk_template_temp.Replace("{CAPTION}", plan_data[0]); sub_umk_rows_str = ""; if (main_func.get_value_from_infofile(cur_umk, "exam") == "1") { temp_str = temp_str.Replace("{EXAM}", "+"); } else { temp_str = temp_str.Replace("{EXAM}", "-"); } if (main_func.get_value_from_infofile(cur_umk, "test") == "1") { temp_str = temp_str.Replace("{TEST}", "+"); } else { temp_str = temp_str.Replace("{TEST}", "-"); } if (main_func.get_value_from_infofile(cur_umk, "examination") == "1") { temp_str = temp_str.Replace("{EXAMINATION}", "+"); } else { temp_str = temp_str.Replace("{EXAMINATION}", "-"); } if (main_func.get_value_from_infofile(cur_umk, "prj") == "1") { temp_str = temp_str.Replace("{PRJ}", "+"); } else { temp_str = temp_str.Replace("{PRJ}", "-"); } umk_rows_str = umk_rows_str + temp_str; main_func.DirectoryCopy(appdir + "Styles\\disk_styles\\" + disk_style + "\\umk\\subfiles", appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html\\", true); for (int j = 0; j < lst_files.Count; j++) { if (main_func.get_extention(lst_files[j]) != "info") { if (File.Exists(umk_folder + "\\" + plan_data[2] + "\\" + lst_files[j] + ".info")) { string file_name = umk_folder + "\\" + plan_data[2] + "\\" + lst_files[j]; string tags = main_func.get_value_from_infofile(file_name + ".info", "tags"); if (tags != "" & Microsoft.VisualBasic.Strings.Left(tags, 1) != ",") { tags = "," + tags; } type = main_func.get_value_from_infofile(file_name + ".info", "file_type"); string for_course = main_func.get_value_from_infofile(file_name + ".info", "course"); bool file_is_good = false; if (for_course != "") { if (for_course==Convert.ToString(Convert.ToInt32( plan_data[3])+1)) { file_is_good=true; } else { string[] ss1 = for_course.Split(Convert.ToChar(",")); if (ss1.GetUpperBound(0) > 0) { for (int a = 0; a < ss1.GetUpperBound(0); a++) { if (ss1[a] == Convert.ToString(Convert.ToInt32(plan_data[3]) + 1)) { file_is_good = true; }; } } } } else { file_is_good = true; } switch (type) { case "Тесты (AIST)": temp_str = control_row_template; if (chk_zip_tests_enabled.Checked == true) { File.Copy(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\test\\test.zip", true); temp_str = temp_str.Replace("{LINK}", "ztest://" + "umk/" + umk_name + "/test/test.zip"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\test\\test.zip;test,аист,aist,тестирование" + tags); } } else { filesys_func.extract_all_to_fldr(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\test\\"); if (File.Exists(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\test\\Aist-3w.exe")) { temp_str = temp_str.Replace("{LINK}", "app://" + "umk/" + umk_name + "/test/Aist-3w.exe"); } else { temp_str = temp_str.Replace("{LINK}", "app://" + "umk/" + umk_name + "/test/app_test.exe"); } if (chk_search_enabled.Checked == true) { db_temp_list.Clear(); db_temp_list = main_func.get_files_indir(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\test\\"); if (db_temp_list.Count > 0) { for (int t = 0; t < db_temp_list.Count; t++) { db_files.Add("Content\\umk\\" + umk_name + "\\test\\" + db_temp_list[t] + ";test,тест,тестирование" + tags); } } } } temp_str = temp_str.Replace("{NAME}", plan_data[0]); control_rows_str = control_rows_str + temp_str; break; case "Тесты": temp_str = control_row_template; if (main_func.get_extention(file_name) == "htm" | main_func.get_extention(file_name) == "html") { File.Copy(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\test\\" + main_func.get_filename(file_name)); temp_str = temp_str.Replace("{LINK}", "../umk/" + umk_name + "/test/" + main_func.get_filename(file_name)); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\test\\" + main_func.get_filename(file_name) + ";test,тест,тестирование,документ,файл,предмет,автор" + tags); } } else { if (s_convert_to_type == "PDF (*.pdf)") { temp_str = temp_str.Replace("{LINK}", "other://umk/" + umk_name + "/test/test.pdf"); convert_func.convert(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\test\\test.pdf", "pdf"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\test\\test.pdf;test,тест,тестирование,документ,файл,предмет,автор" + tags); } } else { temp_str = temp_str.Replace("{LINK}", "../umk/" + umk_name + "/test/test.htm"); convert_func.convert(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\test\\test.htm", "html"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\test\\test.htm;test,тест,тестирование,страница,предмет,автор" + tags); } } } /* if (chk_zip_tests_enabled.Checked == true) { File.Copy(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + dg_prj_files.Rows[i].Cells[0].Value.ToString() + "\\test\\test.zip", true); temp_str = temp_str.Replace("{LINK}", "ztest://" + "umk/" + dg_prj_files.Rows[i].Cells[0].Value.ToString() + "/test/test.zip"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + dg_prj_files.Rows[i].Cells[0].Value.ToString() + "\\test\\test.zip;test,тестирование" + tags); } } else { filesys_func.extract_all_to_fldr(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + dg_prj_files.Rows[i].Cells[0].Value.ToString() + "\\test\\"); temp_str = temp_str.Replace("{LINK}", "app://" + "umk/" + dg_prj_files.Rows[i].Cells[0].Value.ToString() + "/test/app_test.exe"); if (chk_search_enabled.Checked == true) { db_temp_list.Clear(); db_temp_list = main_func.get_files_indir(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + dg_prj_files.Rows[i].Cells[0].Value.ToString() + "\\test\\"); if (db_temp_list.Count > 0) { for (int t = 0; t < db_temp_list.Count; t++) { db_files.Add("Content\\umk\\" + dg_prj_files.Rows[i].Cells[0].Value.ToString() + "\\test\\" + db_temp_list[t] + ";test,тест,тестирование" + tags); } } } }*/ temp_str = temp_str.Replace("{NAME}", plan_data[0]); control_rows_str = control_rows_str + temp_str; break; case "Метод. указания": if (file_is_good) { temp_str = subumk_row_template; if (s_convert_to_type == "PDF (*.pdf)") { temp_str = temp_str.Replace("{LINK}", "other://umk/" + umk_name + "/html/met.pdf"); convert_func.convert(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html\\met.pdf", "pdf"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\html\\met.pdf;методичка,методические,указания,документ,файл,предмет,автор" + tags); } } else { temp_str = temp_str.Replace("{LINK}", "met.htm"); convert_func.convert(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html\\met.htm", "html"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\html\\met.htm;методичка,методические,указания,страница,предмет,автор" + tags); } } temp_str = temp_str.Replace("{NAME}", "Методические указания"); sub_umk_rows_str = sub_umk_rows_str + temp_str; } break; case "Лекции": if (file_is_good) { temp_str = subumk_row_template; if (s_convert_to_type == "PDF (*.pdf)") { convert_func.convert(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html\\lectures.pdf", "pdf"); temp_str = temp_str.Replace("{LINK}", "other://umk/" + umk_name + "/html/lectures.pdf"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\html\\lectures.pdf;лекции,материал,лекционный,файл,документ,предмет,автор" + tags); } } else { convert_func.convert(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html\\lectures.htm", "html"); temp_str = temp_str.Replace("{LINK}", "lectures.htm"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\html\\lectures.htm;лекции,материал,лекционный,страница,предмет,автор" + tags); } } temp_str = temp_str.Replace("{NAME}", "Лекции"); sub_umk_rows_str = sub_umk_rows_str + temp_str; } break; case "Билеты": if (file_is_good) { temp_str = subumk_row_template; if (s_convert_to_type == "PDF (*.pdf)") { convert_func.convert(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html\\notes.pdf", "pdf"); temp_str = temp_str.Replace("{LINK}", "other://umk/" + umk_name + "/html/notes.pdf"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\html\\notes.pdf;билеты,задания,файл,документ,предмет,автор" + tags); } } else { convert_func.convert(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html\\notes.htm", "html"); temp_str = temp_str.Replace("{LINK}", "notes.htm"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\html\\notes.htm;билеты,задаения,страница,предмет,автор" + tags); } } temp_str = temp_str.Replace("{NAME}", "Билеты"); sub_umk_rows_str = sub_umk_rows_str + temp_str; } break; case "Раб.программа": if (file_is_good) { temp_str = subumk_row_template; if (s_convert_to_type == "PDF (*.pdf)") { convert_func.convert(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html\\programme.pdf", "pdf"); temp_str = temp_str.Replace("{LINK}", "other://umk/" + umk_name + "/html/programme.pdf"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\html\\programme.pdf;программа,рабочая,курс,лекции,экзамен,тест,зачёт,зачет,билеты,проект,курсовой,курсовая,курсовик,итог,тестирование,файл,документ,предмет,автор" + tags); } } else { convert_func.convert(file_name, appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html\\programme.htm", "html"); temp_str = temp_str.Replace("{LINK}", "programme.htm"); if (chk_search_enabled.Checked == true) { db_files.Add("Content\\umk\\" + umk_name + "\\html\\programme.htm;программа,рабочая,курс,лекции,экзамен,тест,зачёт,зачет,билеты,проект,курсовой,курсовая,курсовик,итог,тестирование,страница,предмет,автор" + tags); } } temp_str = temp_str.Replace("{NAME}", "Рабочая учебная программа"); sub_umk_rows_str = sub_umk_rows_str + temp_str; } break; } } } Col++; } sub_umk_template_temp = sub_umk_template_temp.Replace("{ROWS}", sub_umk_rows_str); main_func.write_all_text_to_file(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\" + umk_name + "\\html\\index.htm", sub_umk_template_temp); } } } if (Col > 0) { umk_row_year_temp_str = umk_row_year_template; int ts = h + 1; umk_row_year_temp_str = umk_row_year_temp_str.Replace("{YEAR}", ts.ToString()); umk_final_rows_str = umk_final_rows_str + umk_row_year_temp_str + umk_rows_str; umk_rows_str = ""; } } if (s_control_type == "page") { control_template = control_template.Replace("{ROWS}", control_rows_str); main_func.write_all_text_to_file(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\control\\index.htm", control_template); } if (s_edu_type == "page") { umk_template = umk_template.Replace("{ROWS}", umk_final_rows_str); main_func.write_all_text_to_file(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\umk\\index.htm", umk_template); } } else { MessageBox.Show("В выбранном учебном плане нет файлов!", "Отсутствуют файлы", MessageBoxButtons.OK, MessageBoxIcon.Warning); } // //create files.db // backgroundStructurWorker.ReportProgress(50); if (chk_search_enabled.Checked == true) { main_func.clear_lst_to_file(); if (db_files.Count > 0) { for (int i = 0; i < db_files.Count; i++) { main_func.add_to_lst_to_file(db_files[i]); } main_func.write_to_info_file(prj_folder + prj_open_name + "\\distr\\files.db"); } } backgroundStructurWorker.ReportProgress(60); // //create autorun.inf // if (chk_create_autorun_inf.Checked == true) { main_func.clear_lst_to_file(); main_func.add_to_lst_to_file("[autorun]"); main_func.add_to_lst_to_file("open=umk_shell.exe"); if (File.Exists(appdir + "Projects\\" + prj_open_name + "\\temp\\autorun\\disk_icon.ico")) { File.Copy(appdir + "Projects\\" + prj_open_name + "\\temp\\autorun\\disk_icon.ico", prj_folder + prj_open_name + "\\distr\\autorun.ico", true); main_func.add_to_lst_to_file("icon=autorun.ico"); } main_func.write_to_info_file(prj_folder + prj_open_name + "\\distr\\autorun.inf"); } // //create strings.inf // backgroundStructurWorker.ReportProgress(70); main_func.clear_lst_to_file(); main_func.add_to_lst_to_file("version=" + shell_config_version); main_func.add_to_lst_to_file("[MAIN_SETTINGS]"); main_func.add_to_lst_to_file("search_enabled=" + chk_search_enabled.Checked.ToString()); main_func.add_to_lst_to_file("glass_enabled=" + chk_glass_enabled.Checked.ToString()); if (s_licence_enabled == true) { if (s_licence_type == "url") { main_func.add_to_lst_to_file("licence_path=" + txt_licence_path.Text); } else { main_func.add_to_lst_to_file("licence_path=" + "licence/licence.htm"); } main_func.add_to_lst_to_file("licence_type=" + s_licence_type); } main_func.add_to_lst_to_file("[CAPTIONS]"); main_func.add_to_lst_to_file("caption=" + txt_disk_name.Text); main_func.add_to_lst_to_file("author=" + txt_menu_about.Text); main_func.add_to_lst_to_file("learn_caption=" + txt_menu_edu.Text); main_func.add_to_lst_to_file("control_caption=" + txt_menu_control.Text); main_func.add_to_lst_to_file("[BUTTONS]"); main_func.add_to_lst_to_file("splash_type=" + s_splash_type); if (s_splash_type == "url") { main_func.add_to_lst_to_file("splash_path=" + txt_splash_path.Text); } else { main_func.add_to_lst_to_file("splash_path=splash\\" + txt_splash_path.Text); } main_func.add_to_lst_to_file("splash_enabled=" + chk_splash_enabled.Checked.ToString()); main_func.add_to_lst_to_file("help_type=page"); //+ s_help_type chk_help_enabled.Checked.ToString() main_func.add_to_lst_to_file("help_enabled=True" ); main_func.add_to_lst_to_file("help_path=help\\index.htm"); main_func.add_to_lst_to_file("umk_type=" + s_edu_type); main_func.add_to_lst_to_file("umk_enabled=" + chk_edu_enabled.Checked.ToString()); if (s_edu_type == "url") { main_func.add_to_lst_to_file("umk_path=" + txt_menu_edu_path.Text); } else { main_func.add_to_lst_to_file("umk_path=umk\\index.htm"); } main_func.add_to_lst_to_file("test_type=" + s_control_type); main_func.add_to_lst_to_file("test_enabled=" + chk_control_enabled.Checked.ToString()); if (s_control_type == "url") { main_func.add_to_lst_to_file("test_path=" + txt_menu_control_path.Text); } else { main_func.add_to_lst_to_file("test_path=control\\index.htm"); } main_func.add_to_lst_to_file("about_type=" + s_about_type); main_func.add_to_lst_to_file("about_enabled=" + chk_about_enabled.Checked.ToString()); if (s_about_type == "url") { main_func.add_to_lst_to_file("about_path=" + txt_menu_about_path.Text); } else { main_func.add_to_lst_to_file("about_path=about\\" + txt_menu_about_path.Text); } main_func.write_to_info_file(prj_folder + prj_open_name + "\\distr\\strings.inf"); // //copy files from temp // backgroundStructurWorker.ReportProgress(80); if (s_splash_type != "url") { //copy splash if (Directory.Exists(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\splash") == false) { Directory.CreateDirectory(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\splash"); } main_func.DirectoryCopy(appdir + "Projects\\" + prj_open_name + "\\temp\\splash", appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\splash", true); } if (s_help_type == "page") { //copy help if (Directory.Exists(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\help") == false) { Directory.CreateDirectory(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\help"); } main_func.DirectoryCopy(appdir + "Projects\\" + prj_open_name + "\\temp\\help", appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\help", true); } if (s_about_type == "page") { //copy about if (Directory.Exists(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\about") == false) { Directory.CreateDirectory(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\about"); } main_func.DirectoryCopy(appdir + "Projects\\" + prj_open_name + "\\temp\\about", appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\about", true); } //copy service files //main_func.DirectoryCopy(appdir + "system\\service", appdir + "Projects\\" + prj_open_name + "\\distr\\SERVICE", true); // //SET CHANGES // backgroundStructurWorker.ReportProgress(90); prj_IS_built = true; prj_build_date = DateTime.Now.Date.Day.ToString() + "." + DateTime.Now.Date.Month.ToString() + "." + DateTime.Now.Date.Year.ToString(); //create help main_func.DirectoryCopy(appdir + "Styles\\disk_styles\\" + disk_style + "\\help\\files", appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\help\\", true); string help_template = main_func.read_all_file(appdir + "Styles\\disk_styles\\" + disk_style + "\\help\\index.htm"); if (txt_menu_help_path.Text != "" & chk_help_enabled.Checked.ToString()=="True") { help_template = help_template.Replace("{HELP_LINK}", txt_menu_help_path.Text); help_template = help_template.Replace("{HELP_LINK_ENABLED}", "block"); } else { help_template = help_template.Replace("{HELP_LINK}", "#"); help_template = help_template.Replace("{HELP_LINK_ENABLED}", "none"); } main_func.write_all_text_to_file(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\help\\index.htm", help_template); if (s_licence_type == "page") { //copy licence if (Directory.Exists(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\licence") == false) { Directory.CreateDirectory(appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\licence"); } main_func.DirectoryCopy(appdir + "Projects\\" + prj_open_name + "\\temp\\licence", appdir + "Projects\\" + prj_open_name + "\\distr\\Content\\licence", true); } // //Add files_folders to listBoxFiles // add_prj_to_listboxfiles(); backgroundStructurWorker.ReportProgress(100); e.Result = 0; } catch ( Exception ex) { MessageBox.Show(ex.Message); e.Result = 1; } }
private void btn_create_prj_Click(object sender, EventArgs e) { if (prj_exist == false && String.IsNullOrEmpty(txt_prj_name.Text) == false) { prj_open_name = txt_prj_name.Text; clear_form(); cls_prj project = new cls_prj(); project.create_prj(prj_open_name); gb_new_prj.Visible = false; open_prj(prj_open_name); prj_open = 1; } else { MessageBox.Show("Проект с таким именем существует!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Stop); }; }