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 JetBoxSettingsStorage(Lifetime lifetime, ProductSettingsLocation productSettingsLocation, ISettingsSchema settingsSchema, DataContexts dataContexts, IThreading threading, IFileSystemTracker fileSystemTracker, IFileSettingsStorageBehavior settingsStorageBehavior, ISettingsLogger settingsLogger, ISettingsChangeDispatch settingsChangeDispatch, SettingsStorageMountPoints.SelfCheckControl selfCheckControl, InternKeyPathComponent interned) { var filePath = productSettingsLocation.GetUserSettingsNonRoamingDir(ApplicationHostDetails.PerHostAndWave).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, interned, 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 AnnotationsLoaderHack(ExternalAnnotationsManager manager, ProductSettingsLocation location) { var type = manager.GetType(); var field = type.GetField("myPathToExternalAnnotations", BindingFlags.NonPublic | BindingFlags.Instance); if (field != null) { var path = field.GetValue(manager) as string; if (string.IsNullOrEmpty(path)) { var settingsLocation = location.GetUserSettingsNonRoamingDir(ProductSettingsLocationFlag.ThisProductThisVersionAnyEnvironment); field.SetValue(manager, settingsLocation.Combine("ExternalAnnotations")); } } }
public SettingsUpgrader(ISettingsStore settingsStore, IApplicationDescriptor applicationDescriptor, IShellLocks locks, ProductSettingsLocation productSettingsLocation, RunsProducts.ProductConfigurations productConfigurations) { var boundSettingsStore = settingsStore.BindToContextTransient(ContextRange.ManuallyRestrictWritesToOneContext((l, contexts) => contexts.Empty)); Expression<Func<ZenCodingSettings, bool>> isUpgradedProperty = settings => settings.IsUpgraded; if (!boundSettingsStore.GetValue(isUpgradedProperty)) { var settingsComponent = new ShellSettingsComponent(applicationDescriptor, locks, productSettingsLocation, productConfigurations); var oldSettings = new Settings(); settingsComponent.LoadSettings(oldSettings, XmlExternalizationScope.UserSettings, oldSettings.GetType().Name); for (int i = 0; i < oldSettings.FileAssociations.Count; i++) { var association = oldSettings.FileAssociations[i]; boundSettingsStore.SetIndexedValue((ZenCodingSettings settings) => settings.FileAssociations, i, association); } boundSettingsStore.SetValue(isUpgradedProperty, true); } }
public SettingsUpgrader(ISettingsStore settingsStore, IApplicationDescriptor applicationDescriptor, IShellLocks locks, ProductSettingsLocation productSettingsLocation, RunsProducts.ProductConfigurations productConfigurations) { var boundSettingsStore = settingsStore.BindToContextTransient(ContextRange.ManuallyRestrictWritesToOneContext((l, contexts) => contexts.Empty)); Expression <Func <ZenCodingSettings, bool> > isUpgradedProperty = settings => settings.IsUpgraded; if (!boundSettingsStore.GetValue(isUpgradedProperty)) { var settingsComponent = new ShellSettingsComponent(applicationDescriptor, locks, productSettingsLocation, productConfigurations); var oldSettings = new Settings(); settingsComponent.LoadSettings(oldSettings, XmlExternalizationScope.UserSettings, oldSettings.GetType().Name); for (int i = 0; i < oldSettings.FileAssociations.Count; i++) { var association = oldSettings.FileAssociations[i]; boundSettingsStore.SetIndexedValue((ZenCodingSettings settings) => settings.FileAssociations, i, association); } boundSettingsStore.SetValue(isUpgradedProperty, true); } }