private static string ComputeLocalAppDataPath() { var settingsManager = new ShellSettingsManager(ServiceProvider.GlobalProvider); string localAppDataPath = settingsManager.GetApplicationDataFolder(ApplicationDataFolder.LocalSettings); return(Path.Combine( localAppDataPath, ExtensionName)); }
private static string GetUserFilePath() { var ssm = new ShellSettingsManager(WebEssentialsPackage.Instance); return(Path.Combine(ssm.GetApplicationDataFolder(ApplicationDataFolder.RoamingSettings), FileName)); }
/// <summary> /// This method was copied (and slightly modified) from Microsoft.VisualStudio.ExtensionManager.ExtensionEngineImpl /// Internal method subject to change. Last pulled: 02-Jan-2018 /// </summary> /// <returns></returns> internal static long GetLastExtensionChangedTimestampInternal() { ShellSettingsManager manager = new ShellSettingsManager(ServiceProvider.GlobalProvider); string perMachineExtensionInstallRoot = manager.GetApplicationDataFolder(ApplicationDataFolder.ApplicationExtensions); long lastConfigChange = 0; List <string> changeIndicatorFiles = new List <string>(); SettingsStore configurationSettingsStore = manager.GetReadOnlySettingsStore(SettingsScope.Configuration); using (configurationSettingsStore as IDisposable) { // Check machine level user configuration timestamp changeIndicatorFiles.Add(Path.Combine(perMachineExtensionInstallRoot, ExtensionsConfigurationChanged)); // Check product level timestamp (detect changes global to all SKUs). //changeIndicatorFiles.Add(Path.Combine(engineHost.ShellFolder, ExtensionsConfigurationChanged)); foreach (var changeIndicatorFilePath in changeIndicatorFiles) { FileInfo fi = new FileInfo(changeIndicatorFilePath); if (fi.Exists) { long fileWriteTime = fi.LastWriteTimeUtc.ToFileTimeUtc(); if (fileWriteTime > lastConfigChange) { lastConfigChange = fileWriteTime; //reason = EngineConstants.ReasonFileWriteTime; } } } // Check configuration settings timestamp long configSettingsTime = configurationSettingsStore.GetInt64(string.Empty, ConfigurationChangedKey, 0L); if (configSettingsTime > lastConfigChange) { lastConfigChange = configSettingsTime; //reason = EngineConstants.ReasonConfigSettingsTime; } } SettingsStore userSettings = manager.GetReadOnlySettingsStore(SettingsScope.UserSettings); using (userSettings as IDisposable) { // Check user settings timestamp long userSettingsTime = userSettings.GetInt64(string.Empty, ConfigurationChangedKey, 0L); if (userSettingsTime > lastConfigChange) { lastConfigChange = userSettingsTime; //reason = EngineConstants.ReasonUserSettingsTime; } // Check extensions changed timestamp (this will pick up all changes made through extension manager service) long extensionsChangedTime = userSettings.GetInt64(SettingsStoreRoot, ExtensionsChangedKey, 0L); if (extensionsChangedTime > lastConfigChange) { lastConfigChange = extensionsChangedTime; //reason = EngineConstants.ReasonExtensionsChangedTime; } } return(lastConfigChange); }
private static string GetUserFilePath() { var ssm = new ShellSettingsManager(TsWspPackage.Instance); return(Path.Combine(ssm.GetApplicationDataFolder(ApplicationDataFolder.RoamingSettings), TsWspConstants.SETTINGS_FILENAME)); }