コード例 #1
0
ファイル: FileCtrlINCC5.cs プロジェクト: hnordquist/INCC6
 /// <summary>
 /// Extract root path from INCC5 incc.ini file, and use that path to construct 3 new paths for use by the iRAP software.
 /// Assumes iRAP runtime directory structure (data and output directories).
 /// </summary>
 /// <param name="ctrllog">log handle for error output</param>
 /// <returns>paths, non-null empty array if no INCC5 in file is used, or
 ///          an array of 3 paths, 0: common input path, 1: data path, 2: log file path</returns>
 public static string[] ProcessINCC5IniFile(LMLoggers.LognLM ctrllog)
 {
     string [] paths = new string[] { string.Empty };
     if (!NC.App.AppContext.UseINCC5Ini)
         return paths;
     string filename = System.IO.Path.Combine(NC.App.AppContext.INCC5IniLoc, "incc.ini");
     if (!System.IO.File.Exists(filename))
     {
         if (ctrllog != null)
             ctrllog.TraceEvent(LogLevels.Warning, 112, "INCC5 ini file does not exist or cannot be opened: " + filename);
         return paths;
     }
     string inputpath = string.Empty;
     using (System.IO.StreamReader sr = new System.IO.StreamReader(filename))
     {
         string line;
         // Read lines from the file until the end of the file is reached or the relevant tag is found
         while ((line = sr.ReadLine()) != null)
         {
             string tline = line.TrimStart();
             if (tline.StartsWith(@"//") || tline.StartsWith(@"#"))
                 continue;
             if (tline.TrimStart().StartsWith("RT_COMMON_DATABASE_PATH")) // lolz
             {
                 string[] otkens = line.Split();
                 inputpath = otkens.Length > 1 ? otkens[1] : string.Empty;
                 break;
             }
         }
     }
     if (!string.IsNullOrEmpty(inputpath))
     {
         System.IO.DirectoryInfo parentpath = System.IO.Directory.GetParent(inputpath.TrimEnd(new char[] {'\\', '/'}));
         paths = new string[] { inputpath,   // as specified in the ini file entry
                                 System.IO.Path.Combine(System.IO.Path.GetFullPath("./"), @"Data"),  // todo: hard-coded path from examples in iRAP, but could be wrong
                                 System.IO.Path.Combine(parentpath.FullName, @"output") }; // log file goes into the final sweep output path
     }
     return paths;
 }
コード例 #2
0
ファイル: FileCtrl.cs プロジェクト: tempbottle/INCC6
 public static string LoggableFileProcessingStatus(EventType EH, LMLoggers.LognLM log, LogLevels lvl, object o)
 {
     string s = EH.ToString() + ": ";
     if (o != null)
     {
         string ss = string.Empty;
         if (o is FileCtrl)
         {
             FileCtrl f = (FileCtrl)o;
             ss = f.LoggableInstrStatusString(f.PseudoInstrument, true);
         }
         else if (o is Measurement)
         {
             Measurement m = (Measurement)o;
             ss = FileCtrl.MeasStatusString(m);
         }
         s += ss;
     }
     log.TraceEvent(lvl, FileCtrl.logid[EH], s);
     return s;  // just in case it could be of further use
 }
コード例 #3
0
ファイル: Control.cs プロジェクト: hnordquist/INCC6
 public static string LoggableDAQProcessingStatus(EventType EH, LMLoggers.LognLM log, LogLevels lvl, object o)
 {
     string s = String.Empty;
     if (o != null)
     {
         string ss = string.Empty;
         if (o is DAQControl)
         {
             DAQControl d = (DAQControl)o;
             ss = d.InstrStatusString(Instruments.Active.FirstActive(), true);
         }
         else if (o is Measurement)
         {
             Measurement m = (Measurement)o;
             ss = DAQControl.MeasStatusString(m);
         }
         s += ss;
     }
     log.TraceEvent(lvl, DAQControl.logid[EH], s);
     return s;  // just in case it could be of further use
 }