From 99c302c15702d192a618fb47ad99e53fede4aa67 Mon Sep 17 00:00:00 2001 From: Michael Krisper <michael.krisper@tugraz.at> Date: Mon, 30 Aug 2021 17:28:27 +0200 Subject: [PATCH] Removed setting LastAccessTime --- .../InputData/FileIO/JSON/JSONInputDataFactory.cs | 9 --------- .../Reader/ComponentData/AlternatorReader.cs | 11 ----------- .../Reader/ComponentData/DrivingCycleDataReader.cs | 10 ---------- VectoCore/VectoCore/Utils/VectoCSVFile.cs | 13 +------------ 4 files changed, 1 insertion(+), 42 deletions(-) diff --git a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs index 85a62470d8..4e9c56a7f2 100644 --- a/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs +++ b/VectoCore/VectoCore/InputData/FileIO/JSON/JSONInputDataFactory.cs @@ -64,19 +64,10 @@ namespace TUGraz.VectoCore.InputData.FileIO.JSON throw new FileNotFoundException("failed to load file: " + fileName, fileName); } - //UpdateLastAccessTime(fileName); using (var reader = File.OpenText(fileName)) { return (JObject)JToken.ReadFrom(new JsonTextReader(reader)); } } - public static void UpdateLastAccessTime(string fileName) - { - try { - File.SetLastAccessTime(fileName, DateTime.Now); - } catch (Exception e) { - Console.WriteLine(e); - } - } public static IInputDataProvider ReadComponentData(string filename) { diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/AlternatorReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/AlternatorReader.cs index 82bdda5b7a..7919b1bd19 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/AlternatorReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/AlternatorReader.cs @@ -24,20 +24,9 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData throw new ArgumentException("Supplied input file does not exist"); } - //UpdateLastAccessTime(filePath); return ReadMap(File.OpenRead(filePath), Path.GetFullPath(filePath)); } - public static void UpdateLastAccessTime(string fileName) - { - try { - File.SetLastAccessTime(fileName, DateTime.Now); - } catch (Exception e) { - Console.WriteLine(e); - } - } - - public static IAlternatorMap ReadMap(Stream stream, string source = null) { //var returnValue = false; diff --git a/VectoCore/VectoCore/InputData/Reader/ComponentData/DrivingCycleDataReader.cs b/VectoCore/VectoCore/InputData/Reader/ComponentData/DrivingCycleDataReader.cs index d62c6874be..0e902e94c8 100644 --- a/VectoCore/VectoCore/InputData/Reader/ComponentData/DrivingCycleDataReader.cs +++ b/VectoCore/VectoCore/InputData/Reader/ComponentData/DrivingCycleDataReader.cs @@ -111,7 +111,6 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData public static DrivingCycleData ReadFromFile(string fileName, CycleType type, bool crossWindRequired) { try { - //UpdateLastAccessTime(fileName); var stream = File.OpenRead(fileName); return ReadFromStream(stream, type, Path.GetFileNameWithoutExtension(fileName), crossWindRequired); } catch (Exception ex) { @@ -119,15 +118,6 @@ namespace TUGraz.VectoCore.InputData.Reader.ComponentData } } - public static void UpdateLastAccessTime(string fileName) - { - try { - File.SetLastAccessTime(fileName, DateTime.Now); - } catch (Exception e) { - Console.WriteLine(e); - } - } - /// <summary> /// Reads the cycle from a stream. /// </summary> diff --git a/VectoCore/VectoCore/Utils/VectoCSVFile.cs b/VectoCore/VectoCore/Utils/VectoCSVFile.cs index 0b1bf909fe..e4974252db 100644 --- a/VectoCore/VectoCore/Utils/VectoCSVFile.cs +++ b/VectoCore/VectoCore/Utils/VectoCSVFile.cs @@ -75,7 +75,6 @@ namespace TUGraz.VectoCore.Utils public static TableData Read(string fileName, bool ignoreEmptyColumns = false, bool fullHeader = false) { try { - //UpdateLastAccessTime(fileName); using (var fs = File.OpenText(fileName)) { var retVal = new TableData(fileName); ReadCSV(retVal, fs, ignoreEmptyColumns, fullHeader); @@ -87,15 +86,6 @@ namespace TUGraz.VectoCore.Utils } } - public static void UpdateLastAccessTime(string fileName) - { - try { - File.SetLastAccessTime(fileName, DateTime.Now); - } catch (Exception e) { - Console.WriteLine(e); - } - } - /// <summary> /// Reads a CSV file which is stored in Vecto-CSV-Format. /// </summary> @@ -130,11 +120,10 @@ namespace TUGraz.VectoCore.Utils .Select(l => l.Contains(Comment) ? l.Substring(0, l.IndexOf(Comment, StringComparison.Ordinal)) : l) .ToArray(); - double tmp; var columns = colsWithoutComment .Select(l => fullHeader ? l : HeaderFilter.Replace(l, "")) .Select(l => l.Trim()) - .Where(col => !double.TryParse(col, NumberStyles.Any, CultureInfo.InvariantCulture, out tmp)) + .Where(col => !double.TryParse(col, NumberStyles.Any, CultureInfo.InvariantCulture, out _)) .Distinct() .ToList(); -- GitLab