private static void ExtractProfile(string filename) { string _s = Path.Combine(FileManager.GetProfilesFolder(), filename); if (!File.Exists(_s)) { FileManager.ExtractPresetFile(filename, _s); } }
public override void AddNewProfile() { SaveFileDialog _sfd = new SaveFileDialog(); _sfd.InitialDirectory = FileManager.GetProfilesFolder(); _sfd.Title = "Save profile as"; _sfd.DefaultExt = ".tgp"; _sfd.Filter = "ThumbGen Profile (*.tgp)|*.tgp"; if ((bool)_sfd.ShowDialog()) { // save current profile with the new name FileManager.Configuration.SaveConfiguration(_sfd.FileName); // select the new profile as current RefreshProfiles(GetProfileName(_sfd.FileName)); } }
public override void RefreshProfiles(string selectedProfileName) { var oldProfile = SelectedProfile != null ? SelectedProfile.ProfilePath : null; ProfileItem _selectedProfile = null; try { Profiles.Clear(); // ALWAYS on the first position insert the default profile (ThumbGen.tgp, ex config.xml) Profiles.Add(new ProfileItem(Configuration.ConfigFilePath, GetProfileName(Configuration.ConfigFilePath))); // now add the rest string _ProfilesFolder = FileManager.GetProfilesFolder(); if (Directory.Exists(_ProfilesFolder)) { string[] _Profiles = Directory.GetFiles(_ProfilesFolder, "*.tgp", SearchOption.TopDirectoryOnly); if (_Profiles != null && _Profiles.Count() != 0) { foreach (string _ProfilePath in _Profiles) { ProfileItem _Profile = new ProfileItem(_ProfilePath, GetProfileName(_ProfilePath)); Profiles.Add(_Profile); if (!string.IsNullOrEmpty(selectedProfileName) && string.Compare(_Profile.ProfileName, selectedProfileName, true) == 0) { _selectedProfile = _Profile; } } } } if (_selectedProfile == null && selectedProfileName == DefaultProfileName) { _selectedProfile = Profiles[0] as ProfileItem; } } catch (Exception ex) { Loggy.Logger.DebugException("Refresh Profiles", ex); } if (_selectedProfile != null) { _selectedProfile.IsSelected = false; _selectedProfile.IsSelected = true; SelectedProfile = _selectedProfile; OnSelectedProfileChanged(oldProfile, SelectedProfile.ProfilePath); FileManager.Configuration.LoadConfiguration(_selectedProfile.ProfilePath); } }
private void DoProfile() { if (!string.IsNullOrEmpty(m_ProfileName)) { bool _isDefault = m_ProfileName == "default" || m_ProfileName == "<default>"; string _newProfile = _isDefault ? Configuration.ConfigFilePath : Path.Combine(FileManager.GetProfilesFolder(), m_ProfileName); if (File.Exists(_newProfile)) { FileManager.ProfilesMan.SwitchProfiles(FileManager.ProfilesMan.SelectedProfile.ProfilePath, _newProfile); try { Loggy.Logger.Debug("Profile used:"); Loggy.Logger.Debug(FileManager.Configuration.Options.Save()); } catch { } } } }