/// <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); }
/// <summary> /// Deletes the server logfile, removing it from disk. /// </summary> /// <param name="information">The logfile to delete.</param> public abstract void DeleteLogFile(LogFileInformation information);
/// <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);
/// <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"); }
/// <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")); }