示例#1
0
 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();
 }
示例#2
0
 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;
 }
示例#3
0
        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;
               }
        }
示例#4
0
 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]);
         }
     }
 }