public static void AddToLastOpen(string path) { // We don't want to same item added to list mulitple times, so we need to // filter out dupliate item and then append new item. // var fullPath = Path.GetFullPath(path); LAST_OPENED_FILES.RemoveAll(p => p.Equals(fullPath, StringComparison.OrdinalIgnoreCase)); LAST_OPENED_FILES.Add(fullPath); // Save data to cache file File.WriteAllLines(PathManager.GetLastOpenedFilePath(), LAST_OPENED_FILES.ToArray()); }
public static void RefreshAllowedFilesCache() { var files = Utility.GetAllAllowedFiles(OnLoad.WORKING_DIRECTORY); ALLOWED_FILES_CACHE.Clear(); foreach (var item in files) { ALLOWED_FILES_CACHE.Add(item); } File.WriteAllLines(PathManager.GetGoToFileCachePath(), files.ToArray()); var lastOpenedFilesCache = PathManager.GetLastOpenedFilePath(); if (File.Exists(lastOpenedFilesCache)) { var filesInCache = File.ReadAllLines(lastOpenedFilesCache); LAST_OPENED_FILES = filesInCache.ToList(); } }