private string GetUserSettingsString(string key, string value) { IVsSettingsStore store = ReadOnlyUserSettings; Marshal.ThrowExceptionForHR(store.GetStringOrDefault(key, value, String.Empty, out string result)); return(result); }
/// <summary> /// Load a list of UIContext items from the settings store. /// </summary> /// <param name="settingsStore"></param> /// <param name="list"></param> /// <param name="name"></param> private void LoadContextIDList(IVsSettingsStore settingsStore, ObservableCollection <UIContextInformation> list, string name) { ThreadHelper.ThrowIfNotOnUIThread(); string collectionRoot = SettingsRoot + "\\" + name; settingsStore.CollectionExists(collectionRoot, out var exists); if (exists != 0) { settingsStore.GetPropertyCount(collectionRoot, out var contextCount); for (uint iContext = 0; iContext < contextCount; iContext++) { if (ErrorHandler.Succeeded(settingsStore.GetPropertyName(collectionRoot, iContext, out var guidString))) { Guid contextGuid = new Guid(guidString); if (ErrorHandler.Succeeded(selectionMonitor.GetCmdUIContextCookie(ref contextGuid, out var contextID))) { if (contextIDNames.ContainsKey(contextID)) { list.Add(contextIDNames[contextID]); if (contextIDNames[contextID].Name.StartsWith("#") || contextIDNames[contextID].Name.StartsWith("resource=")) { // if the name is a resource, use the name we found from the last session if (ErrorHandler.Succeeded(settingsStore.GetString(collectionRoot, guidString, out var contextName))) { contextIDNames[contextID].Name = contextName; } } } } } } } }
public static byte[] GetByteArray(this IVsSettingsStore store, string collectionPath, string propertyName) { uint[] actualByteLength = { 0 }; ErrorHandler.ThrowOnFailure(store.GetBinary(collectionPath, propertyName, 0, null, actualByteLength)); byte[] binaryValue = new byte[actualByteLength[0]]; ErrorHandler.ThrowOnFailure(store.GetBinary(collectionPath, propertyName, actualByteLength[0], binaryValue, actualByteLength)); return(binaryValue); }
public int GetReadOnlySettingsStore(uint scope, out IVsSettingsStore store) { if (scope != (uint)SettingsScope.UserSettings) { store = null; return(-1); } store = readOnlyStore; return(0); }
public void BeforeEach() { _settingManagerMock = new Mock <IVsSettingsManager>(); _uiShellMock = new Mock <IVsUIShell>(); int intValue = 0; IVsSettingsStore store = Mock.Of <IVsSettingsStore>( ss => ss.GetIntOrDefault(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <int>(), out intValue) == 0); _settingManagerMock.Setup(sm => sm.GetReadOnlySettingsStore(It.IsAny <uint>(), out store)).Returns(0); GoogleCloudExtensionPackageTests.InitPackageMock(dte => { Mock <IServiceProvider> providerMock = dte.As <IServiceProvider>(); GoogleCloudExtensionPackageTests.SetupService <SVsSettingsManager, IVsSettingsManager>( providerMock, _settingManagerMock); GoogleCloudExtensionPackageTests.SetupService <IVsUIShell, IVsUIShell>(providerMock, _uiShellMock); }); }
public static IEnumerable <string> GetPropertyNames(this IVsSettingsStore store, string collectionPath) { for (uint index = 0; ; index++) { string name; try { if (ErrorHandler.Failed(store.GetPropertyName(collectionPath, index, out name))) { break; } } catch (IndexOutOfRangeException) { break; } yield return(name); } }
public static IEnumerable <string> GetSubCollectionNames(this IVsSettingsStore store, string collectionPath) { // Don't get the count up-front. It's essentially an enumeration which is as expensive // as just looping until we get an error. for (uint index = 0; ; index++) { string subCollectionName; try { if (ErrorHandler.Failed(store.GetSubCollectionName(collectionPath, index, out subCollectionName))) { break; } } catch (IndexOutOfRangeException) { break; } yield return(subCollectionName); } }
public int GetReadOnlySettingsStore(uint scope, out IVsSettingsStore store) { store = ReadOnlyStore; return VSConstants.S_OK; }
public SettingsStoreWrapper(IVsSettingsStore store) { _store = store; }
public int GetReadOnlySettingsStore([ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSSETTINGSSCOPE")] uint scope, out IVsSettingsStore store) { store = new StoreWrapper(inner.GetReadOnlySettingsStore((SettingsScope)scope)); return(0); }
public static bool PropertyExists(this IVsSettingsStore store, string collectionPath, string propertyName) { ErrorHandler.ThrowOnFailure(store.PropertyExists(collectionPath, propertyName, out int exists)); return(exists != 0); }
// Private constructor private Settings() { Shell.ThreadHelper.ThrowIfNotOnUIThread(); this.Store = ReadOnlyConfigSettings; }
public static __VsSettingsType GetPropertyType(this IVsSettingsStore store, string collectionPath, string propertyName) { ErrorHandler.ThrowOnFailure(store.GetPropertyType(collectionPath, propertyName, out var type)); return((__VsSettingsType)type); }
/// <summary> /// Internal constructor that takes the COM interface that provides the functionality of this class. /// </summary> /// <param name="settingsStore">COM interface wrapped by this class.</param> internal ShellSettingsStore(IVsSettingsStore settingsStore) { HelperMethods.CheckNullArgument(settingsStore, "settingsStore"); this.settingsStore = settingsStore; }
public int GetReadOnlySettingsStore(uint scope, out IVsSettingsStore store) { store = Stores[scope]; return(Stores.ContainsKey(scope) ? VSConstants.S_OK : VSConstants.E_FAIL); }
public static ulong GetUint64(this IVsSettingsStore store, string collectionPath, string propertyName) { ErrorHandler.ThrowOnFailure(store.GetUnsignedInt64(collectionPath, propertyName, out var value)); return(value); }
public int GetReadOnlySettingsStore(uint scope, out IVsSettingsStore store) { store = ReadOnlyStore; return(VSConstants.S_OK); }
public static bool CollectionExists(this IVsSettingsStore store, string collectionPath) { ErrorHandler.ThrowOnFailure(store.CollectionExists(collectionPath, out int exists)); return(exists != 0); }
public int GetReadOnlySettingsStore([ComAliasName("Microsoft.VisualStudio.Shell.Interop.VSSETTINGSSCOPE")]uint scope, out IVsSettingsStore store) { store = new StoreWrapper(inner.GetReadOnlySettingsStore((SettingsScope)scope)); return 0; }