Esempio n. 1
0
        /// <summary>
        /// 读取目录
        /// </summary>
        public void ReadDir(string type)
        {
            try
            {
                ParRecover.P_I.g_BaseParRecoverDir_L.Clear();
                DirectoryInfo rootInfo = new DirectoryInfo(FunBackup.F_I.RootBackup);

                foreach (DirectoryInfo dirRoot in rootInfo.GetDirectories())
                {
                    string path = dirRoot.FullName + "\\";
                    path += type;

                    if (!Directory.Exists(path))
                    {
                        continue;
                    }
                    DirectoryInfo pathInfo = new DirectoryInfo(path);

                    foreach (DirectoryInfo item in pathInfo.GetDirectories())
                    {
                        BaseParRecoverDir inst = new BaseParRecoverDir();
                        inst.Date       = dirRoot.Name;
                        inst.Time       = item.Name;
                        inst.Path       = item.FullName;
                        inst.Reason     = ReadExplain(item.FullName)[2] + ":" + ReadExplain(item.FullName)[0];
                        inst.PathSource = ReadExplain(item.FullName)[1];
                        ParRecover.P_I.g_BaseParRecoverDir_L.Add(inst);
                    }
                }

                for (int i = 0; i < ParRecover.P_I.g_BaseParRecoverDir_L.Count; i++)
                {
                    ParRecover.P_I.g_BaseParRecoverDir_L[i].No = i + 1;
                }

                //如果有备份文件夹,显示文件
                if (ParRecover.P_I.g_BaseParRecoverDir_L.Count > 0)
                {
                    ReadFile(ParRecover.P_I.g_BaseParRecoverDir_L[0], type);
                }
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
            }
            finally
            {
                ShowDir();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 读取文件参数
        /// </summary>
        public virtual void ReadFile(BaseParRecoverDir baseParRecoverDir, string type)
        {
            try
            {
                new Task(new Action(() =>
                {
                    ParRecover.P_I.g_BaseParRecoverFile_L.Clear();
                    if (baseParRecoverDir == null)
                    {
                        return;
                    }

                    string path = baseParRecoverDir.Path + "\\" + type + ".ini";
                    Adjust_Temp_L.Clear();

                    string typeSection = "adj";

                    //edit by xc-190401,增加两个选择
                    switch (type)
                    {
                    case "Adjust":
                        typeSection = "adj";
                        break;

                    case "Std":
                        typeSection = "std";
                        break;

                    case "RobotStd":
                        typeSection = "rpstd";
                        break;

                    case "RobotAdj":
                        typeSection = "rpadj";
                        break;
                    }

                    for (int i = 0; i < 18; i++)
                    {
                        string section = typeSection + (i + 1).ToString();
                        double value1  = IniFile.I_I.ReadIniDbl(section, "Value1", path);
                        double value2  = IniFile.I_I.ReadIniDbl(section, "Value2", path);
                        double value3  = IniFile.I_I.ReadIniDbl(section, "Value3", path);
                        string anno    = IniFile.I_I.ReadIniStr(section, "Annotation", path);
                        Adjust_Temp_L.Add(new Adjust_Temp()
                        {
                            No         = i,
                            Name       = section,
                            Value1     = value1,
                            Value2     = value2,
                            Value3     = value3,
                            Annotation = anno,
                        });
                    }

                    //显示文件
                    ShowFile();
                })).Start();
            }
            catch (Exception ex)
            {
                Log.L_I.WriteError(NameClass, ex);
            }
        }