Ejemplo n.º 1
0
        /// <summary>
        /// Retrieves all of the IMS logfiles that are currently stored.
        /// </summary>
        /// <returns>A list of logfiles.</returns>
        public IEnumerable <LogFileInformation> GetAllLogFiles()
        {
            List <LogFileInformation> toReturn = new List <LogFileInformation>();

            foreach (string file in Directory.GetFiles(Constants.ExecutionPath + Constants.LogLocation))
            {
                if (new FileInfo(file).FullName == new FileInfo(Logger.CurrentLogFile).FullName)
                {
                    continue;
                }
                LogFileInformation information = new LogFileInformation();
                information.Name         = Path.GetFileNameWithoutExtension(file);
                information.CreationDate = File.GetCreationTime(file);
                string[] text = File.ReadAllLines(file);
                if (text.Length > 0)
                {
                    information.CleanExit = text[text.Length - 1] == "[INFO] Exited cleanly.";
                }
                toReturn.Add(information);
            }
            return(toReturn);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Deletes the server logfile, removing it from disk.
 /// </summary>
 /// <param name="information">The logfile to delete.</param>
 public abstract void DeleteLogFile(LogFileInformation information);
Ejemplo n.º 3
0
 /// <summary>
 /// Retrieves the text of a logfile based on its name.
 /// </summary>
 /// <param name="name">The name of the logfile to retrieve.</param>
 /// <returns>The text inside the logfile.</returns>
 public abstract string GetLogFile(LogFileInformation name);
Ejemplo n.º 4
0
 /// <summary>
 /// Deletes the IMS logfile, removing it from disk.
 /// </summary>
 /// <param name="information">The logfile to delete.</param>
 public void DeleteLogFile(LogFileInformation information)
 {
     File.Delete(Constants.ExecutionPath + Constants.LogLocation + "/" + information.Name + ".txt");
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Retrieves the content of a specific IMS logfile.
 /// </summary>
 /// <param name="information">The logfile to read.</param>
 /// <returns>The text contained within the logfile.</returns>
 public string GetLogFile(LogFileInformation information)
 {
     return(File.ReadAllText(Constants.ExecutionPath + Constants.LogLocation + "/" + information.Name + ".txt"));
 }