public GetCreationTime ( string path ) : DateTimeOffset | ||
path | string | |
return | DateTimeOffset |
private static void CleanupLogs(IsolatedStorageFile store, string logFolder) { var files = store.GetFileNames(logFolder); var fileCount = files.Count(); if (fileCount > MAX_FILE_COUNT - 1) { var filesAgeAsc = from file in files let age = store.GetCreationTime(file) orderby age ascending select file; var deleteFiles = filesAgeAsc.Take(fileCount - MAX_FILE_COUNT + 1); foreach (var file in deleteFiles) { var filePath = Path.Combine(logFolder, file); store.DeleteFile(filePath); } } }