public void MakeCopy(bool clear)
        {
            try
            {
                if (lbMainList.SelectedIndex < 0)
                {
                    return;
                }
                string src_name = (string)lbMainList.Items[lbMainList.SelectedIndex];
                src_name = src_name.Trim();
                string name = util.StringDialog.GetString(MainForm.MForm, Common.MLS.Get(MLSConst, "Создание копии"),
                                                          Common.MLS.Get(MLSConst, "Введите имя для пустой копии методики: ") + src_name, "", true);
                if (name == null)
                {
                    return;
                }
                string base_folder = Folder.GetPath() + src_name + "." + DbFDriver.ElementExt;
                base_folder = Common.Db.GetFoladerPath(base_folder);
                src_name    = base_folder + "\\method";
                if (File.Exists(src_name) == false)
                {
                    return;
                }
                Folder.CreateFolder(name + "." + DbFDriver.ElementExt);
                string dest_folder = Folder.GetPath() + name + "." + DbFDriver.ElementExt;
                dest_folder = Common.Db.GetFoladerPath(dest_folder);

                if (clear)
                {
                    File.Copy(src_name, dest_folder + "\\method");
                    MethodSimple ms = new MethodSimple(name + "\\method");
                    ms.ClearProbRecords();
                    ms.Save();
                }
                else
                {
                    string[] list = Directory.GetFiles(base_folder);
                    for (int i = 0; i < list.Length; i++)
                    {
                        int    ind   = list[i].LastIndexOf('\\');
                        string fname = list[i].Substring(ind + 1);
                        if (!(fname.EndsWith(".sf") || fname.EndsWith(".ss") || fname.IndexOf("method") == 0))
                        {
                            continue;
                        }
                        File.Copy(list[i], dest_folder + "\\" + fname);
                    }
                }

                ReloadList();
                ReIntiTree();
            }
            catch (Exception ex)
            {
                Common.Log(ex);
            }
        }
예제 #2
0
        public Spectr GetSpectr()
        {
            string path = Folder.GetPath() + SpName;

            if (Spectr.IsFileExists(path))
            {
                return(new Spectr(path));
            }
            return(null);
        }
        public void Select(TreeNode node, bool select)
        {
            TaskControlContainer tcc = (TaskControlContainer)node.Tag;

            Folder      = tcc.Folder;
            PathLb.Text = Folder.GetPath();
            Node        = node;//tcc.ParentNode;
            ReloadList();
        }