Ejemplo n.º 1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="index">the index to use for searches</param>
 /// <param name="persistentFileName">the file path for the persistent dictionary</param>
 public Expressions(InvertedIndex index, string persistentFileName)
 {
     variableDefinitions = new PersistentVariableStore(persistentFileName);
     this.index          = index;
     foreach (List <string> cmd in variableDefinitions)
     {
         Assign(cmd, null);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// UI constructor
        /// </summary>
        /// <param name="logEntries">file path to log file</param>
        /// <param name="index">The inverted index of the log file</param>
        /// <param name="outLogFilePath">The file path to the optional output log</param>
        /// <param name="persistentFileName">The file path to the variable persistence</param>
        public UI(LogEntries logEntries, InvertedIndex index, string outLogFilePath = null, string persistentFileName = "LogVariables.tsv")
        {
            logic           = new Expressions(index, persistentFileName);
            this.logEntries = logEntries;
            this.index      = index;

            if (outLogFilePath != null)
            {
                SetOutputLog(outLogFilePath);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// starts new new asyncronous task to index a single log entry
        /// </summary>
        /// <param name="entryId">The index of the log entry</param>
        /// <param name="logEntry">the complete log entry</param>
        /// <param name="index">The reverse index for this log</param>
        void StartParseLineTask(int entryId, string logEntry, InvertedIndex index)
        {
            Task t = Task.Run(() =>
            {
                index.AddLogEntry(entryId, logEntry);
                if (entryId % 100 == 99 && ProgressUpdate != null)
                {
                    ProgressUpdate(this, new LoadEventArgs()
                    {
                        line_number = entryId + 1
                    });
                }
            });

            openTasks.Add(t);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="filename">file path to log file</param>
 /// <param name="index">index object that is associated with this log file</param>
 public LogEntries(string filename, InvertedIndex index, EventHandler <LoadEventArgs> ProgressUpdate = null)
 {
     this.index          = index;
     this.ProgressUpdate = ProgressUpdate;
     try
     {
         fileReader = new StreamReader(filename);
     }
     catch (Exception)
     {
         Console.ForegroundColor = ConsoleColor.Red;
         Console.WriteLine("Could not read file {0}", filename);
         Console.ForegroundColor = ConsoleColor.White;
         return;
     }
     valid = true;
 }