added some development tools
[windows-sources.git] / developer / VSSDK / Samples / Source_Code_Control_Provider / C# / ProvideSolutionProps.cs
blobb0513c492a3eed7af05bf800cce91ad5a962693d
1 /***************************************************************************
3 Copyright (c) Microsoft Corporation. All rights reserved.
4 THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
5 ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
6 IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
7 PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9 ***************************************************************************/
11 using System;
12 using System.Collections.Generic;
13 using System.Text;
14 using System.Globalization;
15 using Microsoft.VisualStudio.Shell;
17 namespace Microsoft.Samples.VisualStudio.SourceControlIntegration.SccProvider
19 [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
20 internal sealed class ProvideSolutionProps : RegistrationAttribute
22 private string _propName;
24 public ProvideSolutionProps(string propName)
26 _propName = propName;
29 public override void Register(RegistrationContext context)
31 context.Log.WriteLine(string.Format(CultureInfo.InvariantCulture, "ProvideSolutionProps: ({0} = {1})", context.ComponentType.GUID.ToString("B"), PropName));
33 Key childKey = null;
35 try
37 childKey = context.CreateKey(string.Format(CultureInfo.InvariantCulture, "{0}\\{1}", "SolutionPersistence", PropName));
39 childKey.SetValue(string.Empty, context.ComponentType.GUID.ToString("B"));
41 finally
43 if (childKey != null) childKey.Close();
47 public override void Unregister(RegistrationContext context)
49 context.RemoveKey(string.Format(CultureInfo.InvariantCulture, "{0}\\{1}", "SolutionPersistence", PropName));
52 public string PropName { get { return _propName; } }