public JetBoxSettingsStorage(Lifetime lifetime, ProductSettingsLocation productSettingsLocation, ISettingsSchema settingsSchema, DataContexts dataContexts, IThreading threading, IFileSystemTracker fileSystemTracker, FileSettingsStorageBehavior settingsStorageBehavior, ISettingsLogger settingsLogger, ISettingsChangeDispatch settingsChangeDispatch, SettingsStorageMountPoints.SelfCheckControl selfCheckControl) { var filePath = productSettingsLocation.GetUserSettingsNonRoamingDir(ProductSettingsLocationFlag.ThisProductThisVersionThisEnvironment).Combine("JetBox" + XmlFileSettingsStorage.SettingsStorageFileExtensionWithDot); var property = new Property<FileSystemPath>(lifetime, GetType().Name + "Path", filePath); var settingsProvider = new JetBoxSettingsProvider(lifetime, GetType().Name + "::Provider", property, true, 0, IsAvailable.Always, SettingsStoreSerializationToXmlDiskFile.SavingEmptyContent.DeleteFile, threading, fileSystemTracker, settingsStorageBehavior, new Dictionary<PropertyId, object>()); var mounts = new SettingsStorageMountPoints(lifetime, new CollectionEvents<IProvider<ISettingsStorageMountPoint>>(lifetime, GetType() + "::Mounts") { settingsProvider }, threading, settingsLogger, selfCheckControl); mySettingsStore = new SettingsStore(lifetime, settingsSchema, mounts, dataContexts, null, settingsLogger, settingsChangeDispatch ); }
public SettingsLoader(Lifetime lifetime, SimpleExtensionManager extensionManager, UserInjectedSettingsLayers userInjectedSettingsLayers, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior) { // Check to see if we've been loaded as an extension - so we're either loaded // as a plugin on the command line (debugging) or we're in an environment that // doesn't support the default extension provider (e.g. VS2008) if (extensionManager.IsInstalled()) return; var files = GetSettingsFiles(); foreach (var file in files) { MountSettingsFile(lifetime, extensionManager.ExtensionId, file, extensionManager.SettingsMountPointId, threading, filetracker, behavior, userInjectedSettingsLayers); } }
public TemplatesLoader(Lifetime lifetime, GlobalSettings globalSettings, UserInjectedSettingsLayers userInjectedSettingsLayers, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior) { var path = GetSettingsFile(); var persistentId = new UserInjectedSettingsLayers.InjectedLayerPersistentIdentity(AngularJsInjectedLayerId); var pathAsProperty = new Property<FileSystemPath>(lifetime, "InjectedFileStoragePath", path); var serialization = new XmlFileSettingsStorage(lifetime, "angularjs-templates::" + path.FullPath.QuoteIfNeeded(), pathAsProperty, SettingsStoreSerializationToXmlDiskFile.SavingEmptyContent.DeleteFile, threading, filetracker, behavior); var descriptor = new UserInjectedSettingsLayers.UserInjectedLayerDescriptor(lifetime, globalSettings.ProductGlobalLayerId, persistentId, serialization.Storage, SettingsStorageMountPoint.MountPath.Default, () => { }); descriptor.InitialMetadata.Set(UserFriendlySettingsLayers.DisplayName, "angularjs-templates"); descriptor.InitialMetadata.Set(UserFriendlySettingsLayers.Origin, "AngularJS plugin"); descriptor.InitialMetadata.Set(PreventDeletion, true); descriptor.InitialMetadata.Set(PreventReset, true); userInjectedSettingsLayers.RegisterUserInjectedLayer(lifetime, descriptor); }
public TemplatesLoader(Lifetime lifetime, GlobalSettings globalSettings, UserInjectedSettingsLayers userInjectedSettingsLayers, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior) { var path = GetSettingsFile(); var persistentId = new UserInjectedSettingsLayers.InjectedLayerPersistentIdentity(AngularJsInjectedLayerId); var pathAsProperty = new Property <FileSystemPath>(lifetime, "InjectedFileStoragePath", path); var serialization = new XmlFileSettingsStorage(lifetime, "angularjs-templates::" + path.FullPath.QuoteIfNeeded(), pathAsProperty, SettingsStoreSerializationToXmlDiskFile.SavingEmptyContent.DeleteFile, threading, filetracker, behavior); var descriptor = new UserInjectedSettingsLayers.UserInjectedLayerDescriptor(lifetime, globalSettings.ProductGlobalLayerId, persistentId, serialization.Storage, SettingsStorageMountPoint.MountPath.Default, () => { }); descriptor.InitialMetadata.Set(UserFriendlySettingsLayers.DisplayName, "angularjs-templates"); descriptor.InitialMetadata.Set(UserFriendlySettingsLayers.Origin, "AngularJS plugin"); descriptor.InitialMetadata.Set(PreventDeletion, true); descriptor.InitialMetadata.Set(PreventReset, true); userInjectedSettingsLayers.RegisterUserInjectedLayer(lifetime, descriptor); }
public SettingsLoader(Lifetime lifetime, SimpleExtensionManager extensionManager, UserInjectedSettingsLayers userInjectedSettingsLayers, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior) { // Check to see if we've been loaded as an extension - so we're either loaded // as a plugin on the command line (debugging) or we're in an environment that // doesn't support the default extension provider (e.g. VS2008) if (extensionManager.IsInstalled()) { return; } var files = GetSettingsFiles(); foreach (var file in files) { MountSettingsFile(lifetime, extensionManager.ExtensionId, file, extensionManager.SettingsMountPointId, threading, filetracker, behavior, userInjectedSettingsLayers); } }
private void MountSettingsFile(Lifetime lifetime, string pluginId, FileSystemPath path, UserFriendlySettingsLayer.Identity hostId, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior, UserInjectedSettingsLayers userInjectedSettingsLayers) { var id = string.Format("extension::{0}-{1}", pluginId, path.Name); var persistentId = new LayerId(id); var pathAsProperty = new Property<FileSystemPath>(lifetime, "InjectedFileStoragePath", path); var serialization = CreateXmlFileSettingsStorage(lifetime, threading, filetracker, behavior, id, pathAsProperty); var descriptor = new LayerDescriptor(lifetime, hostId, persistentId, serialization.Storage, MountPath.Default, () => { }); descriptor.InitialMetadata.Set(UserFriendlySettingsLayers.DisplayName, string.Format("{0} » {1}", pluginId, path.NameWithoutExtension)); descriptor.InitialMetadata.Set(UserFriendlySettingsLayers.Origin, string.Format("Published by plugin: {0}", pluginId)); descriptor.InitialMetadata.Set(UserFriendlySettingsLayers.DiskFilePath, path); descriptor.InitialMetadata.Set(IsNonUserEditable, true); userInjectedSettingsLayers.RegisterUserInjectedLayer(lifetime, descriptor); }
private void MountSettingsFile(Lifetime lifetime, string pluginId, FileSystemPath path, UserFriendlySettingsLayer.Identity hostId, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior, UserInjectedSettingsLayers userInjectedSettingsLayers) { var id = string.Format("extension::{0}-{1}", pluginId, path.Name); var persistentId = new LayerId(id); var pathAsProperty = new Property <FileSystemPath>(lifetime, "InjectedFileStoragePath", path); var serialization = CreateXmlFileSettingsStorage(lifetime, threading, filetracker, behavior, id, pathAsProperty); var descriptor = new LayerDescriptor(lifetime, hostId, persistentId, serialization.Storage, MountPath.Default, () => { }); descriptor.InitialMetadata.Set(UserFriendlySettingsLayers.DisplayName, string.Format("{0} » {1}", pluginId, path.NameWithoutExtension)); descriptor.InitialMetadata.Set(UserFriendlySettingsLayers.Origin, string.Format("Published by plugin: {0}", pluginId)); descriptor.InitialMetadata.Set(UserFriendlySettingsLayers.DiskFilePath, path); descriptor.InitialMetadata.Set(IsNonUserEditable, true); userInjectedSettingsLayers.RegisterUserInjectedLayer(lifetime, descriptor); }
private static XmlFileSettingsStorage CreateXmlFileSettingsStorage(Lifetime lifetime, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior, string id, Property<FileSystemPath> pathAsProperty) { return new XmlFileSettingsStorage(lifetime, id, pathAsProperty, SaveEmptyFilePolicy.KeepFile, threading, filetracker, behavior); }
private static XmlFileSettingsStorage CreateXmlFileSettingsStorage(Lifetime lifetime, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior, string id, Property <FileSystemPath> pathAsProperty) { return(new XmlFileSettingsStorage(lifetime, id, pathAsProperty, SaveEmptyFilePolicy.KeepFile, threading, filetracker, behavior)); }
public JetBoxSettingsStorage(Lifetime lifetime, ProductSettingsLocation productSettingsLocation, ISettingsSchema settingsSchema, DataContexts dataContexts, IThreading threading, IFileSystemTracker fileSystemTracker, FileSettingsStorageBehavior settingsStorageBehavior, ISettingsLogger settingsLogger, ISettingsChangeDispatch settingsChangeDispatch, SettingsStorageMountPoints.SelfCheckControl selfCheckControl) { var filePath = productSettingsLocation.GetUserSettingsNonRoamingDir(ProductSettingsLocationFlag.ThisProductThisVersionThisEnvironment).Combine("JetBox" + XmlFileSettingsStorage.SettingsStorageFileExtensionWithDot); var property = new Property <FileSystemPath>(lifetime, GetType().Name + "Path", filePath); var settingsProvider = new JetBoxSettingsProvider(lifetime, GetType().Name + "::Provider", property, true, 0, IsAvailable.Always, SettingsStoreSerializationToXmlDiskFile.SavingEmptyContent.DeleteFile, threading, fileSystemTracker, settingsStorageBehavior, new Dictionary <PropertyId, object>()); var mounts = new SettingsStorageMountPoints(lifetime, new CollectionEvents <IProvider <ISettingsStorageMountPoint> >(lifetime, GetType() + "::Mounts") { settingsProvider }, threading, settingsLogger, selfCheckControl); mySettingsStore = new SettingsStore(lifetime, settingsSchema, mounts, dataContexts, null, settingsLogger, settingsChangeDispatch); }
public JetBoxSettingsProvider([NotNull] Lifetime lifetime, [NotNull] string name, [NotNull] IProperty <FileSystemPath> path, bool isWritable, double priority, [NotNull] IIsAvailable isAvailable, SettingsStoreSerializationToXmlDiskFile.SavingEmptyContent whenNoContent, [NotNull] IThreading threading, [NotNull] IFileSystemTracker filetracker, [NotNull] FileSettingsStorageBehavior behavior, IEnumerable <KeyValuePair <PropertyId, object> > metadata) : base(lifetime, name, path, isWritable, priority, isAvailable, whenNoContent, threading, filetracker, behavior, metadata) { }
public FindAndLoadSettings(Lifetime lifetimeComponent, SettingsStorageProvidersCollection publisher, SolutionFileLocationLive solfile, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior, ISolution solution, IShellLocks locks) { // In case the solution path changes, watch each value anew solfile.SolutionFileLocation.ForEachValue_NotNull(lifetimeComponent, (lifetimeLocation, location) => { double priority = ProjectModelSettingsStorageMountPointPriorityClasses.SolutionShared; for (FileSystemPath dir = location.Directory; !dir.IsNullOrEmpty(); dir = dir.Directory) { try { priority *= .9; // The upper folder, the lower priority (regular solution-shared file takes over all of them) // Walk up folders // TODO: add file-system-watcher here foreach (FileSystemPath settingsfile in dir.GetChildFiles("*." + AutoLoadExtension, PathSearchFlags.ExcludeDirectories | PathSearchFlags.ExcludeHidden)) { var relativePath = settingsfile.MakeRelativeTo(location.Directory).FullPath; var name = relativePath.Replace("." + AutoLoadExtension, ""); // Physical storage IProperty <FileSystemPath> livepath = new Property <FileSystemPath>(lifetimeLocation, "StoragePath", settingsfile); var storage = new XmlFileSettingsStorage(lifetimeLocation, name, livepath, SettingsStoreSerializationToXmlDiskFile.SavingEmptyContent.KeepFile, threading, filetracker, behavior, null); // Mount as a layer IIsAvailable availability = new IsAvailableByDataConstant <ISolution>(lifetimeLocation, ProjectModelDataConstants.SOLUTION, solution, locks); // Only when querying in solution context (includes Application-Wide) ISettingsStorageMountPoint mount = new SettingsStorageMountPoint(storage.Storage, SettingsStorageMountPoint.MountPath.Default, 0, priority, availability, name); // Metadata livepath.FlowInto(lifetimeLocation, mount.Metadata.GetOrCreateProperty(UserFriendlySettingsLayers.DiskFilePath, null, true)); mount.Metadata.Set(UserFriendlySettingsLayers.Origin, string.Format("Automatically loaded from solution parent folder, \"{0}\"", relativePath)); mount.Metadata.Set(UserInjectedSettingsLayers.IsHostingUserInjections, true); // Publish publisher.Storages.Add(lifetimeLocation, storage.Storage); publisher.MountPoints.Add(lifetimeLocation, mount); } } catch (Exception ex) { Logger.LogException(ex); } } }); }
private static XmlFileSettingsStorage CreateXmlFileSettingsStorage(Lifetime lifetime, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior, string id, Property <FileSystemPath> pathAsProperty) { var internKeyPathComponent = Shell.Instance.GetComponent <InternKeyPathComponent>(); return(new XmlFileSettingsStorage(lifetime, id, pathAsProperty, SavingEmptyContent.KeepFile, threading, filetracker, behavior, internKeyPathComponent)); }
private static XmlFileSettingsStorage CreateXmlFileSettingsStorage(Lifetime lifetime, IThreading threading, IFileSystemTracker filetracker, FileSettingsStorageBehavior behavior, string id, Property<FileSystemPath> pathAsProperty) { var internKeyPathComponent = Shell.Instance.GetComponent<InternKeyPathComponent>(); return new XmlFileSettingsStorage(lifetime, id, pathAsProperty, SavingEmptyContent.KeepFile, threading, filetracker, behavior, internKeyPathComponent); }