public void LoadConfig() { TIniFile IniFile = new TIniFile(DataModul.GetInstance().IniFileName); Debug = IniFile.ReadBool("General", "Debug", false); LineNumbers = IniFile.ReadInteger("General", "LineNumbers", 0); BlackWhite = IniFile.ReadBool("General", "BlackWhite", true); ReloadFiles = IniFile.ReadBool("General", "ReloadFiles", true); FileName1 = IniFile.ReadString("General", "FileName1", ""); FileName2 = IniFile.ReadString("General", "FileName2", ""); }
public static void func_ReadEQPConfig_By_iniFile() { string strFile = "Config\\EQPConfig.ini"; string strTemp; string[] strTemp2; if (File.Exists(strFile)) { TIniFile iniFile = new TIniFile(strFile); //g_TotalAlarmQTY Common.g_TotalAlarmQTY = 261; strTemp = ""; strTemp = iniFile.ReadString("TotalGEMDataSetting", "TotalAlarmQTY", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_TotalAlarmQTY = int.Parse(strTemp); } else { Common.g_TotalAlarmQTY = 261; } //g_MinAlarmID Common.g_MinAlarmID = 100; strTemp = ""; strTemp = iniFile.ReadString("TotalGEMDataSetting", "MinAlarmID", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_MinAlarmID = int.Parse(strTemp); } else { Common.g_MinAlarmID = 100; } //g_MaxAlarmID Common.g_MaxAlarmID = 120; strTemp = ""; strTemp = iniFile.ReadString("TotalGEMDataSetting", "MaxAlarmID", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_MaxAlarmID = int.Parse(strTemp); } else { Common.g_MaxAlarmID = 120; } //g_SlotSpaceInCassette Common.g_SlotSpaceInCassette = 25; strTemp = ""; strTemp = iniFile.ReadString("CassetteDataSetting", "SlotSpaceInCassette", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_SlotSpaceInCassette = int.Parse(strTemp); } else { Common.g_SlotSpaceInCassette = 25; } //g_RemoteRCMD Common.g_RemoteRCMD = "REMOTE"; strTemp = ""; strTemp = iniFile.ReadString("RCMDSetting", "RemoteRCMD", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_RemoteRCMD = strTemp; } else { Common.g_RemoteRCMD = "REMOTE"; } //g_LocalRCMD Common.g_LocalRCMD = "LOCAL"; strTemp = ""; strTemp = iniFile.ReadString("RCMDSetting", "LocalRCMD", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_LocalRCMD = strTemp; } else { Common.g_LocalRCMD = "Y"; } //g_BarcodeTestMode // 0: normal mode, 1:Test Mode (no barcode reader) Common.g_BarcodeTestMode = 1; strTemp = ""; strTemp = iniFile.ReadString("RFIDSetting", "BARCODE_TestMode", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_BarcodeTestMode = int.Parse(strTemp); } else { Common.g_BarcodeTestMode = 1; } //g_PJ_Space Common.g_PJ_Space = 25; strTemp = ""; strTemp = iniFile.ReadString("E40_Setting", "PJ_Space", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_PJ_Space = int.Parse(strTemp); } else { Common.g_PJ_Space = 25; } //g_PTN_Space Common.g_PTN_Space = 1; strTemp = ""; strTemp = iniFile.ReadString("E87_Setting", "PTN_Space", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_PTN_Space = int.Parse(strTemp); } else { Common.g_PTN_Space = 1; } //g_Carrier_Space Common.g_Carrier_Space = 8; strTemp = ""; strTemp = iniFile.ReadString("E87_Setting", "Carrier_Space", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_Carrier_Space = int.Parse(strTemp); } else { Common.g_Carrier_Space = 8; } //g_ST_Location_Space Common.g_ST_Location_Space = 1; strTemp = ""; strTemp = iniFile.ReadString("E90_Setting", "ST_Location_Space", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_ST_Location_Space = int.Parse(strTemp); } else { Common.g_ST_Location_Space = 1; } //g_ST_Step_Space Common.g_ST_Step_Space = 1; strTemp = ""; strTemp = iniFile.ReadString("E90_Setting", "ST_Step_Space", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_ST_Step_Space = int.Parse(strTemp); } else { Common.g_ST_Step_Space = 1; } //g_CJ_Space Common.g_CJ_Space = Common.g_PTN_Space; strTemp = ""; strTemp = iniFile.ReadString("E94_Setting", "CJ_Space", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_CJ_Space = int.Parse(strTemp); } else { Common.g_CJ_Space = Common.g_PTN_Space; } //g_LPTSM_PortID_x Common.g_LPTSM_PortID_1 = 1; Common.g_LPTSM_PortID_2 = 2; Common.g_LPTSM_PortID_3 = 3; Common.g_LPTSM_PortID_4 = 4; Common.g_LPTSM_PortID_5 = 5; Common.g_LPTSM_PortID_6 = 6; Common.g_LPTSM_PortID_7 = 7; Common.g_LPTSM_PortID_8 = 8; strTemp = ""; strTemp = iniFile.ReadString("E87_Setting", "LPTSM_PortID_1", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_LPTSM_PortID_1 = int.Parse(strTemp); } else { Common.g_LPTSM_PortID_1 = 1; } Common.g_LPTSM_PortID_2 = 2; Common.g_LPTSM_PortID_3 = 3; Common.g_LPTSM_PortID_4 = 4; Common.g_LPTSM_PortID_5 = 5; Common.g_LPTSM_PortID_6 = 6; Common.g_LPTSM_PortID_7 = 7; Common.g_LPTSM_PortID_8 = 8; //**Allow NULL Sutstrate ID setting //g_Allow_NULL_SubstID,預設為Allow NULL Sutstrate ID Common.g_Allow_NULL_SubstID = "Y"; strTemp = ""; strTemp = iniFile.ReadString("E87_Setting", "Allow_NULL_SubstID", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_Allow_NULL_SubstID = strTemp; } else { Common.g_Allow_NULL_SubstID = "Y"; } //**Allow NULL Sutstrate ID setting //g_EqpInitTimer Common.g_EqpInitTimer = 5; strTemp = ""; strTemp = iniFile.ReadString("CommonSetting", "EqpInitTimer", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_EqpInitTimer = int.Parse(strTemp); } else { Common.g_EqpInitTimer = 5; } //g_InitShowForm Common.g_InitShowForm = 0; strTemp = ""; strTemp = iniFile.ReadString("CommonSetting", "InitShowForm", ""); strTemp = strTemp.Trim(); if (strTemp != "") { Common.g_InitShowForm = int.Parse(strTemp); } else { Common.g_InitShowForm = 0; } //g_LocationID Common.g_LocationID = new string[Common.g_ST_Location_Space + 1]; strTemp = ""; strTemp = iniFile.ReadString("E90_Setting", "LocationIDs", ""); strTemp = strTemp.Trim(); if (strTemp != "") { strTemp2 = strTemp.Split(new Char[] { ',', '\t' }); for (int i = strTemp2.GetLowerBound(0); i <= strTemp2.GetUpperBound(0); i++) { Common.g_LocationID[i + 1] = strTemp2[i].Trim(); } } iniFile.Close(); iniFile.Dispose(); } }
public bool Load() { { TIniFile IniFile = new TIniFile(IniFileName); FileName = IniFile.ReadString("General", "FileName", FileName); Glow = IniFile.ReadBool("General", "Glow", Glow); }; // - - - - - - using (Stream stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(TemplatesFileName)) using (StreamReader reader = new StreamReader(stream)) { TStrings text = new TStrings(); text.Text = reader.ReadToEnd(); text.SaveToFile("Templates.ini"); TIniFile IniFile = new TIniFile("Templates.ini"); #if PCL await IniFile.LoadValues(); #else IniFile.LoadValues(); #endif TStrings Sections = IniFile.ReadSections(); Icons.Clear(); for (int s = 0; s < Sections.Count; s++) { if (Sections[s].StartsWith("#")) { TStrings l = IniFile.ReadSectionValues(Sections[s]); for (int i = 0; i < l.Count; i++) { var o = new Icon(); o.Section = Sections[s].Substring(1); o.Name = l.Names(i); string st = l.ValueFromIndex(i); o.Width = int.Parse(st.Split(new char[] { 'x', 'X' })[0]); o.Height = int.Parse(st.Split(new char[] { 'x', 'X', ',' })[1]); if (st.Split(new char[] { 'x', 'X', ',' }).Length > 2) { o.Scale = int.Parse(st.Split(new char[] { 'x', 'X', ',' })[2]); } ; Application.Current.Dispatcher.Invoke(new Action(() => { Icons.Add(o); })); } ; } ; } ; OnPropertyChanged("Icons"); }; return(true); }