AKunSimulator/Global/SSmart.cs

139 lines
5.3 KiB
C#

// Decompiled with JetBrains decompiler
// Type: Global.SSmart
// Assembly: Global, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: C0AE7A64-EC5F-4076-AA61-B93AC1193B2E
// Assembly location: C:\Users\auvkk\Desktop\x64SimIR2\Global.dll
using System;
using System.Collections.Generic;
namespace Global
{
public struct SSmart
{
public bool Det01_Active;
public string Det01_Name;
public bool Det01_Hide;
public bool Det02_Active;
public string Det02_Name;
public bool Det02_Hide;
public bool Det03_Active;
public string Det03_Name;
public bool Det03_Hide;
public bool Det04_Active;
public string Det04_Name;
public bool Det04_Hide;
public bool DetCurvature_Active;
public int DetCurvature_Bind;
public ETypeCurvature DetCurvature_Type;
public ETypeDetectorType DetectorType;
public int DetCurvature_Laser;
public bool DetCurvatureEx_Active;
public int DetCurvatureEx_Bind;
public ETypeCurvature DetCurvatureEx_Type;
public ETypeDetectorTypeEx DetectorTypeEx;
public bool ReadFrom405;
public List<int> CurRingIndexArray;
public SSmart(int val)
{
this.Det01_Active = true;
this.Det02_Active = true;
this.Det03_Active = true;
this.Det04_Active = true;
this.DetCurvature_Active = true;
this.Det01_Hide = true;
this.Det02_Hide = true;
this.Det03_Hide = true;
this.Det04_Hide = true;
this.Det01_Name = "Det01";
this.Det02_Name = "Det02";
this.Det03_Name = "Det02";
this.Det04_Name = "Det03";
this.DetCurvature_Bind = 3;
this.DetCurvature_Laser = 0;
this.DetCurvature_Type = ETypeCurvature.point5;
this.DetectorType = ETypeDetectorType.FivePoint;
this.DetCurvatureEx_Active = false;
this.DetCurvatureEx_Bind = 1;
this.DetCurvatureEx_Type = ETypeCurvature.point1Ex;
this.DetectorTypeEx = ETypeDetectorTypeEx.OnePoint;
this.CurRingIndexArray = new List<int>();
this.ReadFrom405 = true;
}
public void LoadFromSetting(string path)
{
INIClass iniClass = new INIClass(path);
this.Det01_Active = bool.Parse(iniClass.IniReadValue("Detector#1", "Activation"));
this.Det01_Name = iniClass.IniReadValue("Detector#1", "Name");
bool result1;
this.Det01_Hide = bool.TryParse(iniClass.IniReadValue("Detector#1", "Hide"), out result1) && result1;
this.Det02_Active = bool.Parse(iniClass.IniReadValue("Detector#2", "Activation"));
this.Det02_Name = iniClass.IniReadValue("Detector#2", "Name");
this.Det02_Hide = bool.TryParse(iniClass.IniReadValue("Detector#2", "Hide"), out result1) && result1;
this.Det03_Active = bool.Parse(iniClass.IniReadValue("Detector#3", "Activation"));
this.Det03_Name = iniClass.IniReadValue("Detector#3", "Name");
bool.TryParse(iniClass.IniReadValue("Detector#3", "Hide"), out result1);
this.Det03_Hide = bool.TryParse(iniClass.IniReadValue("Detector#3", "Hide"), out result1) && result1;
this.Det04_Active = bool.Parse(iniClass.IniReadValue("Detector#4", "Activation"));
this.Det04_Name = iniClass.IniReadValue("Detector#4", "Name");
this.Det04_Hide = bool.TryParse(iniClass.IniReadValue("Detector#4", "Hide"), out result1) && result1;
this.DetCurvature_Active = bool.Parse(iniClass.IniReadValue("Detector#Curvature", "Activation"));
this.DetCurvature_Laser = int.Parse(iniClass.IniReadValue("Detector#Curvature", "LaserRate"));
this.DetCurvature_Type = (ETypeCurvature) int.Parse(iniClass.IniReadValue("Detector#Curvature", "Type"));
this.DetCurvature_Bind = int.Parse(iniClass.IniReadValue("Detector#Curvature", "Binding"));
int result2 = 0;
int.TryParse(iniClass.IniReadValue("Detector#Curvature", "DetectorType"), out result2);
this.DetectorType = (ETypeDetectorType) result2;
this.DetCurvatureEx_Active = bool.Parse(iniClass.IniReadValue("Detector#CurvatureEx", "Activation"));
this.DetCurvatureEx_Bind = int.Parse(iniClass.IniReadValue("Detector#CurvatureEx", "Binding"));
this.DetCurvatureEx_Type = (ETypeCurvature) int.Parse(iniClass.IniReadValue("Detector#CurvatureEx", "Type"));
int result3 = 0;
int.TryParse(iniClass.IniReadValue("Detector#CurvatureEx", "DetectorType"), out result3);
this.DetectorTypeEx = (ETypeDetectorTypeEx) result3;
try
{
this.ReadFrom405 = new INIClass(PString.SystemSet).IniReadValue(PString.Section_System, "DCOM405").ToUpper() == "TRUE";
}
catch (Exception ex)
{
this.ReadFrom405 = true;
}
}
public int GetDispRingNum(out List<string> names)
{
names = new List<string>();
this.CurRingIndexArray = new List<int>();
int dispRingNum = 0;
if (this.Det01_Active)
{
this.CurRingIndexArray.Add(1);
names.Add(this.Det01_Name);
++dispRingNum;
}
if (this.Det02_Active)
{
this.CurRingIndexArray.Add(2);
names.Add(this.Det02_Name);
++dispRingNum;
}
if (this.Det03_Active)
{
this.CurRingIndexArray.Add(3);
names.Add(this.Det03_Name);
++dispRingNum;
}
if (this.Det04_Active)
{
this.CurRingIndexArray.Add(4);
names.Add(this.Det04_Name);
++dispRingNum;
}
return dispRingNum;
}
}
}