public KeyboardMappingsService(ICommandManager commandManager, IXmlSerializer xmlSerializer)
        {
            Argument.IsNotNull(() => commandManager);
            Argument.IsNotNull(() => xmlSerializer);

            _commandManager = commandManager;
            _xmlSerializer  = xmlSerializer;
            _fileName       = Path.Combine(Path.GetApplicationDataDirectory(), "keyboardmappings.xml");
        }
Exemplo n.º 2
0
        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");
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        public static string GetRootDirectory()
        {
            var directory = Path.GetApplicationDataDirectory();

            directory = Path.Combine(directory, "search");

            if (!Directory.Exists(directory))
            {
                Directory.CreateDirectory(directory);
            }

            return(directory);
        }
Exemplo n.º 6
0
        public RecentlyUsedItemsService(IXmlSerializer xmlSerializer)
        {
            Argument.IsNotNull(() => xmlSerializer);

            _xmlSerializer = xmlSerializer;

            _fileName = Path.Combine(Path.GetApplicationDataDirectory(), "recentlyused.xml");
            _items    = new RecentlyUsedItems();

            MaximumItemCount = 10;

            Load();
        }
Exemplo n.º 7
0
        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);
                }
            }
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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));
        }