protected override void OnNavigatedTo(NavigationEventArgs eventArgs) { base.OnNavigatedTo(eventArgs); currentIconSize = FolderSettings.GetIconSize(); FolderSettings.LayoutModeChangeRequested -= FolderSettings_LayoutModeChangeRequested; FolderSettings.LayoutModeChangeRequested += FolderSettings_LayoutModeChangeRequested; ParentShellPageInstance.FilesystemViewModel.FilesAndFolders.CollectionChanged += FilesAndFolders_CollectionChanged; if (FileList.ItemsSource == null) { FileList.ItemsSource = ParentShellPageInstance.FilesystemViewModel.FilesAndFolders; } var parameters = (NavigationArguments)eventArgs.Parameter; if (parameters.IsLayoutSwitch) { ReloadItemIcons(); UpdateItemColumnViewModels(); } UpdateSortOptionsCommand = new RelayCommand <string>(x => { var val = Enum.Parse <SortOption>(x); if (ParentShellPageInstance.FilesystemViewModel.folderSettings.DirectorySortOption == val) { ParentShellPageInstance.FilesystemViewModel.folderSettings.DirectorySortDirection = (SortDirection)(((int)ParentShellPageInstance.FilesystemViewModel.folderSettings.DirectorySortDirection + 1) % 2); } else { ParentShellPageInstance.FilesystemViewModel.folderSettings.DirectorySortOption = val; ParentShellPageInstance.FilesystemViewModel.folderSettings.DirectorySortDirection = SortDirection.Ascending; } }); }
public void Query_Recursive_WhenCalled(string search, int folders, int files, bool truncated) { const int maxFolderSetting = 3; // Setup var folderSettings = new FolderSettings() { MaxFileResults = maxFolderSetting, MaxFolderResults = maxFolderSetting, }; var queryInternalDirectory = new QueryInternalDirectory(folderSettings, _queryFileSystemInfoMock, _fileSystem.Directory); // Act var isDriveOrSharedFolder = queryInternalDirectory.Query(search) .ToLookup(r => r.GetType()); // Assert Assert.AreEqual(files, isDriveOrSharedFolder[typeof(FileItemResult)].Count(), "File count doesn't match"); Assert.AreEqual(folders, isDriveOrSharedFolder[typeof(FolderItemResult)].Count(), "folder count doesn't match"); // Always check if there is less than max folders Assert.LessOrEqual(isDriveOrSharedFolder[typeof(FileItemResult)].Count(), maxFolderSetting, "Files are not limited"); Assert.LessOrEqual(isDriveOrSharedFolder[typeof(FolderItemResult)].Count(), maxFolderSetting, "Folders are not limited"); // Checks if CreateOpenCurrentFolder is displayed Assert.AreEqual(Math.Min(folders + files, 1), isDriveOrSharedFolder[typeof(CreateOpenCurrentFolderResult)].Count(), "CreateOpenCurrentFolder displaying is incorrect"); Assert.AreEqual(truncated, isDriveOrSharedFolder[typeof(TruncatedItemResult)].Count() == 1, "CreateOpenCurrentFolder displaying is incorrect"); }
private static void DisposeDBs() { string dbPath = FolderSettings.DatabaseName; bool isRemotePath = (!string.IsNullOrEmpty(dbPath) && PathIsNetworkPath(dbPath)); if (isRemotePath) { Log.Info("Settings: disposing FolderDatabase3 sqllite database."); FolderSettings.Dispose(); } dbPath = PictureDatabase.DatabaseName; isRemotePath = (!string.IsNullOrEmpty(dbPath) && PathIsNetworkPath(dbPath)); if (isRemotePath) { Log.Info("Settings: disposing PictureDatabase sqllite database."); PictureDatabase.Dispose(); } dbPath = MediaPortal.Video.Database.VideoDatabase.DatabaseName; isRemotePath = (!string.IsNullOrEmpty(dbPath) && PathIsNetworkPath(dbPath)); if (isRemotePath) { Log.Info("Settings: disposing VideoDatabaseV5.db3 sqllite database."); MediaPortal.Video.Database.VideoDatabase.Dispose(); } dbPath = MediaPortal.Music.Database.MusicDatabase.Instance.DatabaseName; isRemotePath = (!string.IsNullOrEmpty(dbPath) && PathIsNetworkPath(dbPath)); if (isRemotePath) { Log.Info("Settings: disposing MusicDatabase db3 sqllite database."); MediaPortal.Music.Database.MusicDatabase.Dispose(); } }
public ContentManager(FolderSettings settings) : base(null) { Settings = settings; Name = "Content Manager"; PathName = ""; }
static public string GetActiveConfigurationName(string rootPath) { ThreadHelper.ThrowIfNotOnUIThread(); string activeConfigFilename = GetActiveConfigurationFileName(rootPath); if (File.Exists(activeConfigFilename)) { var activeConfig = new FolderActiveConfiguration(); try { string jsonString = File.ReadAllText(activeConfigFilename); activeConfig = JsonConvert.DeserializeObject <FolderActiveConfiguration>(jsonString); } catch (Exception e) { OutputLog.Error(e.Message); } if (activeConfig != null) { return(activeConfig.CurrentProjectSetting); } } //try to return the first config if the active file is not present FolderSettings configs = GetConfigurations(rootPath); return(configs != null && configs.configurations.Count > 0? configs.configurations[0].name : null); }
public EditItemPropertiesControl(string webURL, List <ApplicationItemProperty> properties, List <ContentType> contentTypes, FolderSettings folderSettings, FolderSetting defaultFolderSetting, ISiteSetting siteSetting, string rootFolder, Dictionary <string, string> defaultValues, bool displayFileName) { InitializeComponent(); _contentTypes = contentTypes; _properties = properties; _folderSettings = folderSettings; _defaultFolderSetting = defaultFolderSetting; _siteSetting = siteSetting; _rootFolder = rootFolder; _defaultValues = defaultValues; _webURL = webURL; _displayFileName = displayFileName; CheckInAfter.IsChecked = siteSetting.CheckInAfterEditProperties; isFolder = GetProperty(defaultValues, "ows_FSObjType", true, false) == "1"; foreach (ContentType contentType in _contentTypes) { ContentTypeComboBox.Items.Add(new { Name = contentType.Name, ID = contentType }); } if (_contentTypes.Count > 0) { ContentTypeComboBox.SelectedIndex = 0; } displayGenericField(defaultValues); }
private void AddButton_Click(object sender, RoutedEventArgs e) { var dir = new OpenDirectoryDialog().OpenDirectory(); if (string.IsNullOrWhiteSpace(dir) == false) { var reader = new FolderSettingsFileReader(); var settings = reader.ReadFileAsync(dir).Result; if (settings == null) { var vm = AddDirectoryDialog.Show(dir); if (vm == null) { return; } settings = new FolderSettings((uint)vm.DaysBeforeRemoval, (DirectoriesDeleteBehaviour)vm.BehaviourID); var writer = new FolderSettingsFileSaver(); writer.SaveAsync(settings, dir).Wait(); } var specificSettings = new SpecificFolderSetting(dir, settings); App.Oldi.AddSettings(specificSettings); vm.FolderSettingItems.Add(new FolderSettingItemViewModel(specificSettings)); } }
public void OpenFolderSettingsTest() { using (TestFile testFile = new TestFile(string.Empty)) { FolderSettings folders = new FolderSettings(null, SettingsStore.GetSettingsStore(StoreType.Ini, testFile.FileName, null)); Assert.IsNotNull(folders.Folders); } }
public void ReadSingleFolderTest() { using (TestFile testFile = new TestFile("[Folders]\r\nName=string:Value")) { FolderSettings folders = new FolderSettings(null, SettingsStore.GetSettingsStore(StoreType.Ini, testFile.FileName, null)); Assert.IsTrue(folders.Folders.Count == 1); } }
public StartpointSSISBatch(FileTransferExecuter fileTransferExecuter, FolderSettings folderSettings, DirectoryImpl directoryImpl, AcceptedFileExtensionFactory acceptedFileExtensionFactory, TransferInformationFactory transferInformationFactory) { _fileTransferExecuter = fileTransferExecuter; _folderSettings = folderSettings; _directoryImpl = directoryImpl; _acceptedFileExtensionFactory = acceptedFileExtensionFactory; _transferInformationFactory = transferInformationFactory; }
protected override void Arrange() { base.Arrange(); base.Act(); FolderSettings.Stub(x => x.GetDatasets()).Return(SourceDir); DirectoryImpl.Stub(x => x.CreateDataSetDirectory()).Return(destination); TransferInformationFactory.Stub(x => x.Create(SourceDir, destination)).Return(TransferInformation); AcceptedFileExtensionFactory.Stub(x => x.Create(Extensions)).Return(AcceptedExtensions); }
public IActionResult SetApplicationSettings([FromBody] FolderSettings settings) { _applicationSettings.Update( applicationSettings => { applicationSettings.FolderSettings.TemporaryDataFolder = settings.TemporaryDataFolder; }); return(Ok()); }
protected override void Arrange() { base.Arrange(); base.Act(); FolderSettings.Stub(x => x.GetSsis()).Return(FolderPath); DirectoryImpl.Stub(x => x.ReadDirectory(FolderPath)).Return(Files); FileInfoFactory.Stub(x => x.Create(File1)).Return(FileInfo1); FileInfoFactory.Stub(x => x.Create(File2)).Return(FileInfo2); }
public StartpointSql(FileTransferExecuter fileTransferExecuter, FolderSettings folderSettings, DirectoryImpl directoryImpl, AcceptedFileExtensionFactory acceptedFileExtensionFactory, TransferInformationFactory transferInformationFactory, SqlScriptMerger sqlScriptMerger, AcceptedFilePrefixFactory acceptedFilePrefixFactory) { _fileTransferExecuter = fileTransferExecuter; _folderSettings = folderSettings; _directoryImpl = directoryImpl; _acceptedFileExtensionFactory = acceptedFileExtensionFactory; _transferInformationFactory = transferInformationFactory; _sqlScriptMerger = sqlScriptMerger; _acceptedFilePrefixFactory = acceptedFilePrefixFactory; }
private void DrawStartFromScratch() { EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.Space(); if (GUILayout.Button("Start over from scratch", GUILayout.Height(30))) { if (EditorUtility.DisplayDialog("Create new project?", "This will delete ALL data!", "Start from scratch", "Do nothing")) { FolderSettings.DeleteFolderContent(Application.dataPath + FolderSettings.BankDeleteFolder); int levelSize = 3; GameObject go1 = new GameObject(); GameObject go2 = new GameObject(); GameObject go3 = new GameObject(); GameObject go4 = new GameObject(); Manager.BusTree = AudioBusWorker.CreateTree(go3); Manager.BankLinkTree = AudioBankWorker.CreateTree(go4); Manager.AudioTree = AudioNodeWorker.CreateTree(go1, levelSize, Manager.BusTree); Manager.EventTree = AudioEventWorker.CreateTree(go2, levelSize); SaveAndLoad.CreateDataPrefabs(Manager.AudioTree.gameObject, Manager.EventTree.gameObject, Manager.BusTree.gameObject, Manager.BankLinkTree.gameObject); Manager.Load(true); if (Manager.BankLinkTree != null) { var bankLink = AudioBankWorker.CreateBank(Manager.BankLinkTree.gameObject, Manager.BankLinkTree, GUIDCreator.Create()); bankLink.Name = "Default - Auto loaded"; bankLink.AutoLoad = true; var bankLink2 = AudioBankWorker.CreateBank(Manager.BankLinkTree.gameObject, Manager.BankLinkTree, GUIDCreator.Create()); bankLink2.Name = "Extra"; NodeWorker.AssignToNodes(Manager.AudioTree, node => node.BankLink = Manager.BankLinkTree.GetChildren[0]); } else { Debug.LogError("There was a problem creating the data."); } NodeWorker.AssignToNodes(Manager.AudioTree, node => node.Bus = Manager.BusTree); AssetDatabase.Refresh(); EditorApplication.SaveCurrentSceneIfUserWantsTo(); } } }
public void SavedDedicatdTest() { using (TestFile testFile = new TestFile("[Folders]\r\nName=string:Value")) { FolderSettings source = new FolderSettings(null, SettingsStore.GetSettingsStore(StoreType.Ini, testFile.FileName, null)); source.Folders.Add("Another", "Folder"); source.Save("Another"); FolderSettings target = new FolderSettings(null, SettingsStore.GetSettingsStore(StoreType.Ini, testFile.FileName, null)); Assert.IsTrue(target.Folders.Count == 2); } }
private void FolderSettings_GridViewSizeChangeRequested(object sender, EventArgs e) { var requestedIconSize = FolderSettings.GetIconSize(); // Get new icon size // Prevents reloading icons when the icon size hasn't changed if (requestedIconSize != currentIconSize) { currentIconSize = requestedIconSize; // Update icon size before refreshing ReloadItemIcons(); } }
public void ResetTest() { using (TestFile testFile = new TestFile("[Folders]\r\nName=string:Value")) { FolderSettings source = new FolderSettings(null, SettingsStore.GetSettingsStore(StoreType.Ini, testFile.FileName, null)); source.Reset(); source.Save(); FolderSettings target = new FolderSettings(null, SettingsStore.GetSettingsStore(StoreType.Ini, testFile.FileName, null)); Assert.IsTrue(target.Folders.Count == 0); } }
public void Scan(string directoryPath, Action <ScanResult> scanResultAction, CancellationTokenSource token) { FolderSettings settings = settingsReader.ReadFileAsync(directoryPath).Result; if (settings == null) { return; } Scan(directoryPath, settings, scanResultAction, null); }
public void UpdateSetting(string directoryPath, FolderSettings newSett) { var sett = GetSetting(directoryPath); if (sett != null) { sett.DayAgeToRemove = newSett.DayAgeToRemove; sett.DirectoriesDeleteBehaviour = newSett.DirectoriesDeleteBehaviour; var saver = new FolderSettingsFileSaver(); saver.SaveAsync(newSett, directoryPath).Wait(); } }
public void SetFolderSetting(ApplicationTypes applicationType, FolderSetting folderSetting) { FolderSettings folderSettings = this.Configuration.FolderSettings.GetFolderSettings(applicationType); if (folderSettings[folderSetting.Folder.GetUrl()] != null) { folderSettings[folderSetting.Folder.GetUrl()] = folderSetting; } else { this.Configuration.FolderSettings.Add(folderSetting); } }
private void FolderSettings_LayoutModeChangeRequested(object sender, LayoutModeEventArgs e) { if (FolderSettings.LayoutMode == FolderLayoutModes.GridView || FolderSettings.LayoutMode == FolderLayoutModes.TilesView) { SetItemTemplate(); // Set ItemTemplate var requestedIconSize = FolderSettings.GetIconSize(); if (requestedIconSize != currentIconSize) { currentIconSize = requestedIconSize; ReloadItemIcons(); } } }
public void UpdateFolders(int CurrentSortMethod, bool CurrentSortAsc, int CurrentLayout) { string currentFolder = GUIVideoFiles.GetCurrentFolder; if (currentFolder == string.Empty) { currentFolder = "root"; } if (!OnResetFolderSettings()) { return; } Log.Debug("UpdateFolders: currentFolder {0}", currentFolder); ArrayList strPathList = new ArrayList(); FolderSettings.GetPath(GUIVideoFiles.GetCurrentFolder, ref strPathList, "VideoFiles"); for (int iRow = 0; iRow < strPathList.Count; iRow++) { object o; FolderSettings.GetFolderSetting(strPathList[iRow] as string, "VideoFiles", typeof(GUIVideoFiles.MapSettings), out o); Log.Debug("UpdateFolders: GetFolderSetting {0}", strPathList[iRow] as string); if (o != null) { GUIVideoFiles.MapSettings mapSettings = o as GUIVideoFiles.MapSettings; if (mapSettings == null) { mapSettings = new GUIVideoFiles.MapSettings(); } if (CurrentSortMethod != -1) { Log.Debug("UpdateFolders: old SortBy {0}, new SortBy {1}", mapSettings.SortBy, CurrentSortMethod); mapSettings.SortBy = CurrentSortMethod; mapSettings.SortAscending = CurrentSortAsc; } if (CurrentLayout != -1) { Log.Debug("UpdateFolders: old ViewAs {0}, new ViewAs {1}", mapSettings.ViewAs, CurrentLayout); mapSettings.ViewAs = CurrentLayout; } FolderSettings.AddFolderSetting(strPathList[iRow] as string, "VideoFiles", typeof(GUIVideoFiles.MapSettings), mapSettings); } } }
protected override void Arrange() { base.Arrange(); base.Act(); FolderSettings.Stub(x => x.GetSqlUpdates()).Return(sqlSourceUpdatesPath); FolderSettings.Stub(x => x.GetSqlMaster()).Return(sqlSourceMasterPath); DirectoryImpl.Stub(x => x.CreateSqlMasterDirectory()).Return(sqlDestMasterPath); DirectoryImpl.Stub(x => x.CreateSqlUpdatesDirectory()).Return(sqlDestUpdatesPath); DirectoryImpl.Stub(x => x.CreateSqlRootDirectory()).Return(sqlRootPath); TransferInformationFactory.Stub(x => x.Create(sqlSourceMasterPath, sqlDestMasterPath)) .Return(TransferInformation); AcceptedFileExtensionFactory.Stub(x => x.Create(Extensions)).Return(AcceptedExtensions); AcceptedFilePrefixFactory.Stub(x => x.Create(Prefixes)).Return(AcceptedPrefix); }
/// <summary> /// Loads settings for the current target folder. /// </summary> /// <returns> /// True if the settings file exists and was loaded successfully, otherwise false. /// </returns> public static bool LoadSettings() { string setfile = Path.Combine(TargetFolder, FilePaths.Settings); if (!File.Exists(setfile)) { return(false); } if (!FolderSettings.LoadFromFile(setfile)) { return(Logger.LogReturn("Failed loading settings from file.", false, LogType.Error)); } return(true); }
private DetailedScanItemStatus DetermineScanItemStatus(FolderSettings settings, DateTime lastModificationTime) { if (IsOldEnough(lastModificationTime, timeProvider.Now, settings)) { return(DetailedScanItemStatus.Deletion); } else if (IsOldEnough(lastModificationTime, timeProvider.Now, Math.Max(0, settings.DayAgeToRemove - scannerSettings.WarningDayLiveThreshold))) { return(DetailedScanItemStatus.Warning); } else { return(DetailedScanItemStatus.DoNotDelete); } }
public static void EditItemPropertyMappings(ISiteSetting siteSetting, Folder folder) { FolderSettings folderSettings = ConfigurationManager.GetInstance().Configuration.FolderSettings; ItemPropertyMappingsForm itemPropertyMappings = new ItemPropertyMappingsForm(); itemPropertyMappings.Initialize(ConfigurationManager.GetInstance().Configuration.SiteSettings, folder, ApplicationContext.Current.GetApplicationType(), ConfigurationManager.GetInstance().Configuration.FolderSettings); if (itemPropertyMappings.ShowDialog(null, Languages.Translate("Item Property Mappings")) == true) { ConfigurationManager.GetInstance().SaveAppConfiguration(); } else { ConfigurationManager.GetInstance().LoadConfiguration(); } }
public void Settings_AfterSaveShouldBeAbleToload() { CreateTempDirectory(); foreach (DirectoriesDeleteBehaviour behaviour in Enum.GetValues(typeof(DirectoriesDeleteBehaviour)).Cast <DirectoriesDeleteBehaviour>()) { DeleteTempFileIfExists(); FolderSettings settings = new FolderSettings(dayAgeToRemove: 35, directoriesDeleteBehaviour: behaviour); settingsSaver.SaveAsync(settings, tempFileDirectory); FolderSettings loaded = settingsReader.ReadFileAsync(tempFileDirectory).Result; Assert.Equal(settings.DayAgeToRemove, loaded.DayAgeToRemove); Assert.Equal(settings.DirectoriesDeleteBehaviour, loaded.DirectoriesDeleteBehaviour); } }
private void FolderSettings_LayoutModeChangeRequested(object sender, EventArgs e) { if (ParentShellPageInstance.ContentPage != null) { var layoutType = FolderSettings.GetLayoutType(ParentShellPageInstance.FilesystemViewModel.WorkingDirectory); ParentShellPageInstance.ContentFrame.Navigate(layoutType, new NavigationArguments() { NavPathParam = ParentShellPageInstance.FilesystemViewModel.WorkingDirectory, AssociatedTabInstance = ParentShellPageInstance }, null); // Remove old layout from back stack ParentShellPageInstance.ContentFrame.BackStack.RemoveAt(ParentShellPageInstance.ContentFrame.BackStack.Count - 1); } }
public static void RestartMP() { bool hideTaskBar = false; using (Settings xmlreader = new MPSettings()) { hideTaskBar = xmlreader.GetValueAsBool("general", "hidetaskbar", false); } if (hideTaskBar) { Win32API.EnableStartBar(true); Win32API.ShowStartBar(true); } Log.Info("argustv: OnRestart - prepare for restart!"); File.Delete(Config.GetFile(Config.Dir.Config, "mediaportal.running")); Log.Info("argustv: OnRestart - saving settings..."); Settings.SaveCache(); Log.Info("argustv: disposing databases."); FolderSettings.Dispose(); PictureDatabase.Dispose(); VideoDatabase.Dispose(); MusicDatabase.Dispose(); VolumeHandler.Dispose(); System.Diagnostics.Process restartScript = new System.Diagnostics.Process(); restartScript.EnableRaisingEvents = false; restartScript.StartInfo.WorkingDirectory = Config.GetFolder(Config.Dir.Base); restartScript.StartInfo.FileName = Config.GetFile(Config.Dir.Base, @"restart.vbs"); Log.Debug("argustv: OnRestart - executing script {0}", restartScript.StartInfo.FileName); restartScript.Start(); try { // Maybe the scripting host is not available therefore do not wait infinitely. if (!restartScript.HasExited) { restartScript.WaitForExit(); } } catch (Exception ex) { Log.Error("argustv: OnRestart - WaitForExit: {0}", ex.Message); } }