Exemple #1
0
        /// <summary>
        /// Creates a new <see cref="LogFileData"/> instance for the specified file.
        /// </summary>
        /// <param name="fileName"></param>
        /// <returns></returns>
        public static LogFileData Create(string fileName)
        {
            LogFileData data = new LogFileData();

            data.FileName = Path.GetFileName(fileName);
            data.FileData = LogFileReader.Read(fileName);

            return(data);
        }
Exemple #2
0
        private void WriteFile(string directoryPath, LogFileData fileData)
        {
            string filePath = Path.Combine(directoryPath, fileData.FileName);

            if (!File.Exists(filePath))
            {
                //TraceFactory.Logger.Debug("Writing Log file: {0}".FormatWith(filePath));
                File.WriteAllText(filePath, fileData.FileData);
            }
        }
Exemple #3
0
        /// <summary>
        /// Creates a new <see cref="LogFileDataCollection"/> instance containing the passed-in files.
        /// </summary>
        /// <param name="files">The log files</param>
        /// <returns></returns>
        public static LogFileDataCollection Create(string[] files)
        {
            LogFileDataCollection dataCollection = new LogFileDataCollection()
            {
                MachineName = Environment.MachineName
            };

            foreach (var file in files)
            {
                dataCollection.Items.Add(LogFileData.Create(file));
            }

            return(dataCollection);
        }