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; }
/// <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(); } }