/// Copyright (c) Microsoft Corporation. All rights reserved. using System; using System.Diagnostics.CodeAnalysis; using System.Runtime.InteropServices; using Microsoft.VisualStudio.Shell.Interop; namespace Microsoft.VisualStudio.Project { #region structures [StructLayoutAttribute(LayoutKind.Sequential)] internal struct _DROPFILES { public Int32 pFiles; public Int32 X; public Int32 Y; public Int32 fNC; public Int32 fWide; } #endregion #region enums /// /// Defines possible types of output that can produced by a language project /// [PropertyPageTypeConverterAttribute(typeof(OutputTypeConverter))] public enum OutputType { /// /// The output type is a class library. /// Library, /// /// The output type is a windows executable. /// WinExe, /// /// The output type is an executable. /// Exe } /// /// Debug values used by DebugModeConverter. /// [PropertyPageTypeConverterAttribute(typeof(DebugModeConverter))] public enum DebugMode { Project, Program, [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "URL")] URL } /// /// An enumeration that describes the type of action to be taken by the build. /// [PropertyPageTypeConverterAttribute(typeof(BuildActionConverter))] public enum BuildAction { None, Compile, Content, EmbeddedResource } /// /// Defines the version of the CLR that is appropriate to the project. /// [PropertyPageTypeConverterAttribute(typeof(PlatformTypeConverter))] public enum PlatformType { [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "not")] notSpecified, [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "v")] v1, [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "v")] v11, [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "v")] v2, [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "cli")] [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "cli")] cli1 } /// /// Defines the currect state of a property page. /// [Flags] public enum PropPageStatus { Dirty = 0x1, Validate = 0x2, Clean = 0x4 } [Flags] [SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue")] public enum ModuleKindFlags { ConsoleApplication, WindowsApplication, DynamicallyLinkedLibrary, ManifestResourceFile, UnmanagedDynamicallyLinkedLibrary } /// /// Defines the status of the command being queried /// [Flags] [SuppressMessage("Microsoft.Naming", "CA1714:FlagsEnumsShouldHavePluralNames")] [SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue")] public enum QueryStatusResult { /// /// The command is not supported. /// [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "NOTSUPPORTED")] NOTSUPPORTED = 0, /// /// The command is supported /// [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "SUPPORTED")] SUPPORTED = 1, /// /// The command is enabled /// [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "ENABLED")] ENABLED = 2, /// /// The command is toggled on /// [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "LATCHED")] LATCHED = 4, /// /// The command is toggled off (the opposite of LATCHED). /// [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "NINCHED")] NINCHED = 8, /// /// The command is invisible. /// [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "INVISIBLE")] INVISIBLE = 16 } /// /// Defines the type of item to be added to the hierarchy. /// public enum HierarchyAddType { AddNewItem, AddExistingItem } /// /// Defines the component from which a command was issued. /// public enum CommandOrigin { [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "Ui")] UiHierarchy, OleCommandTarget } /// /// Defines the current status of the build process. /// public enum MSBuildResult { /// /// The build is currently suspended. /// Suspended, /// /// The build has been restarted. /// Resumed, /// /// The build failed. /// Failed, /// /// The build was successful. /// Successful, } /// /// Defines the type of action to be taken in showing the window frame. /// public enum WindowFrameShowAction { DoNotShow, Show, ShowNoActivate, Hide, } /// /// Defines drop types /// internal enum DropDataType { None, Shell, VsStg, VsRef } /// /// Used by the hierarchy node to decide which element to redraw. /// [Flags] [SuppressMessage("Microsoft.Naming", "CA1714:FlagsEnumsShouldHavePluralNames")] public enum UIHierarchyElement { None = 0, /// /// This will be translated to VSHPROPID_IconIndex /// Icon = 1, /// /// This will be translated to VSHPROPID_StateIconIndex /// [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Scc")] SccState = 2, /// /// This will be translated to VSHPROPID_Caption /// Caption = 4 } /// /// Defines the global propeties used by the msbuild project. /// public enum GlobalProperty { /// /// Property specifying that we are building inside VS. /// BuildingInsideVisualStudio, /// /// The VS installation directory. This is the same as the $(DevEnvDir) macro. /// [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Env")] DevEnvDir, /// /// The name of the solution the project is created. This is the same as the $(SolutionName) macro. /// SolutionName, /// /// The file name of the solution. This is the same as $(SolutionFileName) macro. /// SolutionFileName, /// /// The full path of the solution. This is the same as the $(SolutionPath) macro. /// SolutionPath, /// /// The directory of the solution. This is the same as the $(SolutionDir) macro. /// SolutionDir, /// /// The extension of teh directory. This is the same as the $(SolutionExt) macro. /// SolutionExt, /// /// The fxcop installation directory. /// FxCopDir, /// /// The ResolvedNonMSBuildProjectOutputs msbuild property /// [SuppressMessage("Microsoft.Naming", "CA1709:IdentifiersShouldBeCasedCorrectly", MessageId = "VSIDE")] VSIDEResolvedNonMSBuildProjectOutputs, /// /// The Configuartion property. /// Configuration, /// /// The platform property. /// Platform, /// /// The RunCodeAnalysisOnce property /// RunCodeAnalysisOnce, } /// /// Defines the project trust levels. /// public enum ProjectTrustLevel { /// /// Unknown project. /// Unknown = 0, /// /// Trusted project. /// Trusted = 1 }; /// /// Defines the project load options from the ProjectSecurity dialog box /// public enum ProjectLoadOption { /// /// Load the project normally /// LoadNormally = 0, /// /// Load the project only for browsing /// LoadOnlyForBrowsing = 1, /// /// Do not load the project. /// DonNotLoad = 2 }; /// /// Defines the components in the msbuild project file that will be checked. /// /// The order actually specifies the order in which security checks are made. Thus this is important. public enum ProjectFileSecurityCheck { /// /// Not checked /// NotChecked = 0, /// /// The imports. /// Import, /// /// The imports in the user file. /// ImportInUserFile, /// /// The properties. /// Property, /// /// The targets. /// Target, /// /// The items. /// Item, /// /// The using tasks in the project file. /// UsingTask, /// /// The using task in the user file. /// UsingTaskInUserFile, /// /// The item location. /// ItemLocation, /// /// Unknowm /// External }; #endregion public class AfterProjectFileOpenedEventArgs : EventArgs { #region fields private bool added; #endregion #region properties /// /// True if the project is added to the solution after the solution is opened. false if the project is added to the solution while the solution is being opened. /// [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal bool Added { get { return this.added; } } #endregion #region ctor internal AfterProjectFileOpenedEventArgs(bool added) { this.added = added; } #endregion } public class BeforeProjectFileClosedEventArgs : EventArgs { #region fields private bool removed; #endregion #region properties /// /// true if the project was removed from the solution before the solution was closed. false if the project was removed from the solution while the solution was being closed. /// [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal bool Removed { get { return this.removed; } } #endregion #region ctor internal BeforeProjectFileClosedEventArgs(bool removed) { this.removed = removed; } #endregion } /// /// This class is used for the events raised by a HierarchyNode object. /// internal class HierarchyNodeEventArgs : EventArgs { private HierarchyNode child; internal HierarchyNodeEventArgs(HierarchyNode child) { this.child = child; } public HierarchyNode Child { get { return this.child; } } } /// /// Event args class for triggering file change event arguments. /// internal class FileChangedOnDiskEventArgs : EventArgs { #region Private fields /// /// File name that was changed on disk. /// private string fileName; /// /// The item ide of the file that has changed. /// private uint itemID; /// /// The reason the file has changed on disk. /// private _VSFILECHANGEFLAGS fileChangeFlag; #endregion /// /// Constructs a new event args. /// /// File name that was changed on disk. /// The item id of the file that was changed on disk. internal FileChangedOnDiskEventArgs(string fileName, uint id, _VSFILECHANGEFLAGS flag) { this.fileName = fileName; this.itemID = id; this.fileChangeFlag = flag; } /// /// Gets the file name that was changed on disk. /// /// The file that was changed on disk. internal string FileName { get { return this.fileName; } } /// /// Gets item id of the file that has changed /// /// The file that was changed on disk. internal uint ItemID { get { return this.itemID; } } /// /// The reason while the file has chnaged on disk. /// /// The reason while the file has chnaged on disk. internal _VSFILECHANGEFLAGS FileChangeFlag { get { return this.fileChangeFlag; } } } /// /// Defines the event args for the active configuration chnage event. /// public class ActiveConfigurationChangedEventArgs : EventArgs { #region Private fields /// /// The hierarchy whose configuration has changed /// private IVsHierarchy hierarchy; #endregion /// /// Constructs a new event args. /// /// The hierarchy that has changed its configuration. internal ActiveConfigurationChangedEventArgs(IVsHierarchy hierarchy) { this.hierarchy = hierarchy; } /// /// The hierarchy whose configuration has changed /// internal IVsHierarchy Hierarchy { get { return this.hierarchy; } } } /// /// Argument of the event raised when a project property is changed. /// [SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] public class ProjectPropertyChangedArgs : EventArgs { private string propertyName; private string oldValue; private string newValue; internal ProjectPropertyChangedArgs(string propertyName, string oldValue, string newValue) { this.propertyName = propertyName; this.oldValue = oldValue; this.newValue = newValue; } public string NewValue { get { return newValue; } } public string OldValue { get { return oldValue; } } public string PropertyName { get { return propertyName; } } } }