private static Dictionary <string, string> GetCurrentWriteTime(ConfigTableCollection tableCollection, string configFilesPath) { var currentWriteTime = new Dictionary <string, string>(); var files = Directory.GetFiles(configFilesPath, "*.csv"); var tableList = new List <string>(); foreach (var table in tableCollection) { tableList.Add(table.name); } foreach (var file in files) { var s1 = File.GetLastWriteTime(file).ToString(CultureInfo.InvariantCulture); var s2 = Path.GetFileNameWithoutExtension(file); if (tableList.Contains(s2)) { currentWriteTime[s2] = s1; } } return(currentWriteTime); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var tableCollection = new ConfigTableCollection(); while (reader.Read()) { switch (reader.TokenType) { case JsonToken.EndObject: return(tableCollection); case JsonToken.PropertyName: var tableName = (string)reader.Value; reader.Read(); var table = serializer.Deserialize <ConfigTable>(reader); table.name = tableName; tableCollection.Add(table); break; } } return(tableCollection); }