2 using System.Collections.Generic;
6 namespace Seci.Definitions
59 private static String _statusBlockName =
"Status";
66 private static Boolean _killIcpOnConfigChange =
false;
67 private static Boolean _killIcpOnExit =
true;
68 private static String _baseLogDir =
@"C:\data\log\";
69 private static Boolean _enableDashboardTitleEdit =
true;
70 private static String _pythonPath =
"";
71 private static String _pythonArgs =
"";
72 private static String _dashboardType =
"STANDARD";
73 private static Boolean _autoloadLastConfig =
true;
74 private static Boolean _showScriptingPage =
true;
75 private static int _viHostRefreshRate = 250;
76 private static Boolean _isPythonAvailable =
false;
79 public static Boolean ManagerLoggedIn {
get {
return _managerLoggedIn; } set { _managerLoggedIn = value; } }
80 public static String Instrument {
get {
return _instrument; } }
81 public static String ShortInstrument {
get {
return _shortInstrument; } }
82 public static Boolean IsTS2Instrument {
get {
return _isTS2Instrument; } }
83 public static String LabViewDir {
get {
return _labViewDir; } set { _labViewDir = value; } }
84 public static String LabViewIniFilePath {
get {
return _labViewIniFilePath; } set { _labViewIniFilePath = value; } }
85 public static String LabViewErrorDir {
get {
return _labViewErrorDir; } set { _labViewErrorDir = value; } }
86 public static Boolean UsingNewDae {
get {
return _usingNewDae; } set { _usingNewDae = value; } }
87 public static String ExecutionDir {
get {
return _executionDir; } set { _executionDir = value; } }
88 public static String ErrorDir {
get {
return _errorDir; } set { _errorDir = value; } }
89 public static String ConfigDir {
get {
return _configDir; } set { _configDir = value; } }
90 public static String HelpDir {
get {
return _helpDir; } set { _helpDir = value; } }
91 public static String DaeFile {
get {
return _daeFile; } }
92 public static String MessagePanelVI {
get {
return _messagePanelVI; } }
93 public static String BeamLoggerVI {
get {
return _beamLoggerVI; } }
94 public static String SampleParametersVI {
get {
return _sampleParametersVI; } }
95 public static String UserDetailsVI {
get {
return _userDetailsVI; } }
96 public static String DaeMonitorVI {
get {
return _daeMonitorVI; } }
97 public static String BeamlineParametersVI {
get {
return _beamlineParametersVI; } }
98 public static String[] NexusGroups {
get {
return _nexusGroups; } }
99 public static Boolean UseDaeMonitorVI {
get {
return _useDaeMonitorVI; } set { _useDaeMonitorVI = value; } }
100 public static Boolean IsMuonInstrument {
get {
return _isMuonInstrument; } }
101 public static int BlockUpdateRate {
get {
return _blockUpdateRate; } }
102 public static String OpenGenieLocation {
get {
return _openGenieLocation; } set { _openGenieLocation = value; } }
103 public static String RBFinderLocation {
get {
return _rbfinderLocation; } }
104 public static String RBDataFilepath {
get {
return _rbDataFilepath; } }
105 public static String BeamStatusWebpage {
get {
return _beamStatusWebpage; } }
106 public static String Ts1StatusWebpage {
get {
return _ts1StatusWebpage; } }
107 public static String Ts2StatusWebpage {
get {
return _ts2StatusWebpage; } }
108 public static String McrNewsWebpage {
get {
return _mcrNewsWebpage; } }
109 public static String BugzillaWebpage {
get {
return _bugzillaWebpage; } }
110 public static String GenieWebpage {
get {
return _genieWebpage; } }
111 public static Boolean DelayStartup {
get {
return _delayStartup; } }
112 public static int MaxNumberPlotsPerGraph {
get {
return _maxNumberPlotsPerGraph; } }
113 public static int MaxNumberGraphs {
get {
return _maxNumberGraphs; } }
114 public static int MaxNumberGenieGraphs {
get {
return _maxNumberGenieGraphs; } }
115 public static Boolean LogToDatabase {
get {
return _logToDatabase; } }
116 public static Boolean LogAllBlocksToSingleFile {
get {
return _logAllBlocksToSingleFile; } }
117 public static String JournalLocation {
get {
return _journalLocation; } }
118 public static String StatusBlockName {
get {
return _statusBlockName; } }
119 public static String SampleSheetWebpage {
get {
return _sampleSheetWebpage; } }
120 public static String EraSheetWebpage {
get {
return _eraWebpage; } }
121 public static int RBDateLeeway {
get {
return _rbDateLeeway; } }
122 public static Boolean KillIcpOnConfigChange {
get {
return _killIcpOnConfigChange; } }
123 public static Boolean KillIcpOnExit {
get {
return _killIcpOnExit; } }
124 public static String BaseLogDir {
get {
return _baseLogDir; } }
125 public static Boolean EnableDashboardTitleEdit {
get {
return _enableDashboardTitleEdit; } }
126 public static String PythonPath {
get {
return _pythonPath; } }
127 public static String PythonArgs {
get {
return _pythonArgs; } }
128 public static String DashboardType {
get {
return _dashboardType; } }
129 public static Boolean AutoloadLastConfig {
get {
return _autoloadLastConfig; } }
130 public static Boolean ShowScriptingPage {
get {
return _showScriptingPage; } }
131 public static int ViHostRefreshRate {
get {
return _viHostRefreshRate; } }
132 public static Boolean IsPythonAvailable {
get {
return _isPythonAvailable; } }
133 public static String MaintenanceWebpage {
get {
return _maintenanceWebpage; } }
134 public static String LTRWebpage {
get {
return _LTRWebpage; } }
135 public static String InstMonWebpage {
get {
return _InstMonWebpage; } }
144 Dictionary<String, string> instnames =
new Dictionary<string,string>();
145 instnames.Add(
"EVS",
"VESUVIO");
146 instnames.Add(
"NDW613",
"VESUVIO");
151 System.Configuration.AppSettingsReader reader =
new System.Configuration.AppSettingsReader();
153 _instrument = reader.GetValue(
"InstrumentName", typeof(System.String)).ToString();
154 if (String.IsNullOrEmpty(_instrument))
157 String name = System.Environment.MachineName;
158 if (name.ToLower().StartsWith(
"ndx"))
160 _instrument = name.Substring(3);
168 _shortInstrument = reader.GetValue(
"InstShortName", typeof(System.String)).ToString();
169 if (String.IsNullOrEmpty(_shortInstrument))
171 String name = Environment.GetEnvironmentVariable(
"SHORTNAME");
172 if (!String.IsNullOrEmpty(name))
174 _shortInstrument = name;
178 _shortInstrument =
"UNK";
182 _isTS2Instrument = (Boolean)reader.GetValue(
"IsTs2Instrument", typeof(System.Boolean));
183 _labViewDir = reader.GetValue(
"LabVIEWDir", typeof(System.String)).ToString();
184 _labViewIniFilePath = reader.GetValue(
"LabViewIniFilepath", typeof(System.String)).ToString();
185 _usingNewDae = (Boolean)reader.GetValue(
"UseNewDAE", typeof(System.Boolean));
186 _daeFile = reader.GetValue(
"DAEVI", typeof(System.String)).ToString();
187 _messagePanelVI = reader.GetValue(
"MessagePanelVI", typeof(System.String)).ToString();
188 _beamLoggerVI = reader.GetValue(
"BeamLoggerVI", typeof(System.String)).ToString();
189 _daeMonitorVI = reader.GetValue(
"DAEMonitorVI", typeof(System.String)).ToString();
190 _sampleParametersVI = reader.GetValue(
"SampleParametersVI", typeof(System.String)).ToString();
191 _beamlineParametersVI = reader.GetValue(
"BeamlineParametersVI", typeof(System.String)).ToString();
192 _userDetailsVI = reader.GetValue(
"UserDetailsVI", typeof(System.String)).ToString();
193 _useDaeMonitorVI = (Boolean)reader.GetValue(
"UseDAEMonitorVI", typeof(System.Boolean));
194 _blockUpdateRate = Convert.ToInt32(reader.GetValue(
"BlockUpdateRate", typeof(System.Int32)));
195 _isMuonInstrument = (Boolean)reader.GetValue(
"IsMuonInstrument", typeof(System.Boolean));
196 _managerPassword = reader.GetValue(
"ManagerPassword", typeof(System.String)).ToString();
197 _openGenieLocation = reader.GetValue(
"OpenGENIELocation", typeof(System.String)).ToString();
198 _rbfinderLocation = reader.GetValue(
"RBFinderLocation", typeof(System.String)).ToString();
199 _rbDataFilepath = reader.GetValue(
"RBDataFilepath", typeof(System.String)).ToString();
200 _beamStatusWebpage = reader.GetValue(
"BeamStatusUrl", typeof(String)).ToString();
201 _ts1StatusWebpage = reader.GetValue(
"TS1GraphUrl", typeof(String)).ToString();
202 _ts2StatusWebpage = reader.GetValue(
"TS2GraphUrl", typeof(String)).ToString();
203 _mcrNewsWebpage = reader.GetValue(
"McrUrl", typeof(String)).ToString();
204 _bugzillaWebpage = reader.GetValue(
"BugzillaUrl", typeof(String)).ToString();
205 _genieWebpage = reader.GetValue(
"GenieUrl", typeof(String)).ToString();
206 _delayStartup = (Boolean)reader.GetValue(
"DelayStartup", typeof(System.Boolean));
207 _maxNumberPlotsPerGraph = Convert.ToInt32(reader.GetValue(
"MaxNumberPlotsPerGraph", typeof(System.Int32)));
208 _maxNumberGraphs = Convert.ToInt32(reader.GetValue(
"MaxNumberGraphs", typeof(System.Int32)));
209 _maxNumberGenieGraphs = Convert.ToInt32(reader.GetValue(
"MaxNumberGenieGraphs", typeof(System.Int32)));
210 _logToDatabase = (Boolean)reader.GetValue(
"LogBlocksToDatabase", typeof(System.Boolean));
211 _logAllBlocksToSingleFile = (Boolean)reader.GetValue(
"LogBlocksToSingleFile", typeof(System.Boolean));
212 _journalLocation = reader.GetValue(
"JournalLocation", typeof(String)).ToString();
213 _sampleSheetWebpage = reader.GetValue(
"SamplesheetWebpage", typeof(String)).ToString();
214 _eraWebpage = reader.GetValue(
"ERAWebpage", typeof(String)).ToString();
215 _rbDateLeeway = Convert.ToInt32(reader.GetValue(
"RBDateLeeway", typeof(System.Int32)));
216 _killIcpOnConfigChange = (Boolean)reader.GetValue(
"KillIcpOnConfigChange", typeof(System.Boolean));
217 _killIcpOnExit = (Boolean)reader.GetValue(
"KillIcpOnExit", typeof(System.Boolean));
218 _baseLogDir = reader.GetValue(
"ErrorLogDir", typeof(String)).ToString();
219 _enableDashboardTitleEdit = (Boolean)reader.GetValue(
"DashboardTitleEnabled", typeof(System.Boolean));
220 _autoloadLastConfig = (Boolean)reader.GetValue(
"AutoloadLastConfig", typeof(System.Boolean));
221 _showScriptingPage = (Boolean)reader.GetValue(
"ShowScriptingPage", typeof(System.Boolean));
222 _viHostRefreshRate = Convert.ToInt32(reader.GetValue(
"ViHostRefreshRate", typeof(System.Int32)));
223 _isPythonAvailable = (Boolean)reader.GetValue(
"PythonAvailable", typeof(System.Boolean));
224 _LTRWebpage = reader.GetValue(
"LTRWebpage", typeof(String)).ToString();
225 _InstMonWebpage = reader.GetValue(
"InstMonWebpage", typeof(String)).ToString() +
"?Instrument=" + _instrument.ToUpper();
227 if (instnames.ContainsKey(_instrument.ToUpper()))
229 _maintenanceWebpage = reader.GetValue(
"MaintenanceWebpage", typeof(String)).ToString().Replace(
"INSTNAME", instnames[_instrument.ToUpper()].ToUpper());
233 _maintenanceWebpage = reader.GetValue(
"MaintenanceWebpage", typeof(String)).ToString().Replace(
"INSTNAME", _instrument.ToUpper());
237 String location = Environment.GetEnvironmentVariable(Environment.SpecialFolder.ProgramFiles.ToString());
238 if (IntPtr.Size == 8)
241 location = Environment.GetEnvironmentVariable(
"ProgramFiles(x86)");
244 _rbfinderLocation = _rbfinderLocation.Replace(
"progfiles", location);
245 _openGenieLocation = _openGenieLocation.Replace(
"progfiles", location);
246 _labViewIniFilePath = _labViewIniFilePath.Replace(
"progfiles", location);
249 String temp = reader.GetValue(
"NexusGroups", typeof(System.String)).ToString();
253 _nexusGroups = temp.Split(
';');
259 _pythonPath = reader.GetValue(
"PythonPath", typeof(System.String)).ToString();
260 _pythonArgs = reader.GetValue(
"PythonArgs", typeof(System.String)).ToString();
270 _dashboardType = reader.GetValue(
"DashboardType", typeof(System.String)).ToString().ToUpper();
274 _dashboardType =
"STANDARD";
279 catch (Exception err)
281 Seci.Helpers.ErrorLogger.SeciError(
"ReadAppSettings", err);
291 internal static void CreateDirectories()
294 DirectoryInfo DI =
new DirectoryInfo(_errorDir);
302 DI =
new DirectoryInfo(_configDir);
310 DI =
new DirectoryInfo(_labViewErrorDir);
325 internal static Boolean CheckManagerPassword(String password)
327 if (password == _managerPassword)
static String _ts1StatusWebpage
static String _labViewErrorDir
static Boolean _logAllBlocksToSingleFile
static String _openGenieLocation
static int _blockUpdateRate
static String _shortInstrument
static Boolean _isMuonInstrument
static String _bugzillaWebpage
static Boolean _usingNewDae
static String _labViewDir
static String _journalLocation
static String _rbDataFilepath
static String _sampleParametersVI
static String _sampleSheetWebpage
static String[] _nexusGroups
Class for holding the standard run-time settings for SECI. A large percentage of the information held...
static String _executionDir
static int _maxNumberGraphs
static String _mcrNewsWebpage
static Boolean _isTS2Instrument
static Boolean _logToDatabase
static String _instrument
static String _eraWebpage
static int _maxNumberGenieGraphs
static String _beamStatusWebpage
static Boolean _useDaeMonitorVI
static String _InstMonWebpage
static String _genieWebpage
static int _maxNumberPlotsPerGraph
static String _userDetailsVI
static String _rbfinderLocation
static String _maintenanceWebpage
static Boolean ReadAppSettings()
This method reads the settings that are set via the App.config file.
static String _ts2StatusWebpage
static String _daeMonitorVI
static String _labViewIniFilePath
static String _LTRWebpage
static String _messagePanelVI
static String _managerPassword
static Boolean _delayStartup
static Boolean _managerLoggedIn
static String _beamlineParametersVI
static String _beamLoggerVI