public static DistributedApplicationData AddFilePersistence( this DistributedApplicationData applicationData , IServiceProvider provider , ISettingsMetadata metadata , SettingsScopes settingsScope = SettingsScopes.Both , string localRootPath = ".\\Local" , string roamingRootPath = ".\\Roaming") { FilePersistenceManager.Build(provider); if (settingsScope == SettingsScopes.Both || settingsScope == SettingsScopes.Local) { FilePersistenceManager.Current.AddApplicationData( applicationData.LocalSettings, settingsScope); } if (settingsScope == SettingsScopes.Both || settingsScope == SettingsScopes.Roaming) { FilePersistenceManager.Current.AddApplicationData( applicationData.RoamingSettings, settingsScope); } applicationData.DataChanged += ApplicationDataOnDataChanged; return(applicationData); }
private DistributedApplicationDataContainer GetContainer( IDistributedPropertySet data , SettingsScopes settingsScope , string name = "Temporary") { switch (settingsScope) { case SettingsScopes.Local: DistributedApplicationData.Current.LocalSettings.Values.SetValues(data); return(DistributedApplicationData.Current.LocalSettings); case SettingsScopes.Roaming: DistributedApplicationData.Current.RoamingSettings.Values.SetValues(data); return(DistributedApplicationData.Current.RoamingSettings); case SettingsScopes.Both: return(null); default: { var container = DistributedApplicationData.Current.LocalSettings.CreateContainer(name, DistributedApplicationDataLocality.Temporary); container.Values.SetValues(data); return(container); } } }
public SettingsProvider(string path, SettingsScopes scopes = SettingsScopes.Any) { settingsPath = path; name = Path.GetFileName(settingsPath); pathTokens = settingsPath.Split('/'); this.scopes = scopes; keywords = new HashSet <string>(); }
public FilePersistenceMapping(DistributedApplicationDataContainer container , SettingsScopes settingsScope , string fileName, string filePath) { Container = container ?? throw new ArgumentNullException(nameof(container)); SettingsScope = settingsScope; FileName = fileName ?? throw new ArgumentNullException(nameof(fileName)); FilePath = filePath ?? throw new ArgumentNullException(nameof(filePath)); Container.Values.MapChanged += ValuesOnMapChanged; }
internal static SettingsWindow Show(SettingsScopes scopes, string settingsPath = null) { var settingsWindow = FindWindowByScope(scopes) ?? Create(scopes); settingsWindow.Show(); if (settingsPath != null) { settingsWindow.SelectProviderByName(settingsPath); } return(settingsWindow); }
public DistributedApplicationDataContainer CreateFile(string name, string path, SettingsScopes settingsScope, IDistributedPropertySet seedValues = null) { var filePath = Path.Combine(path, $"{name}.{FileExtension}"); if (!File.Exists(filePath)) { Writer.WriteFile(name, path, seedValues); } return(OpenFile(name, path, settingsScope)); }
private static SettingsWindow Create(SettingsScopes scopes) { var settingsWindow = CreateInstance <SettingsWindow>(); settingsWindow.m_Scopes = scopes; if ((scopes & SettingsScopes.Project) != 0) { settingsWindow.titleContent.text = "Settings"; } else if ((scopes & SettingsScopes.User) != 0) { settingsWindow.titleContent.text = "Preferences"; } else { settingsWindow.titleContent.text = scopes.ToString(); } settingsWindow.Init(); return(settingsWindow); }
public ModifyEditorStyleProvider(string path, SettingsScopes scopes = SettingsScopes.Any) : base(path, scopes) { }
public SettingsWindow() { m_SearchFieldGiveFocus = true; m_Scopes = SettingsScopes.None; }
internal static SettingsWindow FindWindowByScope(SettingsScopes scopes) { var settingsWindows = Resources.FindObjectsOfTypeAll(typeof(SettingsWindow)).Cast <SettingsWindow>(); return(settingsWindows.FirstOrDefault(settingsWindow => (settingsWindow.m_Scopes & scopes) != 0)); }
public ProtobufUnitySettingsProvider(string path, SettingsScopes scopes = SettingsScopes.Any) : base(path, scopes) { }
public DistributedApplicationDataContainer WriteFile(string name, string path, SettingsScopes settingsScope, IDistributedPropertySet currentValues) { Writer.WriteFile(name, path, currentValues); return(settingsScope == SettingsScopes.Local ? DistributedApplicationData.Current.LocalSettings : DistributedApplicationData.Current.RoamingSettings); }
public DistributedApplicationDataContainer OpenFile(string name, string path, SettingsScopes settingsScope) { var filePath = Path.Combine(path, $"{name}.{this.FileExtension}"); var data = Reader.ReadFile(name, path); return(GetContainer(data, settingsScope, name)); }