You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(174) |
Nov
(85) |
Dec
(14) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(56) |
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
(1) |
Jul
(132) |
Aug
(5) |
Sep
|
Oct
(314) |
Nov
(133) |
Dec
(18) |
2006 |
Jan
(6) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Oleg T. <he...@us...> - 2004-10-10 19:09:21
|
Update of /cvsroot/mvp-xml/XPointer/v1/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25392/v1/src Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- bin obj *.user *.suo |
From: Oleg T. <he...@us...> - 2004-10-10 18:55:09
|
Update of /cvsroot/mvp-xml/XPointer/v1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22575/v1 Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- bin obj *.user *.suo |
From: Oleg T. <he...@us...> - 2004-10-10 18:53:52
|
Update of /cvsroot/mvp-xml/XInclude/v1/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22322/v1/test Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- bin obj *.user *.suo |
From: Oleg T. <he...@us...> - 2004-10-10 18:47:16
|
Update of /cvsroot/mvp-xml/XInclude/v1/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21167/v1/src Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- bin obj *.user *.suo |
From: Oleg T. <he...@us...> - 2004-10-10 18:44:22
|
Update of /cvsroot/mvp-xml/XInclude/v1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20577/v1 Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- bin obj *.user *.suo |
From: Oleg T. <he...@us...> - 2004-10-10 18:40:21
|
Update of /cvsroot/mvp-xml/Global In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19481 Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- bin obj *.user *.suo |
From: Oleg T. <he...@us...> - 2004-10-10 18:38:24
|
Update of /cvsroot/mvp-xml/Common/v1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19067/v1 Added Files: .cvsignore Log Message: --- NEW FILE: .cvsignore --- bin obj *.user *.suo |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:40:58
|
Update of /cvsroot/mvp-xml/Design/v1/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12845/v1/src Removed Files: Design.csproj.user Log Message: Removed user-specific information. --- Design.csproj.user DELETED --- |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:33:54
|
Update of /cvsroot/mvp-xml/Design/v1/src/VisualStudio/GotDotNet In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11476/v1/src/VisualStudio/GotDotNet Added Files: BaseCodeGenerator.cs BaseCodeGeneratorWithSite.cs IObjectWithSite.cs IOleServiceProvider.cs IVsGeneratorProgress.cs IVsSingleFileGenerator.cs ServiceProvider.cs Log Message: Classes downloaded from GDN that allow easy development of custom tools. --- NEW FILE: ServiceProvider.cs --- namespace Mvp.Xml.Design.VisualStudio { using System; using System.Diagnostics; using System.Runtime.InteropServices; /// <summary> /// This wraps the IOleServiceProvider interface and provides an easy COM+ way to get at /// services. /// </summary> public class ServiceProvider : IServiceProvider, IObjectWithSite { private static Guid IID_IUnknown = new Guid("{00000000-0000-0000-C000-000000000046}"); private IOleServiceProvider serviceProvider; /// <summary> /// Creates a new ServiceProvider object and uses the given interface to resolve /// services. /// </summary> /// <param name='sp'> /// The IOleServiceProvider interface to use. /// </param> public ServiceProvider(IOleServiceProvider sp) { serviceProvider = sp; } /// <summary> /// gives this class a chance to free its references. /// </summary> public virtual void Dispose() { if (serviceProvider != null) { serviceProvider = null; } } /// <summary> /// returns true if the given HRESULT is a failure HRESULT /// </summary> /// <param name="hr">HRESULT to test</param> /// <returns>true if the HRESULT is a failure, false if not.</returns> public static bool Failed(int hr) { return(hr < 0); } /// <summary> /// Retrieves the requested service. /// </summary> /// <param name='serviceClass'> /// The class of the service to retrieve. /// </param> /// <returns> /// an instance of serviceClass or null if no /// such service exists. /// </returns> public virtual object GetService(Type serviceClass) { if (serviceClass == null) { return null; } return GetService(serviceClass.GUID, serviceClass); } /// <summary> /// Retrieves the requested service. /// </summary> /// <param name='guid'> /// The GUID of the service to retrieve. /// </param> /// <returns> /// an instance of the service or null if no /// such service exists. /// </returns> public virtual object GetService(Guid guid) { return GetService(guid, null); } /// <summary> /// Retrieves the requested service. The guid must be specified; the class is only /// used when debugging and it may be null. /// </summary> private object GetService(Guid guid, Type serviceClass) { // Valid, but wierd for caller to init us with a NULL sp // if (serviceProvider == null) { return null; } object service = null; // No valid guid on the passed in class, so there is no service for it. // if (guid.Equals(Guid.Empty)) { return null; } // We provide a couple of services of our own. // if (guid.Equals(typeof(IOleServiceProvider).GUID)) { return serviceProvider; } if (guid.Equals(typeof(IObjectWithSite).GUID)) { return (IObjectWithSite)this; } IntPtr pUnk; int hr = serviceProvider.QueryService(ref guid, ref IID_IUnknown, out pUnk); if (Succeeded(hr) && (pUnk != IntPtr.Zero)) { service = Marshal.GetObjectForIUnknown(pUnk); Marshal.Release(pUnk); } return service; } /// <summary> /// Retrieves the current site object we're using to /// resolve services. /// </summary> /// <param name='riid'> /// Must be IServiceProvider.class.GUID /// </param> /// <param name='ppvSite'> /// Outparam that will contain the site object. /// </param> /// <seealso cref='IObjectWithSite'/> void IObjectWithSite.GetSite(ref Guid riid, object[] ppvSite) { ppvSite[0] = GetService(riid); } /// <summary> /// Sets the site object we will be using to resolve services. /// </summary> /// <param name='pUnkSite'> /// The site we will use. This site will only be /// used if it also implements IOleServiceProvider. /// </param> /// <seealso cref='IObjectWithSite'/> void IObjectWithSite.SetSite(object pUnkSite) { if (pUnkSite is IOleServiceProvider) { serviceProvider = (IOleServiceProvider)pUnkSite; } } /// <summary> /// returns true if the given HRESULT is a success HRESULT /// </summary> /// <param name="hr">HRESULT to test</param> /// <returns>true if the HRESULT is a success, false if not.</returns> public static bool Succeeded(int hr) { return(hr >= 0); } } } --- NEW FILE: IOleServiceProvider.cs --- namespace Mvp.Xml.Design.VisualStudio { using System; using System.Runtime.InteropServices; /// <remarks/> [ ComImport, Guid("6D5140C1-7436-11CE-8034-00AA006009FA"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown) ] public interface IOleServiceProvider { /// <remarks/> [PreserveSig] int QueryService([In]ref Guid guidService, [In]ref Guid riid, out IntPtr ppvObject); } } --- NEW FILE: IVsSingleFileGenerator.cs --- namespace Mvp.Xml.Design.VisualStudio { using System; using System.Runtime.InteropServices; /// <remarks/> [ ComImport, Guid("3634494C-492F-4F91-8009-4541234E4E99"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown) ] public interface IVsSingleFileGenerator { // // Retrieve default properties for the generator // [propget] HRESULT DefaultExtension([out,retval] BSTR* pbstrDefaultExtension); // /// <remarks/> [return: MarshalAs(UnmanagedType.BStr)] string GetDefaultExtension(); // // Generate the file // HRESULT Generate([in] LPCOLESTR wszInputFilePath, // [in] BSTR bstrInputFileContents, // [in] LPCOLESTR wszDefaultNamespace, // [out] BYTE** rgbOutputFileContents, // [out] ULONG* pcbOutput, // [in] IVsGeneratorProgress* pGenerateProgress); // /// <remarks/> void Generate( [MarshalAs(UnmanagedType.LPWStr)] string wszInputFilePath, [MarshalAs(UnmanagedType.BStr)] string bstrInputFileContents, [MarshalAs(UnmanagedType.LPWStr)] string wszDefaultNamespace, out IntPtr rgbOutputFileContents, [MarshalAs(UnmanagedType.U4)] out int pcbOutput, IVsGeneratorProgress pGenerateProgress); } } --- NEW FILE: IVsGeneratorProgress.cs --- namespace Mvp.Xml.Design.VisualStudio { using System; using System.Runtime.InteropServices; /// <remarks/> [ ComImport, Guid("BED89B98-6EC9-43CB-B0A8-41D6E2D6669D"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown) ] public interface IVsGeneratorProgress { // // Communicate errors // HRESULT GeneratorError([in] BOOL fWarning, // [in] DWORD dwLevel, // [in] BSTR bstrError, // [in] DWORD dwLine, // [in] DWORD dwColumn); // /// <remarks/> void GeneratorError( bool fWarning, [MarshalAs(UnmanagedType.U4)] int dwLevel, [MarshalAs(UnmanagedType.BStr)] string bstrError, [MarshalAs(UnmanagedType.U4)] int dwLine, [MarshalAs(UnmanagedType.U4)] int dwColumn); // // Report progress to the caller. // HRESULT Progress([in] ULONG nComplete, // Current position // [in] ULONG nTotal); // Max value // /// <remarks/> void Progress( [MarshalAs(UnmanagedType.U4)] int nComplete, [MarshalAs(UnmanagedType.U4)] int nTotal); } } --- NEW FILE: IObjectWithSite.cs --- namespace Mvp.Xml.Design.VisualStudio { using System; using System.Runtime.InteropServices; [ ComImport, Guid("FC4801A3-2BA9-11CF-A229-00AA003D7352"), InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown) ] internal interface IObjectWithSite { // // HRESULT SetSite( // [in] IUnknown * pUnkSite); // void SetSite( [MarshalAs(UnmanagedType.Interface)] object pUnkSite); // // HRESULT GetSite( // [in] REFIID riid, // [out, iid_is(riid)] void ** ppvSite); // void GetSite( [In] ref Guid riid, [Out, MarshalAs(UnmanagedType.LPArray)] object[] ppvSite); } } --- NEW FILE: BaseCodeGeneratorWithSite.cs --- namespace Mvp.Xml.Design.VisualStudio { using System; using System.CodeDom; using System.CodeDom.Compiler; using System.Diagnostics; using System.Runtime.InteropServices; using EnvDTE; using VSLangProj; using Microsoft.VisualStudio.Designer.Interfaces; /// <summary> /// This class exists to be cocreated a in a preprocessor build step. /// </summary> public abstract class BaseCodeGeneratorWithSite : BaseCodeGenerator, IObjectWithSite { private const int E_FAIL = unchecked((int)0x80004005); private const int E_NOINTERFACE = unchecked((int)0x80004002); private object site = null; private CodeDomProvider codeDomProvider = null; private static Guid CodeDomInterfaceGuid = new Guid("{73E59688-C7C4-4a85-AF64-A538754784C5}"); private static Guid CodeDomServiceGuid = CodeDomInterfaceGuid; private ServiceProvider serviceProvider = null; /// <summary> /// demand-creates a CodeDomProvider /// </summary> protected virtual CodeDomProvider CodeProvider { get { if (codeDomProvider == null) { IVSMDCodeDomProvider vsmdCodeDomProvider = (IVSMDCodeDomProvider) GetService(CodeDomServiceGuid); if (vsmdCodeDomProvider != null) { codeDomProvider = (CodeDomProvider) vsmdCodeDomProvider.CodeDomProvider; } Debug.Assert(codeDomProvider != null, "Get CodeDomProvider Interface failed. GetService(QueryService(CodeDomProvider) returned Null."); } return codeDomProvider; } set { if (value == null) { throw new ArgumentNullException(); } codeDomProvider = value; } } /// <summary> /// demand-creates a ServiceProvider given an IOleServiceProvider /// </summary> private ServiceProvider SiteServiceProvider { get { if (serviceProvider == null) { IOleServiceProvider oleServiceProvider = site as IOleServiceProvider; Debug.Assert(oleServiceProvider != null, "Unable to get IOleServiceProvider from site object."); serviceProvider = new ServiceProvider(oleServiceProvider); } return serviceProvider; } } /// <summary> /// method to get a service by its GUID /// </summary> /// <param name="serviceGuid">GUID of service to retrieve</param> /// <returns>an object that implements the requested service</returns> protected object GetService(Guid serviceGuid) { return SiteServiceProvider.GetService(serviceGuid); } /// <summary> /// method to get a service by its Type /// </summary> /// <param name="serviceType">Type of service to retrieve</param> /// <returns>an object that implements the requested service</returns> protected virtual object GetService(Type serviceType) { return SiteServiceProvider.GetService(serviceType); } /// <summary> /// gets the default extension of the output file by asking the CodeDomProvider /// what its default extension is. /// </summary> /// <returns></returns> public override string GetDefaultExtension() { CodeDomProvider codeDom = CodeProvider; Debug.Assert(codeDom != null, "CodeDomProvider is NULL."); string extension = codeDom.FileExtension; if (extension != null && extension.Length > 0) { if (extension[0] != '.') { extension = "." + extension; } } return extension; } /// <summary> /// Method to get an ICodeGenerator with which this class can create code. /// </summary> /// <returns></returns> protected virtual ICodeGenerator GetCodeWriter() { CodeDomProvider codeDom = CodeProvider; if (codeDom != null) { return codeDom.CreateGenerator(); } return null; } /// <summary> /// SetSite method of IOleObjectWithSite /// </summary> /// <param name="pUnkSite">site for this object to use</param> public virtual void SetSite(object pUnkSite) { site = pUnkSite; codeDomProvider = null; serviceProvider = null; } /// <summary> /// GetSite method of IOleObjectWithSite /// </summary> /// <param name="riid">interface to get</param> /// <param name="ppvSite">array in which to stuff return value</param> public virtual void GetSite(ref Guid riid, object[] ppvSite) { if (ppvSite == null) { throw new ArgumentNullException("ppvSite"); } if (ppvSite.Length < 1) { throw new ArgumentException("ppvSite array must have at least 1 member", "ppvSite"); } if (site == null) { throw new COMException("object is not sited", E_FAIL); } IntPtr pUnknownPointer = Marshal.GetIUnknownForObject(site); IntPtr intPointer = IntPtr.Zero; Marshal.QueryInterface(pUnknownPointer, ref riid, out intPointer); if (intPointer == IntPtr.Zero) { throw new COMException("site does not support requested interface", E_NOINTERFACE); } ppvSite[0] = Marshal.GetObjectForIUnknown(intPointer); } /// <summary> /// gets a string containing the DLL names to add. /// </summary> /// <param name="DLLToAdd"></param> /// <returns></returns> private string GetDLLNames(string[] DLLToAdd) { if (DLLToAdd == null || DLLToAdd.Length == 0) { return string.Empty; } string dllNames = DLLToAdd[0]; for (int i = 1; i < DLLToAdd.Length; i++) { dllNames = dllNames + ", " + DLLToAdd[i]; } return dllNames; } /// <summary> /// adds a reference to the project for each required DLL /// </summary> /// <param name="referenceDLL"></param> protected void AddReferenceDLLToProject(string[] referenceDLL) { if (referenceDLL.Length == 0) { return; } object serviceObject = GetService(typeof(ProjectItem)); Debug.Assert(serviceObject != null, "Unable to get Project Item."); if (serviceObject == null) { string errorMessage = String.Format("Unable to add DLL to project references: {0}. Please Add them manually.", GetDLLNames(referenceDLL)); GeneratorErrorCallback(false, 1, errorMessage, 0, 0); return; } Project containingProject = ((ProjectItem) serviceObject).ContainingProject; Debug.Assert(containingProject != null, "GetService(typeof(Project)) return null."); if (containingProject == null) { string errorMessage = String.Format("Unable to add DLL to project references: {0}. Please Add them manually.", GetDLLNames(referenceDLL)); GeneratorErrorCallback(false, 1, errorMessage, 0, 0); return; } VSProject vsProj = containingProject.Object as VSProject; Debug.Assert(vsProj != null, "Unable to ADD DLL to current project. Project.Object does not implement VSProject."); if (vsProj == null) { string errorMessage = String.Format("Unable to add DLL to project references: {0}. Please Add them manually.", GetDLLNames(referenceDLL)); GeneratorErrorCallback(false, 1, errorMessage, 0, 0); return; } try { for (int i = 0; i < referenceDLL.Length; i++) { vsProj.References.Add(referenceDLL[i]); } } catch (Exception e) { Debug.Fail("**** ERROR: vsProj.References.Add() throws exception: " + e.ToString()); string errorMessage = String.Format("Unable to add DLL to project references: {0}. Please Add them manually.", GetDLLNames(referenceDLL)); GeneratorErrorCallback(false, 1, errorMessage, 0, 0); return; } } /// <summary> /// method to create an exception message given an exception /// </summary> /// <param name="e">exception caught</param> /// <returns>message to display to the user</returns> protected virtual string CreateExceptionMessage(Exception e) { string message = (e.Message != null ? e.Message : string.Empty); Exception innerException = e.InnerException; while (innerException != null) { string innerMessage = innerException.Message; if (innerMessage != null && innerMessage.Length > 0) { message = message + " " + innerMessage; } innerException = innerException.InnerException; } return message; } /// <summary> /// method to create a version comment /// </summary> /// <param name="codeNamespace"></param> protected virtual void GenerateVersionComment(System.CodeDom.CodeNamespace codeNamespace) { codeNamespace.Comments.Add(new CodeCommentStatement(string.Empty)); codeNamespace.Comments.Add(new CodeCommentStatement(String.Format("This source code was auto-generated by {0}, Version {1}.", System.Reflection.Assembly.GetExecutingAssembly().GetName().Name, System.Environment.Version.ToString()))); codeNamespace.Comments.Add(new CodeCommentStatement(string.Empty)); } } } --- NEW FILE: BaseCodeGenerator.cs --- namespace Mvp.Xml.Design.VisualStudio { using System; using System.Diagnostics; using System.IO; using System.Runtime.InteropServices; /// <summary> /// A managed wrapper for VS's concept of an IVsSingleFileGenerator which is /// a custom tool invoked during the build which can take any file as an input /// and provide a compilable code file as output. /// </summary> public abstract class BaseCodeGenerator : IVsSingleFileGenerator { private IVsGeneratorProgress codeGeneratorProgress; private string codeFileNameSpace = String.Empty; private string codeFilePath = String.Empty; /// <summary> /// namespace for the file. /// </summary> protected string FileNameSpace { get { return codeFileNameSpace; } } /// <summary> /// file-path for the input file. /// </summary> protected string InputFilePath { get { return codeFilePath; } } /// <summary> /// interface to the VS shell object we use to tell our /// progress while we are generating. /// </summary> internal IVsGeneratorProgress CodeGeneratorProgress { get { return codeGeneratorProgress; } } /// <summary> /// gets the default extension for this generator /// </summary> /// <returns>string with the default extension for this generator</returns> public abstract string GetDefaultExtension(); /// <summary> /// the method that does the actual work of generating code given the input /// file. /// </summary> /// <param name="inputFileName">input file name</param> /// <param name="inputFileContent">file contents as a string</param> /// <returns>the generated code file as a byte-array</returns> protected abstract byte[] GenerateCode(string inputFileName, string inputFileContent); /// <summary> /// method that will communicate an error via the shell callback mechanism. /// </summary> /// <param name="warning">true if this is a warning</param> /// <param name="level">level or severity</param> /// <param name="message">text displayed to the user</param> /// <param name="line">line number of error/warning</param> /// <param name="column">column number of error/warning</param> protected virtual void GeneratorErrorCallback(bool warning, int level, string message, int line, int column) { IVsGeneratorProgress progress = CodeGeneratorProgress; if (progress != null) { progress.GeneratorError(warning, level, message, line, column); } } /// <summary> /// main method that the VS shell calls to do the generation /// </summary> /// <param name="wszInputFilePath">path to the input file</param> /// <param name="bstrInputFileContents">contents of the input file as a string (shell handles UTF-8 to Unicode and those types of conversions)</param> /// <param name="wszDefaultNamespace">default namespace for the generated code file</param> /// <param name="rgbOutputFileContents">byte-array of output file contents</param> /// <param name="pcbOutput">count of bytes in the output byte-array</param> /// <param name="pGenerateProgress">interface to send progress updates to the shell</param> public void Generate(string wszInputFilePath, string bstrInputFileContents, string wszDefaultNamespace, out IntPtr rgbOutputFileContents, out int pcbOutput, IVsGeneratorProgress pGenerateProgress) { if (bstrInputFileContents == null) { throw new ArgumentNullException(bstrInputFileContents); } codeFilePath = wszInputFilePath; codeFileNameSpace = wszDefaultNamespace; codeGeneratorProgress = pGenerateProgress; byte[] bytes = GenerateCode(wszInputFilePath, bstrInputFileContents); if (bytes == null) { rgbOutputFileContents = IntPtr.Zero; pcbOutput = 0; } else { pcbOutput = bytes.Length; rgbOutputFileContents = Marshal.AllocCoTaskMem(pcbOutput); Marshal.Copy(bytes, 0, rgbOutputFileContents, pcbOutput); } } /// <summary> /// method to return a byte-array given a Stream /// </summary> /// <param name="stream">stream to convert to a byte-array</param> /// <returns>the stream's contents as a byte-array</returns> protected byte[] StreamToBytes(Stream stream) { if (stream.Length == 0) { return new byte[] { }; } long position = stream.Position; stream.Position = 0; byte[] bytes = new byte[(int)stream.Length]; stream.Read(bytes, 0, bytes.Length); stream.Position = position; return bytes; } } } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:33:29
|
Update of /cvsroot/mvp-xml/Design/v1/src/VisualStudio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11420/v1/src/VisualStudio Added Files: Readme.txt Log Message: Instructions about the GDN custom tool support classes. --- NEW FILE: Readme.txt --- Update GotDotNet folder from: http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=4AA14341-24D5-45AB-AB18-B72351D0371C Released by Microsoft. |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:33:20
|
Update of /cvsroot/mvp-xml/Design/v1/src/VisualStudio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11396/v1/src/VisualStudio Added Files: ServiceContainer.cs Log Message: Adapter that exposes the .NET IServiceProvider interface for DTE IOleServiceProvider interface. --- NEW FILE: ServiceContainer.cs --- #region using using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; #endregion using namespace Mvp.Xml.Design.VisualStudio { /// <summary> /// Implements a generic container for services. /// </summary> public abstract class ServiceContainer : IServiceContainer, IServiceProvider, IOleServiceProvider, IDisposable { #region Fields & Ctors IServiceProvider _provider; IServiceContainer _container; IProfferService _proffer; /// <summary> /// Default parameterless constructor for standalone containers. /// </summary> public ServiceContainer() {} /// <summary> /// Initializes the container with a parent service provider. /// </summary> public ServiceContainer(IServiceProvider provider) { _provider = provider; // Try to retrieve a parent container. _container = (IServiceContainer) provider.GetService(typeof (IServiceContainer)); // Try to retrieve the proffer service. _proffer = (IProfferService) provider.GetService(typeof (IProfferService)); } #endregion Fields & Ctors #region IServiceContainer Members /// <summary> /// Removes the specified service type from the service container, and optionally promotes the service to parent service containers. /// </summary> /// <param name="serviceType">The type of service to remove.</param> /// <param name="promote"><c>true</c> to promote this request to any parent service containers; otherwise, <c>false</c>.</param> public void RemoveService(Type serviceType, bool promote) { RemoveService(serviceType); if (promote) RemovePromotedService(serviceType); } /// <summary> /// Removes the specified service type from the service container. /// </summary> /// <param name="serviceType">The type of service to remove.</param> public void RemoveService(Type serviceType) { _services.Remove(serviceType); } /// <summary> /// Adds the specified service to the service container, and optionally promotes the service to parent service containers. /// </summary> /// <param name="serviceType">The type of service to add.</param> /// <param name="callback">A callback object that is used to create the service. This allows a service to be declared as available, but delays the creation of the object until the service is requested.</param> /// <param name="promote"><c>true</c> to promote this request to any parent service containers; otherwise, <c>false</c>.</param> public void AddService(Type serviceType, ServiceCreatorCallback callback, bool promote) { AddService(serviceType, callback); if (promote) AddPromotedService(serviceType, callback); } /// <summary> /// Adds the specified service to the service container. /// </summary> /// <param name="serviceType">The type of service to add.</param> /// <param name="callback">A callback object that is used to create the service. This allows a service to be declared as available, but delays the creation of the object until the service is requested.</param> public void AddService(Type serviceType, ServiceCreatorCallback callback) { if (serviceType == null) throw new ArgumentNullException("serviceType"); if (callback == null) throw new ArgumentNullException("callback"); if (_services.Contains(serviceType)) throw new ArgumentException("Service already exists.", "serviceType"); _services[serviceType] = callback; } /// <summary> /// Adds the specified service to the service container, and optionally promotes the service to any parent service containers. /// </summary> /// <param name="serviceType">The type of service to add.</param> /// <param name="serviceInstance">An instance of the service type to add. This object must implement or inherit from the type indicated by the serviceType parameter. </param> /// <param name="promote"><c>true</c> to promote this request to any parent service containers; otherwise, <c>false</c>.</param> public void AddService(Type serviceType, object serviceInstance, bool promote) { AddService(serviceType, serviceInstance); if (promote) AddPromotedService(serviceType, serviceInstance); } /// <summary> /// Adds the specified service to the service container. /// </summary> /// <param name="serviceType">The type of service to add.</param> /// <param name="serviceInstance">An instance of the service type to add. This object must implement or inherit from the type indicated by the serviceType parameter. </param> public void AddService(Type serviceType, object serviceInstance) { if (serviceType == null) throw new ArgumentNullException("serviceType"); if (serviceInstance == null) throw new ArgumentNullException("serviceInstance"); // __ComObjects are assignable anyway. We can't check that. // This is what System.ComponentModel.Design.ServiceContainer does. if (((serviceInstance as ServiceCreatorCallback) == null) && ((!serviceInstance.GetType().IsCOMObject && !serviceType.IsAssignableFrom(serviceInstance.GetType())))) throw new ArgumentException("Invalid service instance.", "serviceInstance"); if (_services.Contains(serviceType)) throw new ArgumentException("Service already exists.", "serviceType"); _services[serviceType] = serviceInstance; } #endregion #region IServiceProvider Members /// <summary> /// Provides access to services in this container. /// </summary> /// <param name="serviceType">The service type to retrieve.</param> /// <returns>The service instance or null if it's not available.</returns> public virtual object GetService(Type serviceType) { object serviceInstance = _services[serviceType]; if ((serviceInstance as ServiceCreatorCallback) != null) { ServiceCreatorCallback cbk = (ServiceCreatorCallback) serviceInstance; // Create the instance through the callback. serviceInstance = cbk(this, serviceType); // __ComObjects are assignable anyway. We can't check that. // This is what System.ComponentModel.Design.ServiceContainer does. if ((serviceInstance != null) && (!serviceInstance.GetType().IsCOMObject && !serviceType.IsAssignableFrom(serviceInstance.GetType()))) { _services.Remove(serviceType); serviceInstance = null; } else { _services[serviceType] = serviceInstance; } } // Propagate request to parents. if (serviceInstance == null && _provider != null) return _provider.GetService(serviceType); return serviceInstance; } IDictionary _services = new System.Collections.Specialized.HybridDictionary(); #endregion #region IOleServiceProvider Members /// <summary> /// Provides the ole implementation of the service retrieval routine. /// </summary> int IOleServiceProvider.QueryService(ref Guid guidService, ref Guid riid, out System.IntPtr ppvObject) { foreach (DictionaryEntry entry in _services) { if (((Type)entry.Key).GUID == guidService) { object service = GetService((Type) entry.Key); IntPtr pUnk = System.Runtime.InteropServices.Marshal.GetIUnknownForObject(service); int hr = System.Runtime.InteropServices.Marshal.QueryInterface(pUnk, ref riid, out ppvObject); System.Runtime.InteropServices.Marshal.Release(pUnk); return hr; } } ppvObject = (IntPtr) 0; return 0; } #endregion #region IDisposable Members /// <summary> /// Clears the container state. /// </summary> public virtual void Dispose() { // Remove all services promoted to VS. foreach (Type svc in _profferedservices.Keys) { RemovePromotedService(svc); } } #endregion #region Service promotion /// <summary> /// Keeps services that were promoted directly to VS. /// </summary> IDictionary _profferedservices = new System.Collections.Specialized.HybridDictionary(); private void AddPromotedService(Type serviceType, object serviceInstanceOrCallback) { if (_container == null && _proffer == null) return; // Regular service promotion. if (_container != null) { _container.AddService(serviceType, serviceInstanceOrCallback, true); return; } // Proffered services promotion. if (_proffer != null) { ProfferedService svc = new ProfferedService(); svc.Instance = serviceInstanceOrCallback; uint cookie; Guid sg = serviceType.GUID; int hr = _proffer.ProfferService(ref sg, this, out cookie); svc.Cookie= cookie; // If there're failures, throw? if (hr < 0) { throw new System.Runtime.InteropServices.COMException( String.Format("Failed to proffer service {0}", serviceType.FullName), hr); } _profferedservices[serviceType] = svc; } } private void RemovePromotedService(Type serviceType) { if (_container == null && _proffer == null) return; // Regular service demotion. if (_container != null) { _container.RemoveService(serviceType, true); return; } // We have a proffered service at hand. ProfferedService svc = (ProfferedService) _profferedservices[serviceType]; if (svc != null) { if (svc.Cookie != 0) { _proffer.RevokeService(svc.Cookie); // Dispose if appropriate, but don't dispose ourselves again. if (svc.Instance is IDisposable && svc.Instance != this) { ((IDisposable)svc.Instance).Dispose(); } } } } #region ProfferedService class /// <summary> /// This class contains a service that is being promoted to VS. /// </summary> private sealed class ProfferedService { public object Instance; public uint Cookie; } #endregion ProfferedService class #endregion Service proffering } } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:32:56
|
Update of /cvsroot/mvp-xml/Design/v1/src/VisualStudio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11218/v1/src/VisualStudio Added Files: Site.cs Log Message: Base implementation of a ISite that can be used to site components with a provider. --- NEW FILE: Site.cs --- #region using using System; using System.ComponentModel; #endregion using namespace Mvp.Xml.Design.VisualStudio { /// <summary> /// Basic <see cref="ISite"/> implementation. Passes all service /// requests to the parent service provider. /// </summary> public class Site : ISite { #region Field & Ctor IServiceProvider _provider; /// <summary> /// Constructs a site. /// </summary> /// <param name="provider">The object providing services to this site.</param> /// <param name="component">The component this site is being associated with.</param> /// <param name="name">A name for the site.</param> public Site(IServiceProvider provider, IComponent component, string name) { if (provider == null) throw new ArgumentNullException("provider"); if (component == null) throw new ArgumentNullException("component"); _component = component; // Pull the container from the service provider (if any). _container = (IContainer) provider.GetService(typeof(IContainer)); _provider = provider; _name = name; } #endregion Field & Ctor #region ISite Members /// <summary> /// See <see cref="ISite.Component"/>. /// </summary> public IComponent Component { get { return _component; } } IComponent _component; /// <summary> /// See <see cref="ISite.Container"/>. /// </summary> public IContainer Container { get { return _container; } } IContainer _container; /// <summary> /// Always returns <c>false</c>. /// </summary> public bool DesignMode { get { return false; } } /// <summary> /// See <see cref="ISite.Name"/>. /// </summary> public string Name { get { return _name; } set { _name = value; } } string _name; #endregion #region IServiceProvider Members /// <summary> /// See <see cref="IServiceProvider.GetService"/>. /// </summary> public virtual object GetService(Type service) { if (service != typeof(ISite)) return _provider.GetService(service); return this; } #endregion } } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:32:49
|
Update of /cvsroot/mvp-xml/Design/v1/src/VisualStudio In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11166/v1/src/VisualStudio Added Files: IProfferService.cs Log Message: Interop declaration that allows exposing new services to the IDE. --- NEW FILE: IProfferService.cs --- using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace Mvp.Xml.Design.VisualStudio { /// <remarks/> [ComImport] [ComVisible(true)] [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] [Guid("CB728B20-F786-11CE-92AD-00AA00A74CD0")] public interface IProfferService { // Methods /// <remarks/> int ProfferService( [In] ref Guid rguidService, [In, MarshalAs(UnmanagedType.Interface)] IOleServiceProvider psp, [Out, MarshalAs(UnmanagedType.U4)] out uint pdwCookie); /// <remarks/> void RevokeService( [In, MarshalAs(UnmanagedType.U4)] uint dwCookie); } } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:32:37
|
Update of /cvsroot/mvp-xml/Design/v1/src/CustomTools/SGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11107/v1/src/CustomTools/SGen Added Files: XmlSerializerGenerator.cs Log Message: Class that performs the actual processing and code generation. --- NEW FILE: XmlSerializerGenerator.cs --- #region using using System; using System.Collections; using System.CodeDom; using System.CodeDom.Compiler; using System.IO; using System.Reflection; using System.Text.RegularExpressions; using System.Xml.Serialization; #endregion using namespace Mvp.Xml.Design.CustomTools.SGen { /// <summary> /// Generates source code for custom XmlSerializer for a type. /// </summary> public class XmlSerializerGenerator { #region Consts & Fields // Parses private methods. static Regex PrivateMethods = new Regex(@" # Returned type # (?<return>[^\s]+)\s # Method call start # (?<method> (?<name>Read\d+_ # Object being read # (?<object>[^\(]+))\( # Method arguments # (?<arguments>[^\)]+) # Method call end # \))\s{", RegexOptions.IgnorePatternWhitespace | RegexOptions.Compiled | RegexOptions.Multiline); /// <summary> /// The return type of the read method. /// </summary> const string ReadMethodReturnType = "return"; /// <summary> /// Full method signature excluding return type. /// </summary> const string ReadMethodFullSignature = "method"; /// <summary> /// Method name. /// </summary> const string ReadMethodName = "name"; /// <summary> /// Method arguments. /// </summary> const string ReadMethodArguments = "arguments"; /// <summary> /// Name of the object being read. /// </summary> const string ReadMethodObjectName = "object"; /// <summary> /// Removes the type declaration from a list of method arguments retrieved by <see cref="PrivateMethods"/>. /// </summary> static Regex RemoveTypeFromArguments = new Regex(@"[^\s,]+[\s]", RegexOptions.Compiled); static Regex PublicRead = new Regex(@"public object (?<method>Read\d+_(?<object>[^\(]+))", RegexOptions.Compiled | RegexOptions.Multiline); /// <summary> /// The root object name of the element to (de)serialize. /// </summary> const string PublicRootObject = "object"; /// <summary> /// The name of the public read method. /// </summary> const string PublicMethodName = "method"; static Regex PublicWrite = new Regex(@"public void (?<method>Write\d+_(?<object>[^\(]+))", RegexOptions.Compiled | RegexOptions.Multiline); #region Code templates /// <summary> /// Template for the override for each element being read. /// {0}=Return type /// {1}=Method name /// {2}=Delegate name /// {3}=Event name /// {4}=Arguments with type definition /// {5}=Arguments with no type /// </summary> const string TemplateMethodOverride = @" /// <remarks/> protected override {0} {1}({4}) {{ {0} obj = base.{1}({5}); {2} handler = {3}; if (handler != null) handler(obj); return obj; }}"; /// <summary> /// Template for the public Read method for the root object /// in the custom reader firing events. /// {0}=Return type /// {1}=Read method name generated by serializer for root object. /// </summary> const string TemplateReadMethod = @" /// <summary>Reads an object of type {0}.</summary> internal {0} Read() {{ return ({0}) {1}(); }}"; /// <summary> /// Template for the public Write method for the root object /// in the custom writer. /// {0}=Object type name /// {1}=Write method name generated by serializer for root object. /// </summary> const string TemplateWriteMethod = @" /// <summary>Writes an object of type {0}.</summary> internal void Write({0} obj) {{ {1}(obj); }}"; /// <summary> /// Template for custom serializer class members. /// {0}=Name of the serializer class /// {1}=Reader type name /// {2}=Writer type name /// {3}=Root object type /// </summary> const string TemplateCustomSerializer = @" {1} _reader; {2} _writer; /// <summary>Constructs the serializer with default reader and writer instances.</summary> public {0}() {{ }} /// <summary>Constructs the serializer with a pre-built reader.</summary> public {0}({1} reader) {{ _reader = reader; }} /// <summary>Constructs the serializer with a pre-built writer.</summary> public {0}({2} writer) {{ _writer = writer; }} /// <summary>Constructs the serializer with pre-built reader and writer.</summary> public {0}({1} reader, {2} writer) {{ _reader = reader; _writer = writer; }} /// <summary>See <see cref=""XmlSerializer.CreateReader""/>.</summary> protected override XmlSerializationReader CreateReader() {{ if (_reader != null) return _reader; else return new {1}(); }} /// <summary>See <see cref=""XmlSerializer.CreateWriter""/>.</summary> protected override XmlSerializationWriter CreateWriter() {{ if (_writer != null) return _writer; else return new {2}(); }} /// <summary>See <see cref=""XmlSerializer.Deserialize""/>.</summary> protected override object Deserialize(XmlSerializationReader reader) {{ if (!(reader is {1})) throw new ArgumentException(""reader""); return (({1})reader).Read(); }} /// <summary>See <see cref=""XmlSerializer.Serialize""/>.</summary> protected override void Serialize(object o, XmlSerializationWriter writer) {{ if (!(writer is {2})) throw new ArgumentException(""writer""); (({2})writer).Write(({3})o); }}"; #endregion Code templates #endregion Consts & Fields /// <summary> /// Generates the code for a type. /// </summary> /// <param name="type">The type to generate custom XmlSerializer for.</param> /// <param name="targetNamespace">Target namespace to use for the generated classes.</param> /// <returns>Raw C# source code.</returns> public static string GenerateCode(Type type, string targetNamespace) { #region Retrieve XmlSerializer output string output; XmlSerializer ser = new XmlSerializer(type); // Here starts the horrible reflection hacks! //ser.tempAssembly.assembly.Location FieldInfo fitempasm = ser.GetType().GetField("tempAssembly", BindingFlags.NonPublic | BindingFlags.Instance); object tempasm = fitempasm.GetValue(ser); FieldInfo fiasm = tempasm.GetType().GetField("assembly", BindingFlags.NonPublic | BindingFlags.Instance); Assembly asm = (Assembly) fiasm.GetValue(tempasm); string codebase = new Uri(asm.CodeBase).LocalPath; string code = Path.Combine( Path.GetDirectoryName(codebase), Path.GetFileNameWithoutExtension(codebase) + ".0.cs"); using (StreamReader sr = new StreamReader(code)) { output = sr.ReadToEnd(); } #endregion Retrieve XmlSerializer output #region Create CodeDom System.CodeDom.CodeNamespace ns = new System.CodeDom.CodeNamespace(targetNamespace); ns.Imports.Add(new CodeNamespaceImport("System.Xml.Serialization")); ns.Imports.Add(new CodeNamespaceImport("System")); CodeTypeDeclaration serializer = new CodeTypeDeclaration(type.Name + "Serializer"); serializer.BaseTypes.Add(typeof(XmlSerializer)); serializer.Comments.Add(new CodeCommentStatement( "<summary>Custom serializer for " + type.Name + " type.</summary", true)); ns.Types.Add(serializer); #endregion Create CodeDom #region Initial string manipulation & custom XmlSerializer creation // Remove assembly attribute. output = output.Replace("[assembly:System.Security.AllowPartiallyTrustedCallers()]", ""); // Replace namespace. output = output.Replace("Microsoft.Xml.Serialization.GeneratedAssembly", type.FullName + "Serialization"); // Give generated classes more friendly names. output = output.Replace("public class XmlSerializationWriter1", @"/// <remarks/> public class Writer"); output = output.Replace("public class XmlSerializationReader1", @"/// <remarks/> public class Reader"); // Find the method that is the entry point for reading the object. Match readmatch = PublicRead.Match(output); string rootobject = readmatch.Groups[PublicRootObject].Value; // Now add custom serializer members with the new info. string sm = String.Format( TemplateCustomSerializer, serializer.Name, rootobject + "Reader", rootobject + "Writer", type.FullName); serializer.Members.Add(new CodeSnippetTypeMember(sm)); #endregion Initial string manipulation & custom XmlSerializer creation #region Create custom event rising typed reader CodeTypeDeclaration reader = new CodeTypeDeclaration(rootobject + "Reader"); reader.BaseTypes.Add(serializer.Name + ".Reader"); ns.Types.Add(reader); // For each read method Match readm = PrivateMethods.Match(output); while (readm.Success) { string objectread = readm.Groups[ReadMethodObjectName].Value; // Skip the generic reading method. if (objectread.ToLower() == "object") { readm = readm.NextMatch(); continue; } // Create a delegate for the event to expose. CodeTypeDelegate del = new CodeTypeDelegate( objectread + "DeserializedHandler"); char[] name = objectread.ToCharArray(); name[0] = Char.ToLower(name[0]); del.Parameters.Add(new CodeParameterDeclarationExpression( readm.Groups[ReadMethodReturnType].Value, new string(name))); del.Comments.Add(new CodeCommentStatement("/// <remarks/>", true)); ns.Types.Add(del); // Expose event. CodeMemberEvent ev = new CodeMemberEvent(); ev.Name = objectread + "Deserialized"; ev.Attributes = MemberAttributes.Public; ev.Type = new CodeTypeReference(del.Name); ev.Comments.Add(new CodeCommentStatement("/// <remarks/>", true)); reader.Members.Add(ev); // Override base method. string mo = String.Format( TemplateMethodOverride, readm.Groups[ReadMethodReturnType].Value, readm.Groups[ReadMethodName].Value, del.Name, ev.Name, readm.Groups[ReadMethodArguments].Value, // Arguments contain type + parameter name. Remove type for method call. RemoveTypeFromArguments.Replace( readm.Groups[ReadMethodArguments].Value, "")); reader.Members.Add(new CodeSnippetTypeMember(mo)); readm = readm.NextMatch(); } // Add the "final" public read method. reader.Members.Add(new CodeSnippetTypeMember( String.Format(TemplateReadMethod, type.FullName, readmatch.Groups[PublicMethodName].Value))); // Turn original public method into internal protected output = PublicRead.Replace(output, "protected internal object ${method}"); // Turn all private methods into protected virtual, as they are overriden // by the custom event rising reader. output = PrivateMethods.Replace(output, @"/// <remarks/> protected virtual ${return} ${method} {"); #endregion Create custom event rising typed reader #region Create custom writer CodeTypeDeclaration writer = new CodeTypeDeclaration(rootobject + "Writer"); writer.BaseTypes.Add(serializer.Name + ".Writer"); ns.Types.Add(writer); // Find the method that is the entry point for writing the object. Match writematch = PublicWrite.Match(output); // Add the "final" public write method. writer.Members.Add(new CodeSnippetTypeMember( String.Format(TemplateWriteMethod, type.FullName, writematch.Groups[PublicMethodName].Value))); // Turn original public method into internal protected output = PublicWrite.Replace(output, "protected internal void ${method}"); #endregion Create custom writer #region Make generated reader and writer classes inner classes of custom serializer int indexofreader = output.IndexOf("public class Reader"); int indexofwriter = output.IndexOf("public class Writer"); string genw = output.Substring( indexofwriter, indexofreader - indexofwriter); string genr = output.Substring( indexofreader, output.Length - indexofreader - 4); // Add #pragma to avoid compiler warnings. // TODO: Check how to do this for v1.x. //genr = "#pragma warning disable CS0642\n" + genr + "\n#pragma warning restore CS0642"; //genw = "#pragma warning disable CS0642\n" + genw + "\n#pragma warning restore CS0642"; serializer.Members.Add(new CodeSnippetTypeMember(genr)); serializer.Members.Add(new CodeSnippetTypeMember(genw)); #endregion Make generated reader and writer classes inner classes of custom serializer #region Generate code from CodeDom ICodeGenerator gen = new Microsoft.CSharp.CSharpCodeProvider().CreateGenerator(); CodeGeneratorOptions opt = new CodeGeneratorOptions(); opt.BracingStyle = "C"; StringWriter finalcode = new StringWriter(); gen.GenerateCodeFromNamespace(ns, finalcode, opt); #endregion Generate code from CodeDom //output = finalcode.ToString() + output; return finalcode.ToString(); //return output; } } } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:32:03
|
Update of /cvsroot/mvp-xml/Design/v1/src/CustomTools/SGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11033/v1/src/CustomTools/SGen Added Files: SGenTool.cs Log Message: Custom tool class that exposes the SGen feature. Uses the XmlSerializerGenerator under the covers. --- NEW FILE: SGenTool.cs --- #region using using System; using System.Collections; using System.ComponentModel; using System.ComponentModel.Design; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Xml; using System.Xml.Schema; using EnvDTE; using VSLangProj; #endregion namespace Mvp.Xml.Design.CustomTools.SGen { /// <summary> /// Generates custom typed XmlSerializers. /// </summary> /// <remarks> /// On any class set the Custom Tool property to "SGen". /// This tool supports C# projects only, as that's the code generated /// by the XmlSerializer class. /// </remarks> [Guid("4F194ABB-9123-4468-ABFC-474899C3A94E")] [CustomTool("SGen", "MVP XML XmlSerializer Generation Tool", false)] [ComVisible(true)] [VersionSupport("7.1")] [CategorySupport(CategorySupportAttribute.CSharpCategory)] public class SGenTool : CustomTool { static string ConfigFile; #region Static config initialization for assembly location resolving static SGenTool() { AssemblyName name = Assembly.GetExecutingAssembly().GetName(); ConfigFile = Path.GetTempFileName() + ".config"; using (StreamWriter sw = new StreamWriter(ConfigFile)) { // Keep serialization files. Required for SGen to work. sw.Write(@"<?xml version='1.0' encoding='utf-8' ?> <configuration> <system.diagnostics> <switches> <add name='XmlSerialization.Compilation' value='4'/> </switches> </system.diagnostics> </configuration>"); } } private static string GetHexString(byte[] token) { StringBuilder sb = new StringBuilder(token.Length * 2); for(int i = 0; i < token.Length; i++) { sb.AppendFormat("{0:X2}", token[i]); } return sb.ToString(); } #endregion Static config initialization for dynamic domains #region GenerateCode /// <summary> /// Generates the output. /// </summary> protected override byte[] GenerateCode(string inputFileName, string inputFileContent) { AppDomain domain = null; try { // Force compilation of the current project. We need the type in the output. ProjectItem item = base.CurrentItem; item.DTE.Solution.SolutionBuild.BuildProject( item.DTE.Solution.SolutionBuild.ActiveConfiguration.Name, item.ContainingProject.UniqueName, true); // Copy Design assembly to output for the isolated AppDomain. string output = item.ContainingProject.ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value.ToString(); output = Path.Combine(item.ContainingProject.Properties.Item("FullPath").Value.ToString(), output); string asmfile = ReflectionHelper.GetAssemblyPath(Assembly.GetExecutingAssembly()); File.Copy(asmfile, Path.Combine(output, Path.GetFileName(asmfile)), true); CodeClass targetclass = null; foreach (CodeElement element in item.FileCodeModel.CodeElements) { if (element is CodeNamespace) { foreach (CodeElement codec in ((CodeNamespace)element).Members) { if (codec is CodeClass) { targetclass = (CodeClass) codec; break; } } } else if (element is CodeClass) { targetclass = (CodeClass) element; } if (targetclass != null) { break; } } string codefile = Path.GetTempFileName(); AppDomainSetup setup = new AppDomainSetup(); setup.ApplicationName = "Mvp.Xml Design Domain"; setup.ApplicationBase = output; setup.ConfigurationFile = ConfigFile; domain = AppDomain.CreateDomain("Mvp.Xml Design Domain", null, setup); // Runner ctor will dump the output to the file we pass. domain.CreateInstance( Assembly.GetExecutingAssembly().FullName, typeof(SGenRunner).FullName, false, 0, null, new object[] { codefile, targetclass.FullName + ", " + item.ContainingProject.Properties.Item("AssemblyName").Value.ToString(), base.FileNameSpace }, null, null, null); string code; using (StreamReader reader = new StreamReader(codefile)) { code = reader.ReadToEnd(); } return System.Text.Encoding.ASCII.GetBytes(code); } catch (Exception e) { return System.Text.Encoding.ASCII.GetBytes(e.ToString()); } finally { if (domain != null) { AppDomain.Unload(domain); } } } #endregion GenerateCode #region GetDefaultExtension /// <summary> /// This tool generates code, and the default extension equals that of the current code provider. /// </summary> public override string GetDefaultExtension() { return "Serialization." + base.CodeProvider.FileExtension; } #endregion GetDefaultExtension #region Registration and Installation /// <summary> /// Registers the generator. /// </summary> [ComRegisterFunction] public static void RegisterClass(Type type) { CustomTool.Register(typeof(SGenTool)); } /// <summary> /// Unregisters the generator. /// </summary> [ComUnregisterFunction] public static void UnregisterClass(Type t) { CustomTool.UnRegister(typeof(SGenTool)); } #endregion Registration and Installation } } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:31:10
|
Update of /cvsroot/mvp-xml/Design/v1/src/CustomTools/SGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10882/v1/src/CustomTools/SGen Added Files: SGenRunner.cs Log Message: MBR object that genertes the code in a separate AppDomain to avoid project output locking. --- NEW FILE: SGenRunner.cs --- using System; using System.IO; namespace Mvp.Xml.Design.CustomTools.SGen { /// <summary> /// Class that performs the actual code generation in the isolated design domain. /// </summary> internal class SGenRunner : MarshalByRefObject { /// <summary> /// Generates the code for the received type. /// </summary> public SGenRunner(string outputFile, string forType, string targetNamespace) { using (StreamWriter writer = new StreamWriter(outputFile)) { writer.Write(XmlSerializerGenerator.GenerateCode( Type.GetType(forType), targetNamespace)); } } } } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:31:02
|
Update of /cvsroot/mvp-xml/Design/v1/src/CustomTools/SGen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10837/v1/src/CustomTools/SGen Added Files: ClassPicker.cs ClassPicker.resx Log Message: Initial version of the class picker that will allow selection of the classes from a set of classes in a single file for custom XmlSerializers generation --- NEW FILE: ClassPicker.cs --- using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace Mvp.Xml.Design.CustomTools.SGen { /// <summary> /// Summary description for ClassPicker. /// </summary> public class ClassPicker : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.Button btnCancel; private System.Windows.Forms.Button btnAccept; private System.Windows.Forms.CheckedListBox lstClasses; /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.Container components = null; public ClassPicker() { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // } /// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.lstClasses = new System.Windows.Forms.CheckedListBox(); this.label1 = new System.Windows.Forms.Label(); this.btnCancel = new System.Windows.Forms.Button(); this.btnAccept = new System.Windows.Forms.Button(); this.SuspendLayout(); // // lstClasses // this.lstClasses.Location = new System.Drawing.Point(8, 56); this.lstClasses.Name = "lstClasses"; this.lstClasses.Size = new System.Drawing.Size(384, 214); this.lstClasses.TabIndex = 0; // // label1 // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.label1.Location = new System.Drawing.Point(8, 8); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(384, 48); this.label1.TabIndex = 1; this.label1.Text = "Select the classes you will use as the root of a deserialization process. A custo" + "m XmlSerializer and supporting classes will be generated for each of the selecte" + "d ones:"; // // btnCancel // this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnCancel.Location = new System.Drawing.Point(316, 280); this.btnCancel.Name = "btnCancel"; this.btnCancel.TabIndex = 2; this.btnCancel.Text = "&Cancel"; // // btnAccept // this.btnAccept.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnAccept.Location = new System.Drawing.Point(236, 280); this.btnAccept.Name = "btnAccept"; this.btnAccept.TabIndex = 3; this.btnAccept.Text = "&Accept"; // // ClassPicker // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(400, 309); this.Controls.Add(this.btnAccept); this.Controls.Add(this.btnCancel); this.Controls.Add(this.label1); this.Controls.Add(this.lstClasses); this.Name = "ClassPicker"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = " Class Picker"; this.ResumeLayout(false); } #endregion } } --- NEW FILE: ClassPicker.resx --- <?xml version="1.0" encoding="utf-8"?> <root> <!-- Microsoft ResX Schema Version 1.3 The primary goals of this format is to allow a simple XML format that is mostly human readable. The generation and parsing of the various data types are done through the TypeConverter classes associated with the data types. Example: ... ado.net/XML headers & schema ... <resheader name="resmimetype">text/microsoft-resx</resheader> <resheader name="version">1.3</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <data name="Name1">this is my long string</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> [base64 mime encoded serialized .NET Framework object] </data> <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> [base64 mime encoded string representing a byte array form of the .NET Framework object] </data> There are any number of "resheader" rows that contain simple name/value pairs. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support text/value conversion through the TypeConverter architecture. Classes that don't support this are serialized and stored with the mimetype set. The mimetype is used forserialized objects, and tells the ResXResourceReader how to depersist the object. This is currently not extensible. For a given mimetype the value must be set accordingly: Note - application/x-microsoft.net.object.binary.base64 is the format that the ResXResourceWriter will generate, however the reader can read any of the formats listed below. mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with : System.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 value : The object must be serialized with : System.Runtime.Serialization.Formatters.Soap.SoapFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.bytearray.base64 value : The object must be serialized into a byte array : using a System.ComponentModel.TypeConverter : and then encoded with base64 encoding. --> <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> <xsd:element name="root" msdata:IsDataSet="true"> <xsd:complexType> <xsd:choice maxOccurs="unbounded"> <xsd:element name="data"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> </xsd:complexType> </xsd:element> <xsd:element name="resheader"> <xsd:complexType> <xsd:sequence> <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> </xsd:sequence> <xsd:attribute name="name" type="xsd:string" use="required" /> </xsd:complexType> </xsd:element> </xsd:choice> </xsd:complexType> </xsd:element> </xsd:schema> <resheader name="resmimetype"> <value>text/microsoft-resx</value> </resheader> <resheader name="version"> <value>1.3</value> </resheader> <resheader name="reader"> <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> <data name="lstClasses.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="lstClasses.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="lstClasses.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="label1.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="label1.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="label1.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="btnCancel.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="btnCancel.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="btnCancel.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="btnAccept.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="btnAccept.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="btnAccept.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> <data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>(Default)</value> </data> <data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>False</value> </data> <data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>4, 4</value> </data> <data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>80</value> </data> <data name="$this.Name"> <value>ClassPicker</value> </data> <data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>True</value> </data> <data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <value>Private</value> </data> </root> |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:29:51
|
Update of /cvsroot/mvp-xml/Design/v1/src/CustomTools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10616/v1/src/CustomTools Added Files: CustomTool.cs Log Message: Base class for custom tools, that provides helper methods and properties as well as registration methods. --- NEW FILE: CustomTool.cs --- #region using using System; using System.CodeDom; using System.CodeDom.Compiler; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using Microsoft.Win32; using EnvDTE; using VSLangProj; #endregion using namespace Mvp.Xml.Design.CustomTools { /// <summary> /// Base class for all custom tools. /// </summary> /// <remarks> /// Inheriting classes must provide a <see cref="GuidAttribute"/>, static /// methods with <see cref="ComRegisterFunctionAttribute"/> and <see cref="ComUnregisterFunctionAttribute"/>, /// which should call this class <see cref="Register"/> and <see cref="UnRegister"/> /// methods, passing the required parameters. /// </remarks> public abstract class CustomTool : VisualStudio.BaseCodeGeneratorWithSite { #region Constants /// <summary> /// {0}=VsVersion.Mayor, {1}=VsVersion.Minor, {2}=CategoryGuid, {3}=CustomTool /// </summary> const string RegistryKey = @"SOFTWARE\Microsoft\VisualStudio\{0}.{1}\Generators\{2}\{3}"; #endregion Constants #region Properties /// <summary> /// Provides access to the current project item selected. /// </summary> protected ProjectItem CurrentItem { get { return base.GetService(typeof(ProjectItem)) as ProjectItem; } } /// <summary> /// Provides access to the current project item selected. /// </summary> protected VSProject CurrentProject { get { if (CurrentItem != null) return CurrentItem.ContainingProject.Object as VSProject; return null; } } #endregion Properties #region Service access /// <summary> /// Provides access to services. /// </summary> /// <param name="serviceType">Service to retrieve.</param> /// <returns>The service object or null.</returns> protected override object GetService(Type serviceType) { object svc = base.GetService(serviceType); // Try the root environment. if (svc == null && CurrentItem == null) return null; VisualStudio.IOleServiceProvider ole = CurrentItem.DTE as VisualStudio.IOleServiceProvider; if (ole != null) return new VisualStudio.ServiceProvider(ole).GetService(serviceType); return null; } #endregion Service access #region Registration and Installation /// <summary> /// Registers the custom tool. /// </summary> public static void Register(Type type) { Guid generator; CustomToolAttribute tool; VersionSupportAttribute[] versions; CategorySupportAttribute[] categories; GetAttributes(type, out generator, out tool, out versions, out categories); foreach (VersionSupportAttribute version in versions) { foreach (CategorySupportAttribute category in categories) { RegisterCustomTool(generator, category.Guid, version.Version, tool.Description, tool.Name, tool.GeneratesDesignTimeCode); } } } /// <summary> /// Unregisters the custom tool. /// </summary> public static void UnRegister(Type type) { Guid generator; CustomToolAttribute tool; VersionSupportAttribute[] versions; CategorySupportAttribute[] categories; GetAttributes(type, out generator, out tool, out versions, out categories); foreach (VersionSupportAttribute version in versions) { foreach (CategorySupportAttribute category in categories) { UnRegisterCustomTool(category.Guid, version.Version, tool.Name); } } } #endregion Registration and Installation #region Helper methods /// <summary> /// Registers the custom tool. /// </summary> private static void RegisterCustomTool(Guid generator, Guid category, Version vsVersion, string description, string toolName, bool generatesDesignTimeCode) { /* * [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[vsVersion]\Generators\[category]\[toolName]] * @="[description]" * "CLSID"="[category]" * "GeneratesDesignTimeSource"=[generatesDesignTimeCode] */ string keypath = String.Format(RegistryKey, vsVersion.Major, vsVersion.Minor, category.ToString("B"), toolName); using(RegistryKey key = Registry.LocalMachine.CreateSubKey(keypath)) { key.SetValue("", description); key.SetValue("CLSID", generator.ToString("B")); key.SetValue("GeneratesDesignTimeSource", generatesDesignTimeCode ? 1 : 0); } } /// <summary> /// Unregisters the custom tool. /// </summary> private static void UnRegisterCustomTool(Guid category, Version vsVersion, string toolName) { string key = String.Format(RegistryKey, vsVersion.Major, vsVersion.Minor, category.ToString("B"), toolName); Registry.LocalMachine.DeleteSubKey(key, false); } private static void GetAttributes(Type type, out Guid generator, out CustomToolAttribute tool, out VersionSupportAttribute[] versions, out CategorySupportAttribute[] categories) { object[] attrs; // Retrieve the GUID associated with the generator class. attrs = type.GetCustomAttributes(typeof(GuidAttribute), false); if (attrs.Length == 0) throw new ArgumentException(SR.Tool_AttributeMissing( type, typeof(GuidAttribute))); generator = new Guid(((GuidAttribute)attrs[0]).Value); // Retrieve the custom tool information. attrs = type.GetCustomAttributes(typeof(CustomToolAttribute), false); if (attrs.Length == 0) throw new ArgumentException(SR.Tool_AttributeMissing( type, typeof(CustomToolAttribute))); tool = (CustomToolAttribute) attrs[0]; // Retrieve the VS.NET versions supported. Can be inherited. attrs = type.GetCustomAttributes(typeof(VersionSupportAttribute), true); if (attrs.Length == 0) throw new ArgumentException(SR.Tool_AttributeMissing( type, typeof(VersionSupportAttribute))); versions = (VersionSupportAttribute[]) attrs; // Retrieve the VS.NET generator categories supported. Can be inherited. attrs = type.GetCustomAttributes(typeof(CategorySupportAttribute), true); if (attrs.Length == 0) throw new ArgumentException(SR.Tool_AttributeMissing( type, typeof(CategorySupportAttribute))); categories = (CategorySupportAttribute[]) attrs; } #endregion Helper methods } } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:29:19
|
Update of /cvsroot/mvp-xml/Design/v1/src/CustomTools In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10533/v1/src/CustomTools Added Files: Attributes.cs Log Message: Set of attributes to use for easy development and registration of custom tools. Includes the visual studio version to support as well as the language. --- NEW FILE: Attributes.cs --- #region using using System; #endregion using namespace Mvp.Xml.Design.CustomTools { #region CustomToolAttribute /// <summary> /// Specifies custom tool registration information. /// </summary> [AttributeUsage(AttributeTargets.Class)] public class CustomToolAttribute : Attribute { /// <summary> /// Assigns custom tool information to the class. /// </summary> /// <param name="name">Name of the custom tool.</param> /// <param name="description">A description of the tool.</param> /// <param name="generatesDesignTimeCode"> /// If <see langword="true" />, the IDE will try to compile on the fly the /// dependent the file associated with this tool, and make it available /// through intellisense to the rest of the project. /// </param> public CustomToolAttribute(string name, string description, bool generatesDesignTimeCode) { _name = name; _description = description; _code = generatesDesignTimeCode; } /// <summary> /// Name of the custom tool. /// </summary> public string Name { get { return _name; } } string _name; /// <summary> /// Friendly description of the tool. /// </summary> public string Description { get { return _description; } } string _description; /// <summary> /// Specifies whether the tool generates design time code to compile on the fly. /// </summary> public bool GeneratesDesignTimeCode { get { return _code; } } bool _code; } #endregion CustomToolAttribute #region VersionSupportAttribute /// <summary> /// Determines which versions of VS.NET are supported by the custom tool. /// </summary> [AttributeUsage(AttributeTargets.Class, AllowMultiple=true)] public class VersionSupportAttribute : Attribute { /// <summary> /// Initializes the attribute. /// </summary> /// <param name="version">Version supported by the tool.</param> public VersionSupportAttribute(string version) { _version = new Version(version); } /// <summary> /// Version supported by the tool. /// </summary> public Version Version { get { return _version; } } Version _version; } #endregion VersionSupportAttribute #region CategorySupportAttribute /// <summary> /// Determines which VS.NET generator categories are supported by the custom tool. /// This class also contains constants for C# and VB.NET category guids. /// </summary> [AttributeUsage(AttributeTargets.Class, AllowMultiple=true)] public class CategorySupportAttribute : Attribute { /// <summary> /// VS Generator Category for C# Language. /// </summary> public const string CSharpCategory = "{FAE04EC1-301F-11D3-BF4B-00C04F79EFBC}"; /// <summary> /// VS Generator Category for VB Language. /// </summary> public const string VBCategory = "{164B10B9-B200-11D0-8C61-00A0C91E29D5}"; /// <summary> /// Initializes the attribute. /// </summary> /// <param name="categoryGuid"> /// Either <see cref="CSharpCategory"/> or <see cref="VBCategory"/>. /// </param> public CategorySupportAttribute(string categoryGuid) { _category = new Guid(categoryGuid); } /// <summary> /// The identifier of the supported category. /// </summary> public Guid Guid { get { return _category; } } Guid _category; } #endregion CategorySupportAttribute } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:28:52
|
Update of /cvsroot/mvp-xml/Design/v1/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10464/v1/src Added Files: ReflectionHelper.cs Log Message: Helper class that provides several reflection-related utilities. --- NEW FILE: ReflectionHelper.cs --- #region using using System; using System.Collections; using System.Diagnostics; using System.IO; using System.Reflection; using System.Security.Permissions; using System.Threading; using System.Web; using System.Globalization; #endregion using namespace Mvp.Xml.Design { /// <summary> /// Provides utility methods for reflection-related operations. /// </summary> public sealed class ReflectionHelper { #region Private ctor // Since this class provides only static methods, make the default constructor private to prevent // instances from being created with "new ReflectionHelper()". private ReflectionHelper() {} #endregion Private ctor #region Miscelaneous /// <summary> /// Ensures that an instance of the type passed as the /// <paramref name="source"/> can be assigned to a variable of /// type <paramref name="assignableTo"/>. /// </summary> /// <param name="source">The type to check.</param> /// <param name="assignableTo">The type the <paramref name="source"/> must be assignable to.</param> public static void EnsureAssignableTo(Type source, Type assignableTo) { if (!assignableTo.IsAssignableFrom(source)) { // TODO: throw new ArgumentException(); // throw new ArgumentException(String.Format( // System.Globalization.CultureInfo.CurrentCulture, // Properties.Resources.ReflectionHelper_CantAssignTo, // source, assignableTo)); } } #endregion Miscelaneous #region Assembly Methods /// <summary> /// Gets the simplified name of the Type, which includes its full namespace qualified /// name and the targetAssembly name, without the other values. /// </summary> /// <param name="type">The type whose name is to be discovered.</param> public static string GetSimpleTypeName(Type type) { if (type == null) throw new ArgumentNullException("type"); return String.Concat(type.FullName, ", ", GetAssemblyName(type)); } /// <summary> /// Gets the simplified name of the object's Type, which includes its full namespace qualified /// name and the targetAssembly name, without the other values. /// </summary> /// <param name="target">The type whose name is to be discovered.</param> public static string GetSimpleTypeName(object target) { if (target == null) throw new ArgumentNullException("target"); return GetSimpleTypeName(target.GetType()); } /// <summary> /// Gets the targetAssembly name, without requiring <see cref="System.Security.Permissions.FileIOPermission"/> on the calling code. /// </summary> /// <param name="targetAssembly">The targetAssembly which name is to be discovered.</param> /// <returns>The same value as "Assembly.GetName().Name".</returns> public static string GetAssemblyName(Assembly targetAssembly) { if (targetAssembly == null) throw new ArgumentNullException("targetAssembly"); return targetAssembly.FullName.Substring(0, targetAssembly.FullName.IndexOf(",")); } /// <summary> /// Gets the targetAssembly name to which the type belongs, without requiring <see cref="System.Security.Permissions.FileIOPermission"/> on the calling code. /// </summary> /// <param name="type">The type which targetAssembly name is to be discovered.</param> /// <returns>The same value as "Assembly.GetName().Name".</returns> public static string GetAssemblyName(Type type) { if (type == null) throw new ArgumentNullException("type"); return GetAssemblyName(type.Assembly); } /// <summary> /// Returns the targetAssembly part of a fully qualified type name. /// </summary> /// <param name="qualifiedTypeName">Fully qualified type name.</param> /// <returns>The targetAssembly name.</returns> public static string GetAssemblyName(string qualifiedTypeName) { if (qualifiedTypeName == null) throw new ArgumentNullException("qualifiedTypeName"); string[] names = qualifiedTypeName.Split(','); if (names.Length < 2) { // TODO: throw new ArgumentException("qualifiedTypeName"); // throw new ArgumentException(String.Format( // System.Globalization.CultureInfo.CurrentCulture, // Properties.Resources.ReflectionHelper_InvalidQName, qualifiedTypeName)); } return names[1].Trim(); } /// <summary> /// Gets the Assembly Title. /// </summary> /// <param name="targetAssembly">Assembly to get title.</param> /// <returns></returns> public static string GetAssemblyTitle(Assembly targetAssembly) { if (targetAssembly == null) throw new ArgumentNullException("targetAssembly"); object [] att = targetAssembly.GetCustomAttributes(typeof(AssemblyTitleAttribute), false); return ((att.Length > 0) ? ((AssemblyTitleAttribute) att [0]).Title : String.Empty); } /// <summary> /// Instructs a compiler to use a specific version number for the Win32 file version resource. /// The Win32 file version is not required to be the same as the targetAssembly's version number. /// </summary> /// <param name="targetAssembly">Assembly to get version.</param> /// <returns></returns> public static string GetAssemblyFileVersion(Assembly targetAssembly) { if (targetAssembly == null) throw new ArgumentNullException("targetAssembly"); object[] att = targetAssembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), false); return ((att.Length > 0) ? ((AssemblyFileVersionAttribute) att [0]).Version : String.Empty); } /// <summary> /// Gets the Assembly Product. /// </summary> /// <param name="targetAssembly">Assembly to get product.</param> /// <returns></returns> public static string GetAssemblyProduct(Assembly targetAssembly) { if (targetAssembly == null) throw new ArgumentNullException("targetAssembly"); object[] att = targetAssembly.GetCustomAttributes(typeof(AssemblyProductAttribute), false); return ((att.Length > 0) ? ((AssemblyProductAttribute) att [0]).Product : String.Empty); } /// <summary> /// Gets the Assembly Configuration Attribute. /// </summary> /// <param name="targetAssembly">Assembly to get configuration.</param> /// <returns></returns> public static string GetAssemblyConfiguration(Assembly targetAssembly) { if (targetAssembly == null) throw new ArgumentNullException("targetAssembly"); object[] att = targetAssembly.GetCustomAttributes(typeof(AssemblyConfigurationAttribute), false); return ((att.Length > 0) ? ((AssemblyConfigurationAttribute) att [0]).Configuration : String.Empty); } /// <summary> /// Gets an targetAssembly full path and file name. /// </summary> /// <param name="targetAssembly">Assembly to get path.</param> /// <returns></returns> public static string GetAssemblyPath(Assembly targetAssembly) { if (targetAssembly == null) throw new ArgumentNullException("targetAssembly"); Uri uri = new Uri(targetAssembly.CodeBase); return uri.LocalPath; } /// <summary> /// Gets an targetAssembly full path and file name. /// </summary> /// <param name="targetAssembly">Assembly to get path.</param> /// <returns></returns> public static string GetAssemblyFolder(Assembly targetAssembly) { if (targetAssembly == null) throw new ArgumentNullException("targetAssembly"); string path = GetAssemblyPath(targetAssembly); path = path.Substring(0, path.LastIndexOf('\\')); return path; } /// <summary> /// Creates the name of a type qualified by the display name of its targetAssembly. /// The format of the returned string is: FullTypeName, AssemblyName. /// </summary> /// <param name="value"></param> /// <returns></returns> public static string CreateShortQualifiedName(Type value) { if (value == null) throw new ArgumentNullException("value"); return Assembly.CreateQualifiedName(GetAssemblyName(value), value.FullName); } #endregion Assembly Methods #region Conventional type loading /// <summary> /// Returns a <see cref="Type"/> from the name received, loaded from the GAC, the base application folder or the calling targetAssembly. /// </summary> /// <param name="className">Fully qualified name of the class to load.</param> /// <returns>The loaded type.</returns> /// <exception cref="TypeLoadException">The type couldn't be loaded.</exception> /// <remarks> /// If the class name is not targetAssembly-qualified, the calling targetAssembly is used to resolve the name /// first. /// </remarks> public static Type LoadType(string className) { if (className == null) throw new ArgumentNullException("className"); return LoadType(className, false); } /// <summary> /// Returns a <see cref="Type"/> from the name received, loaded from the GAC or the base application folder. /// </summary> /// <param name="className">Fully qualified name of the class to load.</param> /// <param name="callingAssembly">True if the type is in the "CallingAssembly".</param> /// <returns>The loaded type.</returns> /// <exception cref="TypeLoadException">The type couldn't be loaded.</exception> public static Type LoadType(string className, bool callingAssembly) { if (className == null) throw new ArgumentNullException("className"); Type reqtype = null; if(className != null && className.Length > 0) { // Method 1 (full class name in the GAC) if(callingAssembly) reqtype = Assembly.GetCallingAssembly().GetType(className.Trim(), false, true); else reqtype = Type.GetType(className.Trim(), false, true); if (reqtype == null) { // Method 2 (partial class name in the GAC) string[] names = className.Split(','); Assembly asm = Assembly.LoadWithPartialName(GetAssemblyName(className)); if (asm == null) { // TODO: throw new TypeLoadException(); // throw new TypeLoadException(String.Format( // System.Globalization.CultureInfo.CurrentCulture, // Properties.Resources.ReflectionHelper_CantLoadAssembly, // names[1], className)); } reqtype = asm.GetType(names[0].Trim(), true, true); } } return reqtype; } #endregion Conventional type loading #region GetAttribute/GetAttributes /// <summary> /// Gets the attribute from the targetAssembly, or <see langword="null"/> if not available. /// </summary> public static Attribute GetAttribute(ICustomAttributeProvider fromAssembly, Type attributeType) { if (fromAssembly == null) throw new ArgumentNullException("fromAssembly"); if (attributeType == null) throw new ArgumentNullException("attributeType"); return GetAttribute(fromAssembly, attributeType, false, null); } /// <summary> /// Gets the attribute from the member (either a type, method, property, etc), or throws the exception received in /// <paramref name="throwIfMissing"/> if not available. /// </summary> public static Attribute GetAttribute(ICustomAttributeProvider fromMember, Type attributeType, Exception throwIfMissing) { if (fromMember == null) throw new ArgumentNullException("fromMember"); if (attributeType == null) throw new ArgumentNullException("attributeType"); return GetAttribute(fromMember, attributeType, false, throwIfMissing); } /// <summary> /// Gets the attribute from the type, or <see langword="null"/> if not available. /// Depending on <paramref name="inherit"/> it will look for base classes too. /// </summary> public static Attribute GetAttribute(ICustomAttributeProvider fromMember, Type attributeType, bool inherit) { if (fromMember == null) throw new ArgumentNullException("fromMember"); if (attributeType == null) throw new ArgumentNullException("attributeType"); return GetAttribute(fromMember, attributeType, inherit, null); } /// <summary> /// Gets the attribute from the member (either a type, method, property, etc), or throws the exception received in /// <paramref name="throwIfMissing"/> if not available. /// Depending on <paramref name="inherit"/> it will look for base classes too. /// </summary> public static Attribute GetAttribute(ICustomAttributeProvider fromMember, Type attributeType, bool inherit, Exception throwIfMissing) { if (fromMember == null) throw new ArgumentNullException("fromMember"); if (attributeType == null) throw new ArgumentNullException("attributeType"); object[] attrs = fromMember.GetCustomAttributes(attributeType, inherit); if (attrs.Length != 0) { return attrs[0] as Attribute; } else { if (throwIfMissing != null) { throw throwIfMissing; } } return null; } #endregion GetAttribute/GetAttributes } } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:28:27
|
Update of /cvsroot/mvp-xml/Design/v1/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10367/v1/src Added Files: DebugUtils.cs Log Message: Helper class that aids while debugging for dumping IDE information to the debug window (such as Properties instance of DTE objects, project items, etc) --- NEW FILE: DebugUtils.cs --- #region using using System; using System.CodeDom.Compiler; using System.Diagnostics; using System.IO; using EnvDTE; //using Microsoft.VisualStudio.CommandBars; #endregion using /// <summary> /// Utility methods for working with the IDE while debugging. /// </summary> internal class DebugUtils { public static void DumpUIHierarchy(UIHierarchy hierarchy) { StringWriter sw = new StringWriter(); IndentedTextWriter tw = new IndentedTextWriter(sw); DumpUIHierarchyItems(hierarchy.UIHierarchyItems, tw); tw.Flush(); System.Diagnostics.Debugger.Log(0, "Debug", sw.ToString()); } private static void DumpUIHierarchyItems(UIHierarchyItems items, IndentedTextWriter tw) { tw.Indent++; foreach (UIHierarchyItem item in items) { tw.Write(item.Name); if (item.Object is ProjectItem) tw.WriteLine(" (ProjectItem)"); else if (item.Object is Project) tw.WriteLine(" (Project)"); else tw.WriteLine(" (Unknown)"); if (item.UIHierarchyItems != null) DumpUIHierarchyItems(item.UIHierarchyItems, tw); } tw.Indent--; } public static void DumpProjectItems(DTE dte) { StringWriter sw = new StringWriter(); IndentedTextWriter tw = new IndentedTextWriter(sw); tw.WriteLine(dte.Solution.FullName); System.Collections.IEnumerator en = dte.Solution.GetEnumerator(); while (en.MoveNext()) { if (en.Current is ProjectItem) { tw.Indent++; tw.WriteLine(((ProjectItem)en.Current).Name); DumpProjectItems(((ProjectItem)en.Current).ProjectItems, tw); tw.Indent--; } else if (en.Current is Project) { Project p = en.Current as Project; tw.Indent++; tw.WriteLine(p.Name + " (" + p.Kind + ")"); DumpProjectItems(p.ProjectItems, tw); tw.Indent--; } } tw.Flush(); System.Diagnostics.Debugger.Log(0, "Debug", sw.ToString()); } private static void DumpProjectItems(ProjectItems items, IndentedTextWriter tw) { tw.Indent++; foreach (ProjectItem item in items) { tw.WriteLine(item.Name); // + "(" + item.Kind + ")"); if (item.Object is Project) { DumpProjectItems(((Project)item.Object).ProjectItems, tw); } // else if (item.Object is EnvDTE80.SolutionFolder) // { // tw.WriteLine("**** SolutionFolder ****"); // } else if (item.ProjectItems != null) { DumpProjectItems(item.ProjectItems, tw); } } tw.Indent--; } public static void DumpProperties(Properties props) { StringWriter sw = new StringWriter(); foreach (Property prop in props) sw.WriteLine("Name={0}, Value={1}", prop.Name, prop.Value.ToString()); System.Diagnostics.Debugger.Log(0, "Debug", sw.ToString()); } // public static void DumpCommandBars(DTE dte) // { // StringWriter sw = new StringWriter(); // IndentedTextWriter tw = new IndentedTextWriter(sw); // // CommandBars bars = (CommandBars) dte.CommandBars; // // foreach (CommandBar bar in bars) // { // DumpCommandBar(bar, tw); // } // // tw.Flush(); // System.Diagnostics.Debugger.Log(0, "Debug", sw.ToString()); // } // // public static void DumpCommandBar(CommandBar bar, IndentedTextWriter tw) // { // tw.WriteLine(bar.Name); // tw.Indent++; // DumpControls(bar.Controls, tw); // tw.Indent--; // } // // // public static void DumpControls(CommandBarControls controls, IndentedTextWriter tw) // { // foreach (CommandBarControl control in controls) // { // if (control is CommandBar) // { // tw.Indent++; // DumpCommandBar((CommandBar)control, tw); // tw.Indent--; // } // else // { // tw.WriteLine("[" + control.Caption + "]"); // } // } // } } |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:27:04
|
Update of /cvsroot/mvp-xml/Design/v1/tests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10039/v1/tests Added Files: .cvsignore changelog.txt license.txt Log Message: Initial release of the Mvp.Xml.Design package. Includes project, license files, changelog, and string resources. --- NEW FILE: .cvsignore --- bin obj *.user *.suo --- NEW FILE: changelog.txt --- --------------------------------------------------------- April 01, 2004 Initial setup. Folder should preferably contain NUnit tests. --- NEW FILE: license.txt --- Common Public License Version 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:27:03
|
Update of /cvsroot/mvp-xml/Design/v1/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10039/v1/lib Added Files: changelog.txt Log Message: Initial release of the Mvp.Xml.Design package. Includes project, license files, changelog, and string resources. --- NEW FILE: changelog.txt --- --------------------------------------------------------- April 01, 2004 Initial setup. Will contain external libraries referenced by the project. |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:26:55
|
Update of /cvsroot/mvp-xml/Design/v1/doc In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10039/v1/doc Added Files: changelog.txt Log Message: Initial release of the Mvp.Xml.Design package. Includes project, license files, changelog, and string resources. --- NEW FILE: changelog.txt --- --------------------------------------------------------- April 01, 2004 Initial setup. Folder contains any documentation related to the module. |
From: Daniel C. \(kzu\) <dca...@us...> - 2004-10-10 15:26:54
|
Update of /cvsroot/mvp-xml/Design/v1 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10039/v1 Added Files: .cvsignore license.txt Log Message: Initial release of the Mvp.Xml.Design package. Includes project, license files, changelog, and string resources. --- NEW FILE: .cvsignore --- NMatrix.Xml.suo --- NEW FILE: license.txt --- Common Public License Version 1.0 THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. 1. DEFINITIONS "Contribution" means: a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and b) in the case of each subsequent Contributor: i) changes to the Program, and ii) additions to the Program; where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. "Contributor" means any person or entity that distributes the Program. "Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. "Program" means the Contributions distributed in accordance with this Agreement. "Recipient" means anyone who receives the Program under this Agreement, including all Contributors. 2. GRANT OF RIGHTS a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. 3. REQUIREMENTS A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: a) it complies with the terms and conditions of this Agreement; and b) its license agreement: i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. When the Program is made available in source code form: a) it must be made available under this Agreement; and b) a copy of this Agreement must be included with each copy of the Program. Contributors may not remove or alter any copyright notices contained within the Program. Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. 4. COMMERCIAL DISTRIBUTION Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. 5. NO WARRANTY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. 6. DISCLAIMER OF LIABILITY EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 7. GENERAL If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. |