public KeyboardMappingsService(ICommandManager commandManager, IXmlSerializer xmlSerializer) { Argument.IsNotNull(() => commandManager); Argument.IsNotNull(() => xmlSerializer); _commandManager = commandManager; _xmlSerializer = xmlSerializer; _fileName = Path.Combine(Path.GetApplicationDataDirectory(), "keyboardmappings.xml"); }
public void GetApplicationDataDirectory_CompanyAndApp() { string expected = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Assembly.GetExecutingAssembly().Company(), Assembly.GetExecutingAssembly().Product()); string result = Path.GetApplicationDataDirectory(Assembly.GetExecutingAssembly().Company(), Assembly.GetExecutingAssembly().Product()); Assert.AreEqual(expected, result); }
public FileSystemSnapshotStorageService(IDirectoryService directoryService, IFileService fileService) { Argument.IsNotNull(() => directoryService); Argument.IsNotNull(() => fileService); _directoryService = directoryService; _fileService = fileService; Directory = Path.Combine(Path.GetApplicationDataDirectory(), "snapshots"); }
private static string GetWindowStorageFile(this Window window) { Argument.IsNotNull(() => window); var appData = Path.GetApplicationDataDirectory(); var directory = Path.Combine(appData, "windows"); Directory.CreateDirectory(directory); var file = Path.Combine(directory, $"{window.GetType().FullName}.dat"); return(file); }
public static string GetRootDirectory() { var directory = Path.GetApplicationDataDirectory(); directory = Path.Combine(directory, "search"); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } return(directory); }
public RecentlyUsedItemsService(IXmlSerializer xmlSerializer) { Argument.IsNotNull(() => xmlSerializer); _xmlSerializer = xmlSerializer; _fileName = Path.Combine(Path.GetApplicationDataDirectory(), "recentlyused.xml"); _items = new RecentlyUsedItems(); MaximumItemCount = 10; Load(); }
public static void CleanUpAllLogTypeFiles(bool keepCleanInRealTime = false) { var directory = Path.Combine(Path.GetApplicationDataDirectory(), "log"); foreach (var prefix in LogFilePrefixes.All) { var filter = prefix + "*.log"; CleanUpLogFiles(directory, filter); if (keepCleanInRealTime) { ConfigureFileSystemWatcher(directory, filter); } } }
public static ILogListener CreateFileLogListener(string prefix) { Argument.IsNotNull(() => prefix); var directory = Path.Combine(Path.GetApplicationDataDirectory(), "log"); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); } var fileName = Path.Combine(directory, prefix + "_{Date}_{Time}_{ProcessId}"); var fileLogListener = new Orchestra.Logging.FileLogListener(fileName, 10 * 1024); return(fileLogListener); }
public void GetApplicationDataDirectory_CompanyAndAppAndTestDirectoryCreation() { // Set up directory string directory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), Assembly.GetExecutingAssembly().Company(), Assembly.GetExecutingAssembly().Product()); // Make sure that the directory does not exist if (Directory.Exists(directory)) { Directory.Delete(directory); } // Now create the directory string result = Path.GetApplicationDataDirectory(Assembly.GetExecutingAssembly().Company(), Assembly.GetExecutingAssembly().Product()); // Check if the directory exists Assert.AreEqual(directory, result); Assert.IsTrue(Directory.Exists(result)); }