public DevAnalogGrp(IniDocument docIni, int index) { string name = docIni.GetString("模拟量类型", (index+1).ToString()); if (string.IsNullOrEmpty(name)) return; this.Name = name; int type = docIni.GetInt(name, "类型",0); if (type <= 0) return; this.Type = type; this.Unit = docIni.GetString(name, "单位"); int analogNum = docIni.GetInt(name, "数目", 0); float val = docIni.GetFloat(name, "AD最小", float.NaN); this.ADMin = float.IsNaN(val) ? 0 : val; val = docIni.GetFloat(name, "AD最大", float.NaN); this.ADMax = float.IsNaN(val) ? 0 : val; for (int i = 0; i < analogNum; i++) { DevAnalog analog = new DevAnalog(docIni,this,i); if (analog.IsValid) { if (dicAnalog.ContainsKey(analog.Name) == false) { dicAnalog.Add(analog.Name, analog); } } } if (dicAnalog.Count <= 0) return; this.IsValid = true; }
public HHDeviceGrp(IniDocument ini, int index) { string name = ini.GetString("设备", (index + 1).ToString()); if (string.IsNullOrEmpty(name)) return; this.DevType = ini.GetInt(name, "设备类型", 0); if (this.DevType <= 0) return; this.Name = name; int propNum = ini.GetInt(name, "属性数目", 0); if (propNum <= 0) return; int devNum = ini.GetInt(name, "设备数目", 0); if (devNum <= 0) return; for (int i = 0; i < propNum; i++) { HHDeviceProperty prop = new HHDeviceProperty(ini, this, i); if (prop.IsValid) { listProperty.Add(prop); if (prop.Type == "模拟量") { listAnalogProperty.Add(prop); } else if (prop.Type == "曲线") { listCurveProperty.Add(prop); } } } if (this.DevType != 4 && this.DevType != 8) { if (listProperty.Count <= 0) return; } if (listAnalogProperty.Count > 0) { SelectProperty(0, true); } for (int i = 0; i < devNum; i++) { HHDevice device = new HHDevice(ini, i, this); if (device.IsValid) { listDevice.Add(device); } } this.BuildGroup(); this.Level = 1; this.IsValid = true; }
public CurveGroup(IniDocument docIni, int index) { this.Name = docIni.GetString("记录曲线类型", (index + 1).ToString()); if (string.IsNullOrEmpty(Name)) { return; } this.Type = docIni.GetInt(this.Name, "类型", 0); if (this.Type <= 0) { return; } this.TimeInterval = docIni.GetFloat(this.Name, "时间间隔", 0); float limit = docIni.GetFloat(this.Name, "AD最小", float.NaN); if (float.IsNaN(limit) == false) { this.ADMin = limit; } limit = docIni.GetFloat(this.Name, "AD最大", float.NaN); if (float.IsNaN(limit) == false) { this.ADMax = limit; } int curveNum = docIni.GetInt(this.Name, "数目", 0); for (int i = 0; i < curveNum; i++) { DevCurve curve = new DevCurve(docIni, this, i); if (curve.IsValid) { if (dicCurve.ContainsKey(curve.Name) == false) { List <DevCurve> listCurve = new List <DevCurve>(); listCurve.Add(curve); dicCurve.Add(curve.Name, listCurve); } else { dicCurve[curve.Name].Add(curve); } } } if (dicCurve.Count <= 0) { return; } this.IsValid = true; }
public DevAnalogGrp(IniDocument docIni, int index) { string name = docIni.GetString("模拟量类型", (index + 1).ToString()); if (string.IsNullOrEmpty(name)) { return; } this.Name = name; int type = docIni.GetInt(name, "类型", 0); if (type <= 0) { return; } this.Type = type; this.Unit = docIni.GetString(name, "单位"); int analogNum = docIni.GetInt(name, "数目", 0); float val = docIni.GetFloat(name, "AD最小", float.NaN); this.ADMin = float.IsNaN(val) ? 0 : val; val = docIni.GetFloat(name, "AD最大", float.NaN); this.ADMax = float.IsNaN(val) ? 0 : val; for (int i = 0; i < analogNum; i++) { DevAnalog analog = new DevAnalog(docIni, this, i); if (analog.IsValid) { if (dicAnalog.ContainsKey(analog.Name) == false) { dicAnalog.Add(analog.Name, analog); } } } if (dicAnalog.Count <= 0) { return; } this.IsValid = true; }
public CurveGroup(IniDocument docIni, int index) { this.Name = docIni.GetString("记录曲线类型", (index + 1).ToString()); if (string.IsNullOrEmpty(Name)) return; this.Type = docIni.GetInt(this.Name, "类型", 0); if (this.Type <= 0) return; this.TimeInterval = docIni.GetFloat(this.Name, "时间间隔", 0); float limit = docIni.GetFloat(this.Name, "AD最小", float.NaN); if (float.IsNaN(limit) == false) { this.ADMin = limit; } limit = docIni.GetFloat(this.Name, "AD最大", float.NaN); if (float.IsNaN(limit) == false) { this.ADMax = limit; } int curveNum = docIni.GetInt(this.Name, "数目", 0); for (int i = 0; i < curveNum; i++) { DevCurve curve = new DevCurve(docIni, this, i); if (curve.IsValid) { if (dicCurve.ContainsKey(curve.Name) == false) { List<DevCurve> listCurve = new List<DevCurve>(); listCurve.Add(curve); dicCurve.Add(curve.Name, listCurve); } else { dicCurve[curve.Name].Add(curve); } } } if (dicCurve.Count <= 0) return; this.IsValid = true; }
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; }
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); } } }
/// <summary> /// Loads application config file. /// </summary> public static void Load() { int width, height; try { using (var file = new StreamReader(IniFilePath, Encoding.UTF8)) Ini.Load(file); int fontSize = Ini.GetInt("Default", "FontSize", 1, Int32.MaxValue, FontInfo.Size); string fontName = Ini.Get("Default", "Font", FontInfo.Name); width = Ini.GetInt("Default", "WindowWidth", 100, Int32.MaxValue, WindowSize.Width); height = Ini.GetInt("Default", "WindowHeight", 100, Int32.MaxValue, WindowSize.Height); AppConfig.FontInfo = new FontInfo(fontName, fontSize, FontStyle.Regular); AppConfig.WindowSize = new Size(width, height); AppConfig.WindowMaximized = Ini.Get("Default", "WindowMaximized", false); AppConfig.TabPanelEnabled = Ini.Get("Default", "TabPanelEnabled", false); AppConfig.UseScreenLineNumber = Ini.Get("Default", "UseScreenLineNumber", false); AppConfig.DrawsEolCode = Ini.Get("Default", "DrawsEolCode", true); AppConfig.DrawsFullWidthSpace = Ini.Get("Default", "DrawsFullWidthSpace", true); AppConfig.DrawsSpace = Ini.Get("Default", "DrawsSpace", true); AppConfig.DrawsTab = Ini.Get("Default", "DrawsTab", true); AppConfig.DrawsEofMark = Ini.Get("Default", "DrawsEofMark", false); AppConfig.HighlightsCurrentLine = Ini.Get("Default", "HighlightsCurrentLine", true); AppConfig.HighlightsMatchedBracket = Ini.Get("Default", "HighlightsMatchedBracket", true); AppConfig.ShowsLineNumber = Ini.Get("Default", "ShowsLineNumber", true); AppConfig.ShowsHRuler = Ini.Get("Default", "ShowsHRuler", false); AppConfig.ShowsDirtBar = Ini.Get("Default", "ShowsDirtBar", false); AppConfig.TabWidth = Ini.GetInt("Default", "TabWidth", 0, 100, 8); AppConfig.LinePadding = Ini.GetInt("Default", "LinePadding", 1, 100, 1); AppConfig.LeftMargin = Ini.GetInt("Default", "LeftMargin", 0, 100, 1); AppConfig.TopMargin = Ini.GetInt("Default", "TopMargin", 0, 100, 1); AppConfig.ViewType = Ini.Get("Default", "ViewType", ViewType.Proportional); AppConfig.UsesTabForIndent = Ini.Get("Default", "UsesTabForIndent", true); AppConfig.UnindentsWithBackspace = Ini.Get("Default", "UnindentsWithBackspace", false); AppConfig.ConvertsFullWidthSpaceToSpace = Ini.Get("Default", "ConvertsFullWidthSpaceToSpace", false); AppConfig.HRulerIndicatorType = Ini.Get("Default", "HRulerIndicatorType", HRulerIndicatorType.Segment); AppConfig.ScrollsBeyondLastLine = Ini.Get("Default", "ScrollsBeyondLastLine", true); AppConfig.MruFiles.Load(Ini.Get("Default", "Mru", "")); UserPref.Antialias = Ini.Get("Default", "Antialias", UserPref.Antialias); UserPref.AutoScrollMargin = Ini.Get("Default", "AutoScrollMargin", UserPref.AutoScrollMargin); UserPref.CopyLineWhenNoSelection = Ini.Get("Default", "CopyLineWhenNoSelection", UserPref.CopyLineWhenNoSelection); UserPref.UseTextForEofMark = Ini.Get("Default", "UseTextForEofMark", UserPref.UseTextForEofMark); } catch {} }
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; }
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); } } }
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++) { HHDeviceGrp devGrp = new HHDeviceGrp(ini, i); if (devGrp.IsValid) { listGrp.Add(devGrp); } } //区间轨道电路 List <HHDeviceGrp> grpsQJ = new List <HHDeviceGrp>(); HHDeviceGrp grpQJ = null; List <HHDeviceGrp> grpsZN = new List <HHDeviceGrp>(); HHDeviceGrp grpZN = null; for (int i = 0; i < listGrp.Count; i++) { int devType = listGrp[i].DevType; switch (devType) { case 8: //区间轨道电路 grpQJ = listGrp[i]; listGrpSort.Add(grpQJ); break; case 10: //无绝缘移频 grpsQJ.Add(listGrp[i]); break; case 30: //有绝缘移频 grpsQJ.Add(listGrp[i]); break; case 208: //ZPW2000 grpsQJ.Add(listGrp[i]); break; case 4: //站内轨道电路 grpZN = listGrp[i]; listGrpSort.Add(grpZN); break; case 11: //25HZ轨道电路 grpsZN.Add(listGrp[i]); break; case 16: //480轨道电路 grpsZN.Add(listGrp[i]); break; case 17: //高压不对称 grpsZN.Add(listGrp[i]); break; case 25: //驼峰 grpsZN.Add(listGrp[i]); break; default: listGrpSort.Add(listGrp[i]); break; } if (devType != 4 && devType != 8) { listGrpUnsort.Add(listGrp[i]); } } if (grpQJ != null) { grpQJ.AddGrp(grpsQJ); } else { listGrpSort.AddRange(grpsQJ); } if (grpZN != null) { grpZN.AddGrp(grpsZN); } else { listGrpSort.AddRange(grpsZN); } }
public HHDeviceGrp(IniDocument ini, int index) { string name = ini.GetString("设备", (index + 1).ToString()); if (string.IsNullOrEmpty(name)) { return; } this.DevType = ini.GetInt(name, "设备类型", 0); if (this.DevType <= 0) { return; } this.Name = name; int propNum = ini.GetInt(name, "属性数目", 0); if (propNum <= 0) { return; } int devNum = ini.GetInt(name, "设备数目", 0); if (devNum <= 0) { return; } for (int i = 0; i < propNum; i++) { HHDeviceProperty prop = new HHDeviceProperty(ini, this, i); if (prop.IsValid) { listProperty.Add(prop); if (prop.Type == "模拟量") { listAnalogProperty.Add(prop); } else if (prop.Type == "曲线") { listCurveProperty.Add(prop); } } } if (this.DevType != 4 && this.DevType != 8) { if (listProperty.Count <= 0) { return; } } if (listAnalogProperty.Count > 0) { SelectProperty(0, true); } for (int i = 0; i < devNum; i++) { HHDevice device = new HHDevice(ini, i, this); if (device.IsValid) { listDevice.Add(device); } } this.BuildGroup(); this.Level = 1; this.IsValid = true; }
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++) { HHDeviceGrp devGrp = new HHDeviceGrp(ini,i); if (devGrp.IsValid) { listGrp.Add(devGrp); } } //区间轨道电路 List<HHDeviceGrp> grpsQJ = new List<HHDeviceGrp>(); HHDeviceGrp grpQJ = null; List<HHDeviceGrp> grpsZN = new List<HHDeviceGrp>(); HHDeviceGrp grpZN = null; for (int i = 0; i < listGrp.Count; i++) { int devType=listGrp[i].DevType; switch (devType) { case 8: //区间轨道电路 grpQJ = listGrp[i]; listGrpSort.Add(grpQJ); break; case 10: //无绝缘移频 grpsQJ.Add(listGrp[i]); break; case 30: //有绝缘移频 grpsQJ.Add(listGrp[i]); break; case 208: //ZPW2000 grpsQJ.Add(listGrp[i]); break; case 4: //站内轨道电路 grpZN = listGrp[i]; listGrpSort.Add(grpZN); break; case 11: //25HZ轨道电路 grpsZN.Add(listGrp[i]); break; case 16: //480轨道电路 grpsZN.Add(listGrp[i]); break; case 17: //高压不对称 grpsZN.Add(listGrp[i]); break; case 25: //驼峰 grpsZN.Add(listGrp[i]); break; default: listGrpSort.Add(listGrp[i]); break; } if (devType != 4 && devType != 8) { listGrpUnsort.Add(listGrp[i]); } } if (grpQJ != null) { grpQJ.AddGrp(grpsQJ); } else { listGrpSort.AddRange(grpsQJ); } if (grpZN != null) { grpZN.AddGrp(grpsZN); } else { listGrpSort.AddRange(grpsZN); } }