示例#1
0
        public DevCurve(IniDocument ini, CurveGroup grp, int index)
        {
            this.Group = grp;
            this.Index = index;
            string section = grp.Name + "\\" + (index + 1);

            this.Name = ini.GetString(section, "设备名称");
            if (string.IsNullOrEmpty(this.Name))
            {
                return;
            }
            if (this.Name.ToUpper() == "DUMMY")
            {
                return;
            }

            this.ADMax = grp.ADMax;
            this.ADMin = grp.ADMin;

            float limit = ini.GetFloat(section, "AD最小", float.NaN);

            if (float.IsNaN(limit) == false)
            {
                this.ADMin = limit;
            }
            limit = ini.GetFloat(section, "AD最大", float.NaN);
            if (float.IsNaN(limit) == false)
            {
                this.ADMax = limit;
            }

            this.Tag = ini.GetInt(grp.Name + "\\" + (index + 1), "标志", 0);

            this.TimeInterval = grp.TimeInterval;
            float  interval = ini.GetFloat(grp.Name + "\\" + (index + 1), "时间间隔", float.NaN);
            string monitor  = ini.GetString(grp.Name + "\\" + (index + 1), "室外监测类型");

            this.MonitorType = SignalType.SignalACCurve;
            if (monitor == "直流道岔")
            {
                this.MonitorType = SignalType.SignalDCCurve;
            }
            if (float.IsNaN(interval) == false)
            {
                this.TimeInterval = interval;
            }



            this.IsValid = true;
        }
示例#2
0
        private void Load(string fileName)
        {
            if (File.Exists(fileName) == false)
            {
                if (File.Exists(fileName) == false)
                {
                    Assembly         assembly  = this.GetType().Assembly;
                    System.IO.Stream smEmbeded = assembly.GetManifestResourceStream("ConfigManager.Config.记录曲线.rhhcfg");


                    byte[] data = new byte[smEmbeded.Length];

                    smEmbeded.Read(data, 0, data.Length);


                    //建立目录

                    string dir = Path.GetDirectoryName(fileName);
                    if (Directory.Exists(dir) == false)
                    {
                        Directory.CreateDirectory(dir);
                    }


                    File.WriteAllBytes(fileName, data);


                    smEmbeded.Close();
                }
            }
            IniDocument ini = new IniDocument();

            ini.Load(fileName);
            int num = ini.GetInt("记录曲线类型", "数目", 0);

            for (int i = 0; i < num; i++)
            {
                CurveGroup grp = new CurveGroup(ini, i);
                if (grp.IsValid == false)
                {
                    continue;
                }

                if (dicCurveGrp.ContainsKey(grp.Name) == false)
                {
                    dicCurveGrp.Add(grp.Name, grp);
                }
            }
        }
示例#3
0
        private void Load(string fileName)
        {
            if (File.Exists(fileName) == false)
             {
                 if (File.Exists(fileName) == false)
                 {
                     Assembly assembly = this.GetType().Assembly;
                     System.IO.Stream smEmbeded = assembly.GetManifestResourceStream("ConfigManager.Config.记录曲线.rhhcfg");

                     byte[] data = new byte[smEmbeded.Length];

                     smEmbeded.Read(data, 0, data.Length);

                     //建立目录

                     string dir = Path.GetDirectoryName(fileName);
                     if (Directory.Exists(dir) == false)
                     {
                         Directory.CreateDirectory(dir);
                     }

                     File.WriteAllBytes(fileName, data);

                     smEmbeded.Close();
                 }
             }
             IniDocument ini = new IniDocument();
             ini.Load(fileName);
             int num = ini.GetInt("记录曲线类型", "数目", 0);
             for (int i = 0; i < num; i++)
             {
                 CurveGroup grp = new CurveGroup(ini, i);
                 if (grp.IsValid == false) continue;

                 if (dicCurveGrp.ContainsKey(grp.Name) == false)
                 {
                     dicCurveGrp.Add(grp.Name, grp);
                 }
             }
        }