public void create_prj(string prj_name) { cls_main file_func = new cls_main(); Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory + "Projects\\" + prj_name); file_func.clear_lst_to_file(); file_func.add_to_lst_to_file("prj_name=" + prj_name); file_func.add_to_lst_to_file("prj_create_date=" + DateTime.Now.Date.ToString()); file_func.write_to_info_file(AppDomain.CurrentDomain.BaseDirectory + "Projects\\" + prj_name + "\\index.prj"); }
public void add_prj_to_listboxfiles() { listBoxFiles.Items.Clear(); System.Collections.ObjectModel.Collection<string> return_lst = new System.Collections.ObjectModel.Collection<string>(); System.Collections.ObjectModel.Collection<string> return_fldr_lst = new System.Collections.ObjectModel.Collection<string>(); cls_main main_func = new cls_main(); return_lst = main_func.get_files_indir(prj_folder + prj_open_name + "\\distr\\"); if (return_lst.Count > 0) { for (int i = 0; i < return_lst.Count; i++) { add_files_to_listboxfiles(prj_folder + prj_open_name + "\\distr\\" + return_lst[i]); } } return_fldr_lst = main_func.get_dir(prj_folder + prj_open_name + "\\distr\\"); if (return_fldr_lst.Count > 0) { for (int i = 0; i < return_fldr_lst.Count; i++) { add_folder_to_listboxfiles(prj_folder + prj_open_name + "\\distr\\" + return_fldr_lst[i]); } } UpdateCapacity(); }
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; } }
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 btn_add_licence_Click(object sender, EventArgs e) { cls_main main_func = new cls_main(); file_dialog.Title = "Укажите файл со страницей"; file_dialog.DefaultExt = "*.htm"; file_dialog.Filter = "HTML страница (*.htm)|*.htm|HTML страница (*.html)|*.html"; DialogResult result = file_dialog.ShowDialog(); if (result == DialogResult.OK) { main_func.DirectoryCopy(main_func.get_path(file_dialog.FileName) + main_func.get_filename_without_ex(file_dialog.FileName) + "_files", appdir + "Projects\\" + prj_open_name + "\\temp\\licence\\licence_files", true); File.Copy(file_dialog.FileName, appdir + "Projects\\" + prj_open_name + "\\temp\\licence\\licence." + main_func.get_extention(file_dialog.FileName), true); txt_licence_path.Text = "licence." + main_func.get_extention(file_dialog.FileName); main_func.replace_in_file(main_func.get_filename_without_ex(file_dialog.FileName) + "_files/", "licence_files/", appdir + "Projects\\" + prj_open_name + "\\temp\\licence\\licence." + main_func.get_extention(file_dialog.FileName)); } }
void show_gb_list() { clear_form(); lst_plans.Items.Clear(); cls_main main_func = new cls_main(); System.Collections.ObjectModel.Collection<string> lst_temp = new System.Collections.ObjectModel.Collection<string>(); lst_temp = main_func.get_files_indir(plans_dir); if (lst_temp.Count != 0) { for (int i = 0; i < lst_temp.Count; i++) { if(main_func.get_extention(lst_temp[i].ToString())== "xml") { lst_plans.Items.Add(lst_temp[i].ToString()); } } } gb_list.Visible = true; gb_plan_edit.Visible = false; }
void show_path(string selected_value) { string open_path = ""; System.Collections.ObjectModel.Collection<string> return_lst = new System.Collections.ObjectModel.Collection<string>(); cls_main main_func = new cls_main(); switch (umk_level) { case 0: open_path = umk_dir; return_lst = main_func.get_dir(open_path); lbl_name.Text = "Выберите подразделение!"; break; case 1: open_path = umk_dir + "\\" + selected_value; if (selected_value.Length > 0) { unit_name = selected_value; }; return_lst = main_func.get_dir(open_path); lbl_name.Text = "Выбрано: " + unit_name + ". Выберите кафедру!"; break; case 2: open_path = umk_dir + "\\" + unit_name + "\\" + selected_value; if (selected_value.Length > 0) { caf_name = selected_value; } return_lst = main_func.get_dir(open_path); lbl_name.Text = "Выбрано: " + caf_name + ". Выберите УМК!"; break; //case 3: // open_path = umk_dir + "\\" + unit_name + "\\" + caf_name + "\\" + selected_value; // if (selected_value.Length > 0) { umk_name = selected_value; } // return_lst = main_func.get_files_indir(open_path); // lbl_name.Text = "> " + umk_name + ". Выберите файл!"; // break; // case 4: // open_path = umk_dir + "\\" + unit_name + "\\" + caf_name + "\\" + umk_name + "\\" + selected_value; // file_name = selected_value; // break; } //MessageBox.Show(unit_name + "\\" + caf_name + "\\" + umk_name); if (umk_level != 4 && umk_level!=3) { lst_files.Items.Clear(); if (return_lst.Count > 0) { for (int i = 0; i < return_lst.Count; i++) { if (main_func.get_extention(return_lst[i]) != "info" && main_func.get_extention(return_lst[i]) != "dat") { lst_files.Items.Add(return_lst[i]); } } } } }
public void show_dg_open() { gb_new_prj.Visible = false; tab_prj.Visible = false; gb_open_prj.Left = 12; gb_open_prj.Top = 48; //pict_save.Enabled = false; //pict_save.Image = Properties.Resources.save_d; //pict_data.Enabled = false; //pict_data.Image = Properties.Resources.data_d; devicesComboBox.Visible = false; label43.Visible = false; //pict_actions.Image = Properties.Resources.actions_d; //pict_actions.Enabled = false; clear_form(); cls_main main_func = new cls_main(); System.Collections.ObjectModel.Collection<string> lst_temp = new System.Collections.ObjectModel.Collection<string>(); lst_temp = main_func.get_dir(prj_folder); lst_open_prj.Items.Clear(); if (lst_temp.Count != 0) { for (int i = 0; i < lst_temp.Count; i++) { lst_open_prj.Items.Add(lst_temp[i].ToString()); } } gb_open_prj.Visible = true; }
public void update_list_with_plans() { System.Collections.ObjectModel.Collection<string> lst_temp2 = new System.Collections.ObjectModel.Collection<string>(); cls_main main_func = new cls_main(); combo_plans.Items.Clear(); lst_temp2 = main_func.get_files_indir(plans_dir); for (int i = 0; i < lst_temp2.Count; i++) { if (main_func.get_extention(lst_temp2[i].ToString()) == "xml") { combo_plans.Items.Add(lst_temp2[i]); } } }
void read_style(string style_name) { cls_main main_func= new cls_main(); lbl_style_preview_desk.Visible = false; lbl_style_preview_cap.Visible = false; lst_style_preview_list.Visible = false; System.Collections.ObjectModel.Collection<string> lst_temp1 = new System.Collections.ObjectModel.Collection<string>(); lst_temp1 = main_func.read_textfile_by_line(appdir + "Styles\\disk_styles\\" + style_name + "\\previews.info"); if (lst_temp1.Count > 0) { lst_style_preview_filename.Clear(); lst_style_preview_list.Items.Clear(); lbl_style_preview_desk.Visible=true; lbl_style_preview_cap.Visible=true; lst_style_preview_list.Visible=true; for (int i = 0; i < lst_temp1.Count; i++) { string s_temp = lst_temp1[i].ToString(); string[] str_temp = s_temp.Split(Convert.ToChar("|")); lst_style_preview_list.Items.Add(str_temp[0].ToString()); lst_style_preview_filename.Add(main_func.ReplaceAll(str_temp[1].ToString()," ","")); } } // System.Collections.ObjectModel.Collection<string> lst_temp2 = new System.Collections.ObjectModel.Collection<string>(); lst_temp2 = main_func.read_textfile_by_line(appdir + "Styles\\disk_styles\\" + style_name + "\\style.info"); if (lst_temp2.Count > 0) { string name = ""; string date = ""; string author = ""; string desc = ""; 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 "name": name = str_temp[1].ToString(); break; case "date": date = str_temp[1].ToString(); break; case "author": author = str_temp[1].ToString(); break; case "description": desc = str_temp[1].ToString(); break; } } lbl_style_desk.Text = name + " [" + date + "]" + "\n" + "Автор: " + author + "\n" + "Описание: " + desc; } else { lbl_style_desk.Text = "Описание отсутствует."; } disk_style = style_name; }
public void save_project(string prj_name) { cls_main main_func = new cls_main(); main_func.clear_lst_to_file(); //write PRJ file main_func.clear_lst_to_file(); main_func.add_to_lst_to_file("version=" + prj_version); main_func.add_to_lst_to_file("prj_name=" + prj_open_name); main_func.add_to_lst_to_file("prj_create_date=" + prj_create_date); main_func.add_to_lst_to_file("[PRJ SETTINGS]"); main_func.add_to_lst_to_file("prj_disk_name=" + txt_disk_name.Text); main_func.add_to_lst_to_file("prj_author_name=" + txt_author_name.Text); main_func.add_to_lst_to_file("prj_licence_type=" + combo_licence.Text); main_func.add_to_lst_to_file("prj_licence=" + txt_licence_path.Text); main_func.add_to_lst_to_file("prj_licence_enabled=" + check_licence.Checked.ToString()); main_func.add_to_lst_to_file("prj_disk_style=" + disk_style); main_func.add_to_lst_to_file("prj_splash_path=" + txt_splash_path.Text); main_func.add_to_lst_to_file("prj_disk_volume_label=" + textBoxLabel.Text); main_func.add_to_lst_to_file("prj_splash_type=" + combo_splash.Text); main_func.add_to_lst_to_file("prj_create_autorun_inf=" + chk_create_autorun_inf.Checked.ToString()); main_func.add_to_lst_to_file("prj_student_profession=" + txt_profession.Text); main_func.add_to_lst_to_file("prj_student_specialization=" + txt_specialization.Text); main_func.add_to_lst_to_file("prj_student_year=" + txt_year.Text); main_func.add_to_lst_to_file("prj_eplan=" + combo_plans.Text); main_func.add_to_lst_to_file("prj_student_total_year=" + txt_total_year.Text); main_func.add_to_lst_to_file("prj_copy_service=" + chk_service_enabled.Checked.ToString()); main_func.add_to_lst_to_file("prj_create_search=" + chk_search_enabled.Checked.ToString()); main_func.add_to_lst_to_file("prj_glass_enabled=" + chk_glass_enabled.Checked.ToString()); main_func.add_to_lst_to_file("prj_ziptests_enabled=" + chk_zip_tests_enabled.Checked.ToString()); main_func.add_to_lst_to_file("prj_convert_files_to=" + combo_convert_to.Text); main_func.add_to_lst_to_file("[DISK_MENU_SETTINGS]"); main_func.add_to_lst_to_file("prj_menu_edu_caption=" + txt_menu_edu.Text); main_func.add_to_lst_to_file("prj_menu_edu_type=" + combo_menu_edu.Text); main_func.add_to_lst_to_file("prj_menu_edu_path=" + txt_menu_edu_path.Text); main_func.add_to_lst_to_file("prj_menu_control_caption=" + txt_menu_control.Text); main_func.add_to_lst_to_file("prj_menu_control_type=" + combo_menu_control.Text); main_func.add_to_lst_to_file("prj_menu_control_path=" + txt_menu_control_path.Text); main_func.add_to_lst_to_file("prj_menu_about_caption=" + txt_menu_about.Text); main_func.add_to_lst_to_file("prj_menu_about_type=" + combo_menu_about.Text); main_func.add_to_lst_to_file("prj_menu_about_path=" + txt_menu_about_path.Text); main_func.add_to_lst_to_file("prj_menu_help_type=" + combo_menu_help.Text); main_func.add_to_lst_to_file("prj_menu_help_path=" + txt_menu_help_path.Text); main_func.add_to_lst_to_file("splash_enabled=" + chk_splash_enabled.Checked.ToString()); main_func.add_to_lst_to_file("help_enabled=" + chk_help_enabled.Checked.ToString()); main_func.add_to_lst_to_file("umk_enabled=" + chk_edu_enabled.Checked.ToString()); main_func.add_to_lst_to_file("test_enabled=" + chk_control_enabled.Checked.ToString()); main_func.add_to_lst_to_file("about_enabled=" + chk_about_enabled.Checked.ToString()); main_func.write_to_info_file(prj_folder + prj_name + "\\index.prj"); //write BUILD information main_func.clear_lst_to_file(); main_func.add_to_lst_to_file("prj_is_built=" + prj_IS_built.ToString()); main_func.add_to_lst_to_file("prj_build_date=" + prj_build_date); main_func.write_to_info_file(prj_folder + prj_name + "\\build.info"); }
System.Collections.ObjectModel.Collection<string> open_plan(string plan_name) { System.Collections.ObjectModel.Collection<string> lst_temp = new System.Collections.ObjectModel.Collection<string>(); cls_main main_func = new cls_main(); string s_temp = ""; FileStream fs = new FileStream(plans_dir + "\\" + plan_name, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); System.Xml.XmlDocument CXML = new System.Xml.XmlDocument(); try { CXML.Load(fs); for (int i = 0; i < CXML.DocumentElement.ChildNodes.Count; i++) { s_temp = CXML.DocumentElement.ChildNodes[i].Attributes[0].Value.ToString() + ";" + CXML.DocumentElement.ChildNodes[i].Attributes[1].Value.ToString() + ";" + CXML.DocumentElement.ChildNodes[i].InnerText + ";" + CXML.DocumentElement.ChildNodes[i].Attributes[2].Value.ToString(); lst_temp.Add(s_temp); } } catch { }; fs.Close(); return lst_temp; }
/// <summary> /// Initialize the form /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MainForm_Load(object sender, EventArgs e) { cls_main main_func = new cls_main(); if (main_func.check_for_components(false)) { if (!File.Exists(appdir + "umk_manager_08.exe")) { pict_mngr.Visible = false; }; if (Directory.Exists(appdir + "system\\service") == false) { chk_service_enabled.Enabled = false; } else { chk_service_enabled.Enabled = true; } main_func.create_registry(); prj_exist = true; umk_folder = main_func.get_value_from_infofile(appdir + "configs\\settings.ini", "umk_folder"); if (umk_folder == "") { MessageBox.Show("УМК не найдены. Запустите УМК Менеджер, чтобы указать правильный путь к директории с УМК.", "УМК не найдены!", MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); } else { if (Microsoft.VisualBasic.Strings.Right(umk_folder, 1)== "\\") { umk_folder = Microsoft.VisualBasic.Strings.Left(umk_folder, umk_folder.Length-1); }; if (Microsoft.VisualBasic.Strings.Left(umk_folder, 6) == "APPDIR") { umk_folder = main_func.ReplaceAll(umk_folder, "APPDIR\\", appdir); } } clear_form(); show_dg_open(); if (Environment.OSVersion.Version.Major > 5) { MsftDiscMaster2 discMaster = null; try { discMaster = new MsftDiscMaster2(); if (!discMaster.IsSupportedEnvironment) return; foreach (string uniqueRecorderID in discMaster) { MsftDiscRecorder2 discRecorder2 = new MsftDiscRecorder2(); discRecorder2.InitializeDiscRecorder(uniqueRecorderID); devicesComboBox.Items.Add(discRecorder2); } if (devicesComboBox.Items.Count > 0) { devicesComboBox.SelectedIndex = 0; } } catch (COMException ex) { MessageBox.Show(ex.Message, string.Format("Error:{0} - Пожалуйста, установите IMAPI2", ex.ErrorCode), MessageBoxButtons.OK, MessageBoxIcon.Stop); return; } finally { if (discMaster != null) { Marshal.ReleaseComObject(discMaster); } } // // Create the volume label based on the current date // DateTime now = DateTime.Now; textBoxLabel.Text = now.Year + "_" + now.Month + "_" + now.Day; labelStatusText.Text = string.Empty; labelFormatStatusText.Text = string.Empty; // // Select no verification, by default // comboBoxVerification.SelectedIndex = 0; UpdateCapacity(); } else { devicesComboBox.Visible = false; label43.Visible = false; MessageBox.Show("В данной версии ОС некоторые функции программы будут недоступны!", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { Application.Exit(); } }
private void btn_add_splash_Click(object sender, EventArgs e) { cls_main main_func = new cls_main(); if (combo_splash.Text == "image") { file_dialog.Title = "Укажите файл с картинкой"; file_dialog.DefaultExt = "*.png"; file_dialog.Filter = "PNG файлы (*.png)|*.png|JPEG файлы (*.jpg)|*.jpg"; } else { file_dialog.Title = "Укажите файл со страницей"; file_dialog.DefaultExt = "*.htm"; file_dialog.Filter = "HTML страница (*.htm)|*.htm|HTML страница (*.html)|*.html"; }; DialogResult result = file_dialog.ShowDialog(); if (result == DialogResult.OK) { if (combo_splash.Text == "image") { File.Copy(file_dialog.FileName, appdir + "Projects\\" + prj_open_name + "\\temp\\splash\\splash." + main_func.get_extention(file_dialog.FileName), true); } else { File.Copy(file_dialog.FileName, appdir + "Projects\\" + prj_open_name + "\\temp\\splash\\splash." + main_func.get_extention(file_dialog.FileName), true); main_func.DirectoryCopy(main_func.get_path(file_dialog.FileName) + main_func.get_filename_without_ex(file_dialog.FileName) + "_files", appdir + "Projects\\" + prj_open_name + "\\temp\\splash\\splash_files", true); } txt_splash_path.Text = "splash." + main_func.get_extention(file_dialog.FileName); } }
void open_plan(string plan_name) { cls_main main_func = new cls_main(); clear_form(); string s_temp=""; FileStream fs = new FileStream(plans_dir + "\\" + plan_name, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); System.Xml.XmlDocument CXML = new System.Xml.XmlDocument(); try { CXML.Load(fs); for (int i = 0; i < CXML.DocumentElement.ChildNodes.Count; i++) { s_temp = CXML.DocumentElement.ChildNodes[i].Attributes[0].Value.ToString() + ";" + CXML.DocumentElement.ChildNodes[i].Attributes[1].Value.ToString() + ";" + CXML.DocumentElement.ChildNodes[i].InnerText + ";" + CXML.DocumentElement.ChildNodes[i].Attributes[2].Value.ToString(); lst_all_umk.Add(s_temp); } } catch { }; fs.Close(); plan_isOpen=true; plan_open_name=main_func.get_filename_without_ex( plan_name); selected_level=0; show_gb_edit_plan(); }
private void add_other_files_Click(object sender, EventArgs e) { cls_main main_func = new cls_main(); file_dialog.Title = "Добавление файла"; file_dialog.DefaultExt = "*.*"; DialogResult result = file_dialog.ShowDialog(); if (result == DialogResult.OK) { string[] row1 = { main_func.get_filename(file_dialog.FileName), "файл", main_func.get_path(file_dialog.FileName) }; // dg_prj_files.Rows.Add(row1); } }
void save_u_plan(string plan_name) { sort_data_in_plan(); string full_plan_name = plan_name + ".xml"; cls_main main_func = new cls_main(); System.Xml.XmlDocument CXML = new System.Xml.XmlDocument(); if (File.Exists(plans_dir + "\\" + full_plan_name) == true) { File.Delete(plans_dir + "\\" + full_plan_name); } // Write down the XML declaration XmlDeclaration xmlDeclaration = CXML.CreateXmlDeclaration("1.0", "utf-8", null); // Create the root element XmlElement rootNode = CXML.CreateElement("eplan"); CXML.InsertBefore(xmlDeclaration, CXML.DocumentElement); CXML.AppendChild(rootNode); //adding new nodes if (lst_all_umk.Count > 0) { for (int i = 0; i < lst_all_umk.Count; i++) { string s_temp = lst_all_umk[i]; if (s_temp != "") { string[] str_temp = s_temp.Split(Convert.ToChar(";")); if (str_temp.GetUpperBound(0) > 0) { XmlElement newitem = CXML.CreateElement("unit"); newitem.InnerText = str_temp[2]; XmlAttribute xmlat1 = CXML.CreateAttribute("name"); xmlat1.InnerText = str_temp[0]; XmlAttribute xmlat2 = CXML.CreateAttribute("code"); xmlat2.InnerText = str_temp[1]; XmlAttribute xmlat3 = CXML.CreateAttribute("year"); xmlat3.InnerText = str_temp[3]; newitem.Attributes.Append(xmlat1); newitem.Attributes.Append(xmlat2); newitem.Attributes.Append(xmlat3); CXML.DocumentElement.InsertAfter(newitem, CXML.DocumentElement.LastChild); } } } } // Save to the XML file CXML.Save(plans_dir + "\\" + full_plan_name); }
private void add_other_folder_Click(object sender, EventArgs e) { cls_main main_func = new cls_main(); fldr_dialog.ShowNewFolderButton = false; fldr_dialog.SelectedPath = ""; DialogResult result= fldr_dialog.ShowDialog(); if (result == DialogResult.OK) { string[] row1 = { main_func.get_filename(fldr_dialog.SelectedPath), "папка", Microsoft.VisualBasic.Strings.Left(fldr_dialog.SelectedPath,Microsoft.VisualBasic.Strings.Len(fldr_dialog.SelectedPath)- Microsoft.VisualBasic.Strings.Len(main_func.get_filename(fldr_dialog.SelectedPath)) ) }; //dg_prj_files.Rows.Add(row1); //System.Collections.ObjectModel.Collection<string> lst_temp = new System.Collections.ObjectModel.Collection<string>(); //lst_temp = main_func.get_dir(fldr_dialog.SelectedPath); //if (lst_temp.Count != 0) // { // if (lst_temp.Count > 1) // { // string[] row2 = { main_func.get_filename(lst_temp[0].ToString()), "папка", fldr_dialog.SelectedPath }; // dg_prj_files.Rows.Add(row2); // for (int i = 0; i < lst_temp.Count; i++) // { // string[] row1 = { lst_temp[i].ToString(), "папка", fldr_dialog.SelectedPath }; // dg_prj_files.Rows.Add(row1); // } // } // if (dg_prj_files.Rows.Count > 0) // { // DirectoryItem directoryItem = new DirectoryItem(fldr_dialog.SelectedPath); // listBoxFiles.Items.Add(directoryItem); // UpdateCapacity(); // EnableBurnButton(); // } // } } }
private void add_umk_Click(object sender, EventArgs e) { win_add_umk window_umk = new win_add_umk(); System.Collections.ObjectModel.Collection<string> return_lst = new System.Collections.ObjectModel.Collection<string>(); System.Collections.ObjectModel.Collection<string> return_lst1 = new System.Collections.ObjectModel.Collection<string>(); System.Collections.ObjectModel.Collection<string> return_lst2 = new System.Collections.ObjectModel.Collection<string>(); cls_main main_func = new cls_main(); window_umk.change_vars(umk_folder); window_umk.ShowDialog(); //if (window_umk.selected_path != "") //{ if (window_umk.selected_level == 2) { //if (if_cell_ISexists(2, window_umk.selected_path + "\\" + window_umk.selected_obj) != true) //{ string[] row1 = { window_umk.selected_obj, main_func.get_value_from_infofile(umk_folder + "\\" + window_umk.selected_path + "\\" + window_umk.selected_obj + "\\info.dat", "code"), window_umk.selected_path + "\\" + window_umk.selected_obj }; dg_prj_files.Rows.Add(row1); //} } else { if (window_umk.selected_level == 0) { return_lst.Clear(); return_lst1.Clear(); return_lst = main_func.get_dir(umk_folder + window_umk.selected_path + "\\" + window_umk.selected_obj); if (return_lst.Count > 0) { for (int i = 0; i < return_lst.Count; i++) { return_lst1 = main_func.get_dir(umk_folder + window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i]); if (return_lst1.Count > 0) { for (int j = 0; j < return_lst1.Count; j++) { //if (if_cell_ISexists(2, window_umk.selected_obj + "\\" + return_lst[i] + "\\" + return_lst1[j]) != true) //{ string[] row1 = { return_lst1[j], main_func.get_value_from_infofile(umk_folder + window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i] + "\\" + return_lst1[j] + "\\info.dat", "code"), window_umk.selected_obj + "\\" + return_lst[i] + "\\" + return_lst1[j] }; dg_prj_files.Rows.Add(row1); //} } } } } } else { return_lst.Clear(); return_lst = main_func.get_dir(umk_folder + "\\" + window_umk.selected_path + "\\" + window_umk.selected_obj); if (return_lst.Count > 0) { for (int i = 0; i < return_lst.Count; i++) { //if (if_cell_ISexists(2, window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i]) != true) //{ string[] row1 = { return_lst[i], main_func.get_value_from_infofile(umk_folder + "\\" + window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i] + "\\info.dat", "code"), window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i] }; dg_prj_files.Rows.Add(row1); //} } } } } //} update_level_files(selected_level); }
private void add_umk_files_Click(object sender, EventArgs e) { win_add_umk window_umk = new win_add_umk(); System.Collections.ObjectModel.Collection<string> return_lst = new System.Collections.ObjectModel.Collection<string>(); System.Collections.ObjectModel.Collection<string> return_lst1 = new System.Collections.ObjectModel.Collection<string>(); System.Collections.ObjectModel.Collection<string> return_lst2 = new System.Collections.ObjectModel.Collection<string>(); cls_main main_func = new cls_main(); window_umk.change_vars(umk_folder); window_umk.ShowDialog(); if (window_umk.selected_path != "") { /*if (window_umk.selected_level == 3) { string[] row1 = { window_umk.selected_obj, "файл", window_umk.selected_path + "\\" }; dg_prj_files.Rows.Add(row1); }*/ if (window_umk.selected_level == 2) { string[] row1 = { window_umk.selected_obj, "папка", window_umk.selected_path + "\\" }; //dg_prj_files.Rows.Add(row1); } else { if (window_umk.selected_level == 0) { return_lst.Clear(); return_lst1.Clear(); return_lst = main_func.get_dir(window_umk.selected_path + "\\" + window_umk.selected_obj); if (return_lst.Count > 0) { for (int i = 0; i < return_lst.Count; i++) { return_lst1 = main_func.get_dir(window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i]); if (return_lst1.Count > 0) { for (int j = 0; j < return_lst1.Count; j++) { string[] row1 = { return_lst1[j], "папка", window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" + return_lst[i] + "\\"}; //dg_prj_files.Rows.Add(row1); } } } } } else { return_lst.Clear(); return_lst = main_func.get_dir(window_umk.selected_path + "\\" + window_umk.selected_obj); if (return_lst.Count > 0) { for (int i = 0; i < return_lst.Count; i++) { string[] row1 = { return_lst[i], "папка", window_umk.selected_path + "\\" + window_umk.selected_obj + "\\" }; //dg_prj_files.Rows.Add(row1); } } } } } }
private void win_add_umk_Load(object sender, EventArgs e) { System.Collections.ObjectModel.Collection<string> return_lst = new System.Collections.ObjectModel.Collection<string>(); cls_main main_func=new cls_main(); // umk_level = 0; lbl_name.Text = "Выберите подразделение."; show_path(""); // return_lst = main_func.get_dir(umk_dir); //if (return_lst.Count > 0) //{ // for (int i = 0; i < return_lst.Count-1; i++) // { // lst_files.Items.Add(return_lst[i]); // } // } }
private void btn_add_disk_icon_Click(object sender, EventArgs e) { cls_main main_func = new cls_main(); file_dialog.Title = "Укажите файл с иконкой"; file_dialog.DefaultExt = "*.ico"; file_dialog.Filter = "ICO файлы (*.ico)|*.ico"; DialogResult result = file_dialog.ShowDialog(); if (result == DialogResult.OK) { File.Copy(file_dialog.FileName, appdir + "Projects\\" + prj_open_name + "\\temp\\autorun\\disk_icon.ico", true); pic_disk_icon.Load(prj_folder + prj_open_name + "\\temp\\autorun\\disk_icon.ico"); } }