public IFileRecordInfo GetFileRecordInfo(FileInfo fileInfo) { var fileRecordInfo = FileRecordInfo.Create(fileInfo); if (fileRecordInfo == null) { return(null); } fileRecordInfo.GameName = GetGameFromMatchingList(fileRecordInfo.ProcessName); return(fileRecordInfo); }
public static IFileRecordInfo Create(FileInfo fileInfo) { FileRecordInfo recordInfo = null; try { recordInfo = new FileRecordInfo(fileInfo); } catch (ArgumentException) { // Log } catch (Exception) { // Log } return(recordInfo); }
private ISession LoadSessionFromCSV(FileInfo csvFile) { using (var reader = new StreamReader(csvFile.FullName)) { var lines = File.ReadAllLines(csvFile.FullName); if (lines.First().Equals(IGNOREFLAGMARKER)) { throw new HasIgnoreFlagException(); } var sessionRun = ConvertPresentDataLinesToSessionRun(lines.SkipWhile(line => line.Contains(FileRecordInfo.HEADER_MARKER))); var recordedFileInfo = FileRecordInfo.Create(csvFile, sessionRun.Hash); var systemInfos = GetSystemInfos(recordedFileInfo); return(new Session.Classes.Session() { Hash = string.Join(",", new string[] { sessionRun.Hash }).GetSha1(), Runs = new List <ISessionRun>() { sessionRun }, Info = new SessionInfo() { ProcessName = recordedFileInfo.ProcessName, Processor = recordedFileInfo.ProcessorName, GPU = recordedFileInfo.GraphicCardName, BaseDriverVersion = recordedFileInfo.BaseDriverVersion, GameName = recordedFileInfo.GameName, Comment = recordedFileInfo.Comment, Id = Guid.TryParse(recordedFileInfo.Id, out var guidId) ? guidId : Guid.NewGuid(), OS = recordedFileInfo.OsVersion, GpuCoreClock = recordedFileInfo.GPUCoreClock, GPUCount = recordedFileInfo.NumberGPUs, SystemRam = recordedFileInfo.SystemRamInfo, Motherboard = recordedFileInfo.MotherboardName, DriverPackage = recordedFileInfo.DriverPackage, GpuMemoryClock = recordedFileInfo.GPUMemoryClock, CreationDate = DateTime.TryParse(recordedFileInfo.CreationDate + "T" + recordedFileInfo.CreationTime, out var creationDate) ? creationDate : new DateTime(), AppVersion = new Version(), ApiInfo = recordedFileInfo.ApiInfo } });