diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2019-11-24 16:39:46 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2019-11-24 16:39:46 +0200 |
| commit | 6c57a826a4287b1ca3ea418fcc2aed50ed129bdc (patch) | |
| tree | 76a3fc419861d2ebdb9e345a35e58cf37f3cde21 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs | |
| parent | d2edfc56a8154c01a7ca9cfc47adccc8a07c3d94 (diff) | |
| download | Tango-6c57a826a4287b1ca3ea418fcc2aed50ed129bdc.tar.gz Tango-6c57a826a4287b1ca3ea418fcc2aed50ed129bdc.zip | |
Implemented AutoLogRemoval & MaxFileSizeLimit to FileLogger, LogFileParser and TFS bug reporting!!!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs | 56 |
1 files changed, 39 insertions, 17 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs index 31b330c3f..b3e121253 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/TFS/TeamFoundationServiceExtendedClient.cs @@ -185,6 +185,22 @@ namespace Tango.MachineStudio.UI.TFS return item; } + private string[] GetLogFiles(FileLogger logger) + { + string[] fileEntries = new string[1]; + fileEntries[0] = logger.LogFile; + string fileName = Path.GetFileNameWithoutExtension(logger.LogFile); + int indexPos = fileName.IndexOf(FileLogger.FILE_SET_EXTENSION); + if (indexPos > 0) + { + string extension = Path.GetExtension(logger.LogFile); + fileName = fileName.Substring(0, indexPos); + fileEntries = Directory.GetFiles(logger.Folder, $"{fileName}*{extension}").Where(x => Path.GetFileName(x).StartsWith(logger.Tag)).OrderBy(x => x.Length).ThenBy(x => x).ToArray(); + } + + return fileEntries; + } + public void FinalizeBug(WorkItem item) { IAuthenticationProvider auth = TangoIOC.Default.GetInstance<IAuthenticationProvider>(); @@ -192,31 +208,37 @@ namespace Tango.MachineStudio.UI.TFS FileLogger appFileLogger = LogManager.Default.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; FileLogger embeddedFileLogger = MachineOperator.EmbeddedLogManager.RegisteredLoggers.FirstOrDefault(x => x.GetType() == typeof(FileLogger)) as FileLogger; - + if (appFileLogger != null) { - var appLogFile = _tempFolder.CreateImaginaryFile(); - File.Copy(appFileLogger.LogFile, appLogFile.Path); - - item.Attachments.Add(new Attachment() + string[] logFiles = GetLogFiles(appFileLogger); + foreach( string file in logFiles) { - Description = "Application Log File", - FilePath = appLogFile.Path, - Name = Path.GetFileName(appFileLogger.LogFile), - }); + var appLogFile = _tempFolder.CreateImaginaryFile(); + File.Copy(file, appLogFile.Path); + item.Attachments.Add(new Attachment() + { + Description = "Application Log File", + FilePath = appLogFile.Path, + Name = Path.GetFileName(file), + }); + } } if (embeddedFileLogger != null && File.Exists(embeddedFileLogger.LogFile)) { - var embeddedLogFile = _tempFolder.CreateImaginaryFile(); - File.Copy(embeddedFileLogger.LogFile, embeddedLogFile.Path); - - item.Attachments.Add(new Attachment() + string[] logFiles = GetLogFiles(embeddedFileLogger); + foreach (string file in logFiles) { - Description = "Embedded Log File", - FilePath = embeddedLogFile.Path, - Name = Path.GetFileName(embeddedFileLogger.LogFile), - }); + var embeddedLogFile = _tempFolder.CreateImaginaryFile(); + File.Copy(file, embeddedLogFile.Path); + item.Attachments.Add(new Attachment() + { + Description = "Embedded Log File", + FilePath = embeddedLogFile.Path, + Name = Path.GetFileName(file), + }); + } } SystemInformationModel sysModel = new SystemInformationModel(); |
