Бизнес-робот
Бизнес
робот

Темы:

Архив:

Каталог рекламы и объявлений

Ящик для предложений: sales@blogslov.ru

Wix-commits Digest, Vol 11, Issue 28

Send Wix-commits mailing list submissions to


To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/wix-commits
or, via email, send a message with subject or body 'help' to


You can reach the person managing the list at


When replying, please edit your Subject line so it is more specific
than "Re: Contents of Wix-commits digest..."


Today's Topics:

1. wix/src/votive/SDK/Common/Source/CSharp/Project
ImageHandler.cs, NONE, 1.1 ProjectNode.Events.cs, NONE, 1.1
SingleFileGenerator.cs, NONE, 1.1 SingleFileGeneratorFactory.cs,
NONE, 1.1 ConfigurationProperties.cs, 1.1, 1.2
DependentFileNode.cs, 1.2, 1.3 FileDocumentManager.cs, 1.1, 1.2
FileNode.cs, 1.2, 1.3 FolderNode.cs, 1.2, 1.3 HierarchyNode.cs,
1.2, 1.3 IDEBuildLogger.cs, 1.1, 1.2 Interfaces.cs, 1.1, 1.2
Microsoft.VisualStudio.Package.Project.cs, 1.1, 1.2
Microsoft.VisualStudio.Package.Project.resx, 1.1, 1.2
NestedProjectNode.cs, 1.2, 1.3 NodeProperties.cs, 1.2, 1.3
Output.cs, 1.1, 1.2 OutputGroup.cs, 1.1, 1.2 ProjectBase.files,
1.2, 1.3 ProjectConfig.cs, 1.1, 1.2 ProjectElement.cs, 1.1, 1.2
ProjectFactory.cs, 1.1, 1.2 ProjectFileConstants.cs, 1.1, 1.2
ProjectNode.CopyPaste.cs, 1.1, 1.2 ProjectNode.cs, 1.2, 1.3
ProjectReferenceNode.cs, 1.2, 1.3 ReferenceContainerNode.cs, 1.2,
1.3 ReferenceNode.cs, 1.2, 1.3 TokenProcessor.cs, 1.1, 1.2
Utilities.cs, 1.1, 1.2 (Rob Mensching)


----------------------------------------------------------------------

Message: 1
Date: Wed, 27 Jun 2007 05:38:37 +0000
From: Rob Mensching
Subject: [WiX-commits] wix/src/votive/SDK/Common/Source/CSharp/Project
ImageHandler.cs, NONE, 1.1 ProjectNode.Events.cs, NONE, 1.1
SingleFileGenerator.cs, NONE, 1.1 SingleFileGeneratorFactory.cs, NONE,
1.1 ConfigurationProperties.cs, 1.1, 1.2 DependentFileNode.cs, 1.2,
1.3 FileDocumentManager.cs, 1.1, 1.2 FileNode.cs, 1.2, 1.3
FolderNode.cs, 1.2, 1.3 HierarchyNode.cs, 1.2, 1.3 IDEBuildLogger.cs,
1.1, 1.2 Interfaces.cs, 1.1, 1.2
Microsoft.VisualStudio.Package.Project.cs, 1.1, 1.2
Microsoft.VisualStudio.Package.Project.resx, 1.1, 1.2
NestedProjectNode.cs, 1.2, 1.3 NodeProperties.cs, 1.2, 1.3 Output.cs,
1.1, 1.2 OutputGroup.cs, 1.1, 1.2 ProjectBase.files, 1.2, 1.3
ProjectConfig.cs, 1.1, 1.2 ProjectElement.cs, 1.1, 1.2
ProjectFactory.cs, 1.1, 1.2 ProjectFileConstants.cs, 1.1, 1.2
ProjectNode.CopyPaste.cs, 1.1, 1.2 ProjectNode.cs, 1.2, 1.3
ProjectReferenceNode.cs, 1.2, 1.3 ReferenceContainerNode.cs, 1.2, 1.3
ReferenceNode.cs, 1.2, 1.3 TokenProcessor.cs, 1.1, 1.2 Utilities.cs,
1.1, 1.2
To:
Message-ID:

Update of /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv1332/src/votive/SDK/Common/Source/CSharp/Project

Modified Files:
ConfigurationProperties.cs DependentFileNode.cs
FileDocumentManager.cs FileNode.cs FolderNode.cs
HierarchyNode.cs IDEBuildLogger.cs Interfaces.cs
Microsoft.VisualStudio.Package.Project.cs
Microsoft.VisualStudio.Package.Project.resx
NestedProjectNode.cs NodeProperties.cs Output.cs
OutputGroup.cs ProjectBase.files ProjectConfig.cs
ProjectElement.cs ProjectFactory.cs ProjectFileConstants.cs
ProjectNode.CopyPaste.cs ProjectNode.cs
ProjectReferenceNode.cs ReferenceContainerNode.cs
ReferenceNode.cs TokenProcessor.cs Utilities.cs
Added Files:
ImageHandler.cs ProjectNode.Events.cs SingleFileGenerator.cs
SingleFileGeneratorFactory.cs
Log Message:
Benxing: Number of patch related bug fix
*Update FeatureComponent table when ComponentRef in the selected PatchFamily
*File Sequence problem

PMarcu: Allowing extension attributes on DirectoryRef and PropertyRef
Adding extension attributes to the VSExtension Refs

PMarcu: Adding UIRef and DirectoryRef to possible PatchFamily Children
Allowing extension attributes on CustomAction elements.

JRock: Added support for setting pre- and post-build event command lines via a
property page in Votive. This gets me one step closer to restoring the
inter-project variables that we had in V2 but had to pull in V3 to get
it out the door (e.g. $(var.MyProject.TargetPath)).

JRock: Added support for SolutionX variables in the wix.targets file. So, you
can now use $(var.SolutionDir) in your .wxs files and have the variables
automatically added to the preprocessor definitions when building with
wix.targets and MSBuild.

Benxing: Regardless of differences in the MST, we will compare underlying files before
copying data into the patch. Extensions can override CompareFiles to provide
custom file diffing behavior.

AaronSte: Updating Heat to use HKCU instead of HKLM when harvesting registry
information on Windows Vista to avoid UAC issues

PMarcu: Making XsdStitch only output a single prefix for each extension namespace.

Benxing: Fixing null reference exception in the binder when the file table is empty.

RobMen: Default File/@Name to File/@Id.

MikeHo: Fix bug with Setup.exe when trying to install and TEMP and AppData
folders are not on same drive, setup fails

MikeHo: Add fallback to Caching the MSI.

RobMen: SFBUG:1680666 - Correctly modularize RemoveIniFile.DirProperites.

PMarcu: Removing FragmentRef's

AaronSte: SFBUG:1675664 - Marking ComboBox value attribute as localizable.

PMarcu: Adding BinaryRef as a child of PatchFamily.

Benxing: Give warning when removing component from feature during the patch build.

PMarcu: Changing namespace keys in the VSExtension help tables to not be modularized.

PMarcu: Adding some targeted checks to patch transforms to catch possible error
conditions as early as possible.

AaronSte: Adding Visual Studio Codename Orcas detection properties.

AaronSte: SFBUG:1687207 - Update Heat so DllRegisterServer captures will work
on Windows Vista from an elevated cmd prompt.

PMarcu: Fix for DocCompiler to handle ref attributes in attribute definitions under
elements.

BobArnso: Resize and combine some controls to better fit localized strings
(affects all UI sets, dialogs UserExit, OutOfRbDiskDlg, OutOfDiskDlg)

Benxing: Skipping unreal tables when binding transforms to improve patch build
perfomance.
Adding active substorage into binder extension to give the ability to
access corresponding transform information.

JRock: SFBUG:1673425 - Cannot access the VS menu using the alt key
SFBUG:1576283 - Unable to enter 'c' or 'm' in proj properties screen fields
SFBUG:1570392 - Project Designer - Index was outside the bounds of the array
SFBUG:1566296 - Setting 'Cultures' field in project properties has no effect
SFBUG:1576287 - Modifying project properties does not force rebuild

Benxing: Ignore rows without section id in ReduceTransform.

MikeHo: Allow for multiple files to be extracted from chainer.

AaronSte: Adding Visual Studio Team Test project system detection properties.

FGrohn: Support for PubCA in WiX v3.

HeathS: Added extension support to the Validator.
Exposed extension support for the Validator through light.exe.
Exposed extension support for the Validator through smoke.exe.
Exposed multiple .cub file support through smoke.exe.

HeathS: Exposed multiple .cub file support through light.exe.
Added a test for the Validator and multiple .cub support in light.exe.

MikeHo: Add error messages for Windows Installer service can't start or Install
blocked by system policy

BobArnso: Add WixQueryOsInfo CA to detect system suite info and "special
folders" as properties over and above the MSI set

BobArnso: Default to removing library rows from decompiled output in
WixUtilExtension

PMarcu: Refactoring patch buld system to use Pyro instead of Light for filtering
and binding. Other target patch specific bug fixes are in the mix as well.

PMarcu: Adding more command line options to Pyro, specifically the ones that
provide settings for the binder.

PMarcu: Adding error and warning preprocessor instructions.

PMarcu: Fixing an exception thrown when Dark is run and no extensions are defined
in the config file or the config file is absent.
Also, bug where Customtable columns that are not foreign keys have the
keytable attribute defined on the column as keytable="". This results in
an invalid table reference to "".

PMarcu: Switching order on Pyro commandline.

Jordanf: Adding support to WixUnit for Pyro. Fixing the qtest patch.minorupgrade
to use Pyro.

BrianRe: Added code to detect a namespace prefix that is already in use and if
so it will append it with its' position within the "duplicates" for
that specific prefix; eg. sql, sql2, sql3, and so on.

RobMen: Add support for PerformanceCounters (including managed code).

FGrohn: Added COM+ and MSMQ extensions to the zip file.

FGrohn: Move to Windows Vista SDK.

JRock: SFBUG:1566807 - Display full version in about dialog.
SFBUG:1697089 - MSBuild WiX taskscannot resolve WiX tool paths automatically
SFBUG:1689830 - Error when using Wix3 when not installed on C drive

Benxing: Handle Sequence tables when building the patch.
Don't allow empty patch.

HeathS: Added an extension for installing PowerShell snap-ins.

PMarcu: Adding Melt as a tool to decompile MSM's to ComponentGroups.

PMarcu: Adding warning for when a non keypath file is updated and the keypath file
of that component is not.

Benxing: Adding information into _SummaryInformation table for patch build.

PMarcu: Adding a check to assure no duplicate fragment Id's exist.

JKuhne: Fixing a GC issue with the Validator. (Locals are rooted until last reference, not
end of scope.)

BobArnso: Add DiskId attribute to Directory and DirectoryRef to provide default
DiskId for contained components and files.

MikeHo: Fix language matching in Setup.exe

PMarcu: Making sdut and tsa defaults when passing xo to light.exe

AaronSte: Adding more CSIDL values to WixQueryOsDirs custom action

RobMen: Reverse integrate WiX v2 CustomAction fixes.

BobArnso: Add element-extensibility points to Directory and DirectoryRef.

Jordanf: Add a new test for preprocessor .

Mikeho: Add NewFolder UIText element.

AaronSte: Adding custom actions to run devenv.exe /InstallVSTemplates to the
WixVSExtension

BobArnso: Pass directory ID to Directory and DirectoryRef extension elements.

RobMen: Introducing smart-cabbing.

RobMen: SFBUG:1707259 - fix nasty memory violation
HeathS: Added patch-specific property to identify client patches and
if they can be removed.

Mikeho: Fix manifests for setupbld.exe/setup.exe

JordanF: Add the -update option to automatically update a test. Make MSI/MSI
validation explicit in the tests.

JRock: Adding back project references to Votive V3! Actually, I'm adding them
to the wix.targets MSBuild file to be exact. Votive uses it, but you get
the goodness without using Votive also. Basically, this is the feature
where if you reference other projects in your Visual Studio solution,
you can reference the output of those projects from within your wixproj
project. For example, $(var.MyCSharpApp.TargetPath). This will work for
any managed project in Visual Studio (at least it does for VC#, VB, and
VC++ managed). You have to build from within Visual Studio or from the
command line. If you build just the .wixproj, then you won't get the
project variables defined.

SFBUG:1585281 - Add solution and project variables back to Votive v3

MikeHo: Fix support for more than 10 MSIs/MSTs

JRock: SFBUG:1588291 - Support response files for MSBuild candle/light/lit
tasks

BobArnso: Have heat generate a default ComponentGroup when harvesting
directories in a fragment.

JRock: SFBUG:1717966 - Solution Build Issues (build 2911)
When a wixproj is the only thing in the solution, the SolutionX
variables aren't defined when building within Visual Studio. This
is because normally C#/VB define these variables for us. The fix
is to define them ourself.

HeathS: SFBUG:1716160 - ICE03 string overflow error, xmlFile

RobMen: SFBUG:1716160 - fix string overflow error for XmlConfig

BrianRe: Fixing wix.xsd to use W3C recognized regular expressions.

PMarcu: Defaulting Media\@Source to a form of the patchId if not specified
when Media is a child of a patch.

RobMen: SFBUG:1724535 - correctly integrate a few more fixes from WiX v2 to
WiX v3.

JordanF: WixUnit now compares the transforms inside a patch when it is diffing
two patches. Previously, only the tables in the patch were compared.

AaronSte: Added documentation for properties and custom actions in the
WixVSExtension.

PMarcu: Fix for ServiceConfig CA's to call correct rollback entrypoint.

BMurri: Add support for bound wixouts/wixmsts to torch and pyro.

PMarcu: Fix for ServiceConfig CA's to call correct rollback entrypoint.

RobMen: Schema tweaks to enable simple references on FeatureRef and
FeatureGroupRef plus tweaks to enable floating Components.
AaronSte: Added documentation for Votive functionality.

AaronSte: Fixing variable resolution problem in WiX Product item template
in Votive.

PMarcu: Updating flags in XmlConfig to match with CA after the 2.0 to
3.0 integration.

JRock: Integrated the VS SDK 4.0 into Votive.

AaronSte: Merged WiX 2.0 documentation changes into 3.0. Updated instances
of deprecated src attributes in examples in the docs.

MikeHo: Add reinstall support & logging to Chainer + fix bug when using
transforms other than Chinese.

HeathS: SFBUG:1739868 - Pyro does not find .AllowRemoval property

PMarcu: Removing primary key from EnsureTable to support patching.
Fixing documentation for XmlConfig.

RobMen: SFBUG:1739194 - Preserve whitespace when using XmlFile or XmlConfig

JKuhne: Fix a GC related bug in the cab enumeration callback. (Cab.WixEnumerateCab.Enumerate)


--- NEW FILE: SingleFileGeneratorFactory.cs ---
/***************************************************************************

Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

***************************************************************************/


namespace Microsoft.VisualStudio.Package
{
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
using System.Globalization;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.TextManager.Interop;
using Microsoft.Win32;

///
/// Provides implementation IVsSingleFileGeneratorFactory for
///
public class SingleFileGeneratorFactory : IVsSingleFileGeneratorFactory
{
#region nested types
private class GeneratorMetaData
{
#region fields
private Guid generatorClsid = Guid.Empty;
private int generatesDesignTimeSource = -1;
private int generatesSharedDesignTimeSource = -1;
private int useDesignTimeCompilationFlag = -1;
object generator = null;
#endregion

#region ctor
///
/// Constructor
///
public GeneratorMetaData()
{
}
#endregion

#region Public Properties
///
/// Generator instance
///
public Object Generator
{
get
{
return generator;
}
set
{
generator = value;
}
}

///
/// GeneratesDesignTimeSource reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
///
public int GeneratesDesignTimeSource
{
get
{
return generatesDesignTimeSource;
}
set
{
generatesDesignTimeSource = value;
}
}

///
/// GeneratesSharedDesignTimeSource reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
///
public int GeneratesSharedDesignTimeSource
{
get
{
return generatesSharedDesignTimeSource;
}
set
{
generatesSharedDesignTimeSource = value;
}
}

///
/// UseDesignTimeCompilationFlag reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
///
public int UseDesignTimeCompilationFlag
{
get
{
return useDesignTimeCompilationFlag;
}
set
{
useDesignTimeCompilationFlag = value;
}
}

///
/// Generator Class ID.
///
public Guid GeneratorClsid
{
get
{
return generatorClsid;
}
set
{
generatorClsid = value;
}
}
#endregion
}
#endregion

#region fields
///
/// Base generator registry key for MPF based project
///
private RegistryKey baseGeneratorRegistryKey = null;

///
/// CLSID reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
///
private string GeneratorClsid = "CLSID";

///
/// GeneratesDesignTimeSource reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
///
private string GeneratesDesignTimeSource = "GeneratesDesignTimeSource";

///
/// GeneratesSharedDesignTimeSource reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
///
private string GeneratesSharedDesignTimeSource = "GeneratesSharedDesignTimeSource";

///
/// UseDesignTimeCompilationFlag reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
///
private string UseDesignTimeCompilationFlag = "UseDesignTimeCompilationFlag";

///
/// Caches all the generators registered for the project type.
///
private Dictionary generatorsMap = new Dictionary();

///
/// The associated project guid.
///
private Guid projectGuid;

///
/// A service provider
///
private System.IServiceProvider serviceProvider;
#endregion

#region ctor
///
/// Overridden ctor.
///
/// The project type guid of the assoiciated project
/// An associated service provider.
public SingleFileGeneratorFactory(Guid projectGuid, System.IServiceProvider serviceProvider)
{
this.projectGuid = projectGuid;
this.serviceProvider = serviceProvider;
}

///
/// Default ctor.
///
public SingleFileGeneratorFactory()
{
}

#endregion

#region properties
///
/// Defines the project type guid of the associated project.
///
public Guid ProjectGuid
{
get { return this.projectGuid; }
set { this.projectGuid = value; }
}

///
/// Defines an associated service provider.
///
public System.IServiceProvider ServiceProvider
{
get { return this.serviceProvider; }
set { this.serviceProvider = value; }
}
#endregion
#region IVsSingleFileGeneratorFactory Helpers
///
/// Returns the project generator key under HKLM\SOFTWARE\Microsoft\VisualStudio\[version]\Generators
///
private RegistryKey BaseGeneratorsKey
{
get
{
if (this.baseGeneratorRegistryKey == null)
{
string regRoot;
ILocalRegistry2 pLocReg = this.LocalRegistry as ILocalRegistry2;
ErrorHandler.ThrowOnFailure(pLocReg.GetLocalRegistryRoot(out regRoot));
string regPath = Path.Combine(Path.Combine(regRoot, "Generators"), this.ProjectGuid.ToString("B"));
baseGeneratorRegistryKey = Registry.LocalMachine.OpenSubKey(regPath);
}

return this.baseGeneratorRegistryKey;
}
}

///
/// Returns the local registry instance
///
private ILocalRegistry LocalRegistry
{
get
{
return this.serviceProvider.GetService(typeof(SLocalRegistry)) as ILocalRegistry;
}
}
#endregion

#region IVsSingleFileGeneratorFactory Members
///
/// Creates an instance of the single file generator requested
///
/// prog id of the generator to be created. For e.g HKLM\SOFTWARE\Microsoft\VisualStudio\8.0Exp\Generators\[prjfacguid]\[wszProgId]
/// GeneratesDesignTimeSource key value
/// GeneratesSharedDesignTimeSource key value
/// UseDesignTimeCompilationFlag key value
/// IVsSingleFileGenerator interface
/// S_OK if succesful
public virtual int CreateGeneratorInstance(string progId, out int generatesDesignTimeSource, out int generatesSharedDesignTimeSource, out int useTempPEFlag, out IVsSingleFileGenerator generate)
{
Guid genGuid;
ErrorHandler.ThrowOnFailure(this.GetGeneratorInformation(progId, out generatesDesignTimeSource, out generatesSharedDesignTimeSource, out useTempPEFlag, out genGuid));

//Create the single file generator and pass it out. Check to see if it is in the cache
if (!this.generatorsMap.ContainsKey(progId) || ((this.generatorsMap[progId]).Generator == null))
{
Guid riid = VSConstants.IID_IUnknown;
uint dwClsCtx = (uint)CLSCTX.CLSCTX_INPROC_SERVER;
IntPtr genIUnknown = IntPtr.Zero;
//create a new one.
ErrorHandler.ThrowOnFailure(this.LocalRegistry.CreateInstance(genGuid, null, ref riid, dwClsCtx, out genIUnknown));
if (genIUnknown != IntPtr.Zero)
{
try
{
object generator = Marshal.GetObjectForIUnknown(genIUnknown);
//Build the generator meta data object and cache it.
GeneratorMetaData genData = new GeneratorMetaData();
genData.GeneratesDesignTimeSource = generatesDesignTimeSource;
genData.GeneratesSharedDesignTimeSource = generatesSharedDesignTimeSource;
genData.UseDesignTimeCompilationFlag = useTempPEFlag;
genData.GeneratorClsid = genGuid;
genData.Generator = generator;
this.generatorsMap[progId] = genData;
}
finally
{
Marshal.Release(genIUnknown);
}
}
}

generate = (this.generatorsMap[progId]).Generator as IVsSingleFileGenerator;

return VSConstants.S_OK;
}

///
/// Gets the default generator based on the file extension. HKLM\Software\Microsoft\VS\8.0\Generators\[prjfacguid]\.extension
///
/// File name with extension
/// The generator prog ID
/// S_OK if successful
public virtual int GetDefaultGenerator(string filename, out string progID)
{
progID = "";
return VSConstants.E_NOTIMPL;
}

///
/// Gets the generator information.
///
/// prog id of the generator to be created. For e.g HKLM\SOFTWARE\Microsoft\VisualStudio\8.0Exp\Generators\[prjfacguid]\[wszProgId]
/// GeneratesDesignTimeSource key value
/// GeneratesSharedDesignTimeSource key value
/// UseDesignTimeCompilationFlag key value
/// CLSID key value
/// S_OK if succesful
public virtual int GetGeneratorInformation(string progId, out int generatesDesignTimeSource, out int generatesSharedDesignTimeSource, out int useTempPEFlag, out Guid guidGenerator)
{
RegistryKey genKey;
generatesDesignTimeSource = -1;
generatesSharedDesignTimeSource = -1;
useTempPEFlag = -1;
guidGenerator = Guid.Empty;
if (string.IsNullOrEmpty(progId))
return VSConstants.S_FALSE;

//Create the single file generator and pass it out.
if (!this.generatorsMap.ContainsKey(progId))
{
// We have to check whether the BaseGeneratorkey returns null.
RegistryKey tempBaseGeneratorKey = this.BaseGeneratorsKey;
if (tempBaseGeneratorKey == null || (genKey = tempBaseGeneratorKey.OpenSubKey(progId)) == null)
{
return VSConstants.S_FALSE;
}

//Get the CLSID
string guid = (string)genKey.GetValue(GeneratorClsid, "");
if (string.IsNullOrEmpty(guid))
return VSConstants.S_FALSE;

GeneratorMetaData genData = new GeneratorMetaData();

genData.GeneratorClsid = guidGenerator = new Guid(guid);
//Get the GeneratesDesignTimeSource flag. Assume 0 if not present.
genData.GeneratesDesignTimeSource = generatesDesignTimeSource = (int)genKey.GetValue(this.GeneratesDesignTimeSource, 0);
//Get the GeneratesSharedDesignTimeSource flag. Assume 0 if not present.
genData.GeneratesSharedDesignTimeSource = generatesSharedDesignTimeSource = (int)genKey.GetValue(GeneratesSharedDesignTimeSource, 0);
//Get the UseDesignTimeCompilationFlag flag. Assume 0 if not present.
genData.UseDesignTimeCompilationFlag = useTempPEFlag = (int)genKey.GetValue(UseDesignTimeCompilationFlag, 0);
this.generatorsMap.Add(progId, genData);
}
else
{
GeneratorMetaData genData = this.generatorsMap[progId];
generatesDesignTimeSource = genData.GeneratesDesignTimeSource;
//Get the GeneratesSharedDesignTimeSource flag. Assume 0 if not present.
generatesSharedDesignTimeSource = genData.GeneratesSharedDesignTimeSource;
//Get the UseDesignTimeCompilationFlag flag. Assume 0 if not present.
useTempPEFlag = genData.UseDesignTimeCompilationFlag;
//Get the CLSID
guidGenerator = genData.GeneratorClsid;
}

return VSConstants.S_OK;
}
#endregion

}
}

Index: ProjectBase.files
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ProjectBase.files,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ProjectBase.files 4 Oct 2006 08:07:33 -0000 1.2
--- ProjectBase.files 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 269,272 ****
--- 269,277 ----
true

+
+ ProjectBase\ImageHandler.cs
+ true
+
+

ProjectBase\IAggregatedHierarchy.cs
***************
*** 341,344 ****
--- 346,353 ----
true

+
+ ProjectBase\ProjectNode.Events.cs
+ true
+

ProjectBase\ProjectOptions.cs
***************
*** 373,376 ****
--- 382,393 ----
true

+
+ ProjectBase\SingleFileGenerator.cs
+ true
+
+
+ ProjectBase\SingleFileGeneratorFactory.cs
+ true
+

ProjectBase\SolutionListener.cs

Index: DependentFileNode.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/DependentFileNode.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** DependentFileNode.cs 4 Oct 2006 08:07:33 -0000 1.2
--- DependentFileNode.cs 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 46,49 ****
--- 46,53 ----

#region Properties
+ public override int ImageIndex
+ {
+ get { return (int)ProjectNode.ImageName.DependentFile; }
+ }
#endregion

***************
*** 81,85 ****
public override object GetIconHandle(bool open)
{
! return PackageUtilities.GetIntPointerFromImage(this.ProjectMgr.ImageList.Images[(int)ProjectNode.ImageName.DependentFile]);;
}

--- 85,89 ----
public override object GetIconHandle(bool open)
{
! return this.ProjectMgr.ImageHandler.GetIconHandle(this.ImageIndex);
}


Index: FileDocumentManager.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/FileDocumentManager.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** FileDocumentManager.cs 20 Sep 2006 10:43:20 -0000 1.1
--- FileDocumentManager.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 196,200 ****

// Bail since we are not able to open the item
! return VSConstants.E_FAIL;
}

--- 196,202 ----

// Bail since we are not able to open the item
! // Do not return an error code otherwise an internal error message is shown. The scenario for this operation
! // normally is already a reaction to a dialog box telling that the item has been removed.
! return VSConstants.S_FALSE;
}


Index: ConfigurationProperties.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ConfigurationProperties.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ConfigurationProperties.cs 20 Sep 2006 10:43:19 -0000 1.1
--- ConfigurationProperties.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 25,31 ****
{
///
! /// Defines the config dependent properties expoed through automation
///
[ComVisible(true)]
public interface IProjectConfigProperties
{
--- 25,32 ----
{
///
! /// Defines the config dependent properties exposed through automation
///
[ComVisible(true)]
+ [Guid("21f73a8f-91d7-4085-9d4f-c48ee235ee5b")]
public interface IProjectConfigProperties
{
***************
*** 38,42 ****
[CLSCompliant(false), ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
! public class ProjectConfigProperties : IProjectConfigProperties
{
#region fields
--- 39,43 ----
[CLSCompliant(false), ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
! public class ProjectConfigProperties : IProjectConfigProperties
{
#region fields

Index: FileNode.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/FileNode.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FileNode.cs 4 Oct 2006 08:07:33 -0000 1.2
--- FileNode.cs 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 33,45 ****
[CLSCompliant(false)]
[ComVisible(true)]
! public class FileNode : HierarchyNode, IVsGeneratorProgress
! {
! #region fields
! private bool gettingCheckoutStatus = false;
! private bool runningGenerator = false;
! #endregion

! #region overriden Properties
! ///
/// overwrites of the generic hierarchyitem.
///
--- 33,44 ----
[CLSCompliant(false)]
[ComVisible(true)]
! public class FileNode : HierarchyNode
! {
! #region static fiels
! private static Dictionary extensionIcons;
! #endregion

! #region overriden Properties
! ///
/// overwrites of the generic hierarchyitem.
///
***************
*** 60,63 ****
--- 59,79 ----
}
}
+ public override int ImageIndex
+ {
+ get
+ {
+ //Check for known extensions
+ int imageIndex;
+ string extension = System.IO.Path.GetExtension(this.FileName);
+ if ((string.IsNullOrEmpty(extension)) || (!extensionIcons.TryGetValue(extension, out imageIndex)))
+ {
+ // Missing or unknown extension; let the base class handle this case.
+ return base.ImageIndex;
+ }
+ // The file type is known and there is an image for it in the image list.
+ return imageIndex;
+ }
+ }
+
public override Guid ItemTypeGuid
{
***************
*** 98,101 ****
--- 114,160 ----

#region ctor
+ static FileNode()
+ {
+ // Build the dictionary with the mapping between some well known extensions
+ // and the index of the icons inside the standard image list.
+ extensionIcons = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ extensionIcons.Add(".aspx", (int)ProjectNode.ImageName.WebForm);
+ extensionIcons.Add(".asax", (int)ProjectNode.ImageName.GlobalApplicationClass);
+ extensionIcons.Add(".asmx", (int)ProjectNode.ImageName.WebService);
+ extensionIcons.Add(".ascx", (int)ProjectNode.ImageName.WebUserControl);
+ extensionIcons.Add(".asp", (int)ProjectNode.ImageName.ASPPage);
+ extensionIcons.Add(".config", (int)ProjectNode.ImageName.WebConfig);
+ extensionIcons.Add(".htm", (int)ProjectNode.ImageName.HTMLPage);
+ extensionIcons.Add(".html", (int)ProjectNode.ImageName.HTMLPage);
+ extensionIcons.Add(".css", (int)ProjectNode.ImageName.StyleSheet);
+ extensionIcons.Add(".xsl", (int)ProjectNode.ImageName.StyleSheet);
+ extensionIcons.Add(".vbs", (int)ProjectNode.ImageName.ScriptFile);
+ extensionIcons.Add(".js", (int)ProjectNode.ImageName.ScriptFile);
+ extensionIcons.Add(".wsf", (int)ProjectNode.ImageName.ScriptFile);
+ extensionIcons.Add(".txt", (int)ProjectNode.ImageName.TextFile);
+ extensionIcons.Add(".resx", (int)ProjectNode.ImageName.Resources);
+ extensionIcons.Add(".rc", (int)ProjectNode.ImageName.Resources);
+ extensionIcons.Add(".bmp", (int)ProjectNode.ImageName.Bitmap);
+ extensionIcons.Add(".ico", (int)ProjectNode.ImageName.Icon);
+ extensionIcons.Add(".gif", (int)ProjectNode.ImageName.Image);
+ extensionIcons.Add(".jpg", (int)ProjectNode.ImageName.Image);
+ extensionIcons.Add(".png", (int)ProjectNode.ImageName.Image);
+ extensionIcons.Add(".map", (int)ProjectNode.ImageName.ImageMap);
+ extensionIcons.Add(".wav", (int)ProjectNode.ImageName.Audio);
+ extensionIcons.Add(".mid", (int)ProjectNode.ImageName.Audio);
+ extensionIcons.Add(".midi", (int)ProjectNode.ImageName.Audio);
+ extensionIcons.Add(".avi", (int)ProjectNode.ImageName.Video);
+ extensionIcons.Add(".mov", (int)ProjectNode.ImageName.Video);
+ extensionIcons.Add(".mpg", (int)ProjectNode.ImageName.Video);
+ extensionIcons.Add(".mpeg", (int)ProjectNode.ImageName.Video);
+ extensionIcons.Add(".cab", (int)ProjectNode.ImageName.CAB);
+ extensionIcons.Add(".jar", (int)ProjectNode.ImageName.JAR);
+ extensionIcons.Add(".xslt", (int)ProjectNode.ImageName.XSLTFile);
+ extensionIcons.Add(".xsd", (int)ProjectNode.ImageName.XMLSchema);
+ extensionIcons.Add(".xml", (int)ProjectNode.ImageName.XMLFile);
+ extensionIcons.Add(".pfx", (int)ProjectNode.ImageName.PFX);
+ extensionIcons.Add(".snk", (int)ProjectNode.ImageName.SNK);
+ }
+
///
/// Constructor for the FileNode
***************
*** 116,184 ****
protected override NodeProperties CreatePropertiesObject()
{
! return new FileNodeProperties(this);
}

public override object GetIconHandle(bool open)
{
! //Check for known extensions
! int imageIndex = -1;
!
! string filename = this.FileName.ToLower();
! int periodIndex = filename.LastIndexOf('.');
! string extension = filename.Substring(periodIndex + 1, filename.Length - periodIndex - 1);
!
! if (extension.Equals("aspx"))
! imageIndex = (int)ProjectNode.ImageName.WebForm;
! if (extension.Equals("asax"))
! imageIndex = (int)ProjectNode.ImageName.GlobalApplicationClass;
! if (extension.Equals("asmx"))
! imageIndex = (int)ProjectNode.ImageName.WebService;
! if (extension.Equals("ascx"))
! imageIndex = (int)ProjectNode.ImageName.WebUserControl;
! if (extension.Equals("asp"))
! imageIndex = (int)ProjectNode.ImageName.ASPPage;
! if (extension.Equals("config"))
! imageIndex = (int)ProjectNode.ImageName.WebConfig;
! if (extension.Equals("htm") || extension.Equals("html"))
! imageIndex = (int)ProjectNode.ImageName.HTMLPage;
! if (extension.Equals("css") || extension.Equals("xsl"))
! imageIndex = (int)ProjectNode.ImageName.StyleSheet;
! if (extension.Equals("vbs") || extension.Equals("js") || extension.Equals("wsf"))
! imageIndex = (int)ProjectNode.ImageName.ScriptFile;
! if (extension.Equals("txt"))
! imageIndex = (int)ProjectNode.ImageName.TextFile;
! if (extension.Equals("resx") || extension.Equals("rc"))
! imageIndex = (int)ProjectNode.ImageName.Resources;
! if (extension.Equals("bmp"))
! imageIndex = (int)ProjectNode.ImageName.Bitmap;
! if (extension.Equals("ico"))
! imageIndex = (int)ProjectNode.ImageName.Icon;
! if (extension.Equals("gif") || extension.Equals("jpg") || extension.Equals("png"))
! imageIndex = (int)ProjectNode.ImageName.Image;
! if (extension.Equals("map"))
! imageIndex = (int)ProjectNode.ImageName.ImageMap;
! if (extension.Equals("wav") || extension.Equals("mid") || extension.Equals("midi"))
! imageIndex = (int)ProjectNode.ImageName.Audio;
! if (extension.Equals("avi") || extension.Equals("mov") || extension.Equals("mpg") || extension.Equals("mpeg"))
! imageIndex = (int)ProjectNode.ImageName.Video;
! if (extension.Equals("cab"))
! imageIndex = (int)ProjectNode.ImageName.CAB;
! if (extension.Equals("jar"))
! imageIndex = (int)ProjectNode.ImageName.JAR;
! if (extension.Equals("xslt"))
! imageIndex = (int)ProjectNode.ImageName.XSLTFile;
! if (extension.Equals("xsd"))
! imageIndex = (int)ProjectNode.ImageName.XMLSchema;
! if (extension.Equals("xml"))
! imageIndex = (int)ProjectNode.ImageName.XMLFile;
! if (extension.Equals("pfx"))
! imageIndex = (int)ProjectNode.ImageName.PFX;
! if (extension.Equals("snk"))
! imageIndex = (int)ProjectNode.ImageName.SNK;
!
! if(imageIndex >= 0)
! return PackageUtilities.GetIntPointerFromImage(this.ProjectMgr.ImageList.Images[imageIndex]); ;
!
! return base.GetIconHandle(open);
}

--- 175,193 ----
protected override NodeProperties CreatePropertiesObject()
{
! ISingleFileGenerator generator = this.CreateSingleFileGenerator();
!
! return generator == null ? new FileNodeProperties(this) : new SingleFileGeneratorNodeProperties(this);
}

public override object GetIconHandle(bool open)
{
! int index = this.ImageIndex;
! if (NoImage == index)
! {
! // There is no image for this file; let the base class handle this case.
! return base.GetIconHandle(open);
! }
! // Return the handle for the image.
! return this.ProjectMgr.ImageHandler.GetIconHandle(index);
}

***************
*** 449,453 ****
try
{
! RunGenerator(((FileNodeProperties)this.NodeProperties).FullPath);
return VSConstants.S_OK;
}
--- 458,462 ----
try
{
! this.RunGenerator();
return VSConstants.S_OK;
}
***************
*** 495,499 ****
if ((VsCommands2K)cmd == VsCommands2K.RUNCUSTOMTOOL)
{
! if (string.IsNullOrEmpty(this.ItemNode.GetMetadata(ProjectFileConstants.DependentUpon)))
{
result |= QueryStatusResult.SUPPORTED | QueryStatusResult.ENABLED;
--- 504,508 ----
if ((VsCommands2K)cmd == VsCommands2K.RUNCUSTOMTOOL)
{
! if (string.IsNullOrEmpty(this.ItemNode.GetMetadata(ProjectFileConstants.DependentUpon)) && (this.NodeProperties is SingleFileGeneratorNodeProperties))
{
result |= QueryStatusResult.SUPPORTED | QueryStatusResult.ENABLED;
***************
*** 817,820 ****
--- 826,838 ----
File.Move(oldName, newName);
}
+
+ ///
+ /// factory method for creating single file generators.
+ ///
+ ///
+ protected virtual ISingleFileGenerator CreateSingleFileGenerator()
+ {
+ return new SingleFileGenerator(this.ProjectMgr);
+ }
#endregion

***************
*** 953,1236 ****
#region SingleFileGenerator Support methods
///
- /// Invokes the specified generator
- ///
- /// Generator prog id
- /// Namespace to generate the code under.
- public virtual void InvokeGenerator(string customToolProgID, string customToolNamespace)
- {
- try
- {
- if (!runningGenerator)
- {
- runningGenerator = true;
- //Get the generator
- IVsSingleFileGenerator generator;
- int generateDesignTimeSource;
- int generateSharedDesignTimeSource;
- int generateTempPE;
- ErrorHandler.ThrowOnFailure(this.ProjectMgr.CreateGeneratorInstance(customToolProgID, out generateDesignTimeSource, out generateSharedDesignTimeSource, out generateTempPE, out generator));
-
- //Check to see if the generator supports siting
- IObjectWithSite objWithSite = generator as IObjectWithSite;
- if (objWithSite != null)
- {
- objWithSite.SetSite(this.OleServiceProvider);
- }
-
- //Determine the namespace
- if (string.IsNullOrEmpty(customToolNamespace))
- {
- customToolNamespace = ComputeNamespace();
- }
-
- //Run the generator
- IntPtr[] output = new IntPtr[1];
- output[0] = IntPtr.Zero;
- uint outPutSize;
- string extension;
- ErrorHandler.ThrowOnFailure(generator.DefaultExtension(out extension));
-
- //Find if any dependent node exists
- string dependentNodeName = Path.GetFileNameWithoutExtension(this.FileName) + extension;
- HierarchyNode dependentNode = this.FirstChild;
- while (dependentNode != null)
- {
- if (string.Compare(dependentNode.ItemNode.GetMetadata(ProjectFileConstants.DependentUpon), this.FileName, StringComparison.OrdinalIgnoreCase) == 0)
- {
- dependentNodeName = ((FileNode)dependentNode).FileName;
- break;
- }
- dependentNode = dependentNode.NextSibling;
- }
-
- //If you found a dependent node.
- if (dependentNode != null)
- {
- //Then check out the node and dependent node from SCC
- if (!CanEditFile(dependentNode.GetMkDocument()))
- throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
- }
- else //It is a new node to be added to the project
- {
- // Check out the project file if necessary.
- if (!this.ProjectMgr.QueryEditProjectFile(false))
- {
- throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
- }
- }
- //Get the buffer contents for the current node
- IVsTextStream stream;
- string inputFileContents = GetBufferContents(this.GetMkDocument(), out stream);
-
- ErrorHandler.ThrowOnFailure(generator.Generate(this.GetMkDocument(), inputFileContents, customToolNamespace, output, out outPutSize, this));
- byte[] data = new byte[outPutSize];
-
- if (output[0] != IntPtr.Zero)
- {
- Marshal.Copy(output[0], data, 0, (int)outPutSize);
- Marshal.FreeCoTaskMem(output[0]);
- }
-
- //Todo - Create a file and add it to the Project
- string fileToAdd = UpdateGeneratedCodeFile(data, (int)outPutSize, dependentNodeName);
- }
- }
- finally
- {
- runningGenerator = false;
- }
- }
-
- ///
- /// Computes the names space based on the folder for the ProjectItem. It just replaces DirectorySeparatorCharacter
- /// with "." for the directory in which the file is located.
- ///
- /// Returns the computed name space
- protected virtual string ComputeNamespace()
- {
- string nspace = "";
- string filePath = Path.GetDirectoryName(this.GetMkDocument());
- string[] toks = filePath.Split(new char[] { ':', '\\' });
- foreach (string tok in toks)
- {
- if (tok != "")
- {
- string temp = tok.Replace(" ", "");
- nspace += (temp + ".");
- }
- }
- nspace = nspace.Remove(nspace.LastIndexOf("."), 1);
- return nspace;
- }
-
- ///
- /// Returns the buffer contents for the current node.
- ///
- /// Buffer contents
- private string GetBufferContents(string fileName, out IVsTextStream srpStream)
- {
- Guid CLSID_VsTextBuffer = new Guid("{8E7B96A8-E33D-11d0-A6D5-00C04FB67F6A}");
- string bufferContents = "";
- srpStream = null;
-
- IVsRunningDocumentTable rdt = this.ProjectMgr.GetService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable;
- if (rdt != null)
- {
- IVsHierarchy hier;
- IVsPersistDocData persistDocData;
- uint itemid, cookie;
- bool docInRdt = true;
- IntPtr docData;
- //Getting a read lock on the document. Must be released later.
- int hr = rdt.FindAndLockDocument((uint)_VSRDTFLAGS.RDT_ReadLock, fileName, out hier, out itemid, out docData, out cookie);
- if (ErrorHandler.Failed(hr) || docData == IntPtr.Zero)
- {
- Guid iid = VSConstants.IID_IUnknown;
- cookie = 0;
- docInRdt = false;
- ILocalRegistry localReg = this.ProjectMgr.GetService(typeof(SLocalRegistry)) as ILocalRegistry;
- ErrorHandler.ThrowOnFailure(localReg.CreateInstance(CLSID_VsTextBuffer, null, ref iid, (uint)CLSCTX.CLSCTX_INPROC_SERVER, out docData));
- }
-
- persistDocData = Marshal.GetObjectForIUnknown(docData) as IVsPersistDocData;
- //Release
- if (docData != IntPtr.Zero)
- Marshal.Release(docData);
-
- //Try to get the Text lines
- IVsTextLines srpTextLines = persistDocData as IVsTextLines;
- if (srpTextLines == null)
- {
- // Try getting a text buffer provider first
- IVsTextBufferProvider srpTextBufferProvider = persistDocData as IVsTextBufferProvider;
- if (srpTextBufferProvider != null)
- {
- hr = srpTextBufferProvider.GetTextBuffer(out srpTextLines);
- }
- }
-
- if (ErrorHandler.Succeeded(hr))
- {
- srpStream = srpTextLines as IVsTextStream;
- if (srpStream != null)
- {
- // QI for IVsBatchUpdate and call FlushPendingUpdates if they support it
- IVsBatchUpdate srpBatchUpdate = srpStream as IVsBatchUpdate;
- if (srpBatchUpdate != null)
- srpBatchUpdate.FlushPendingUpdates(0);
-
- int lBufferSize = 0;
- hr = srpStream.GetSize(out lBufferSize);
-
- if (ErrorHandler.Succeeded(hr))
- {
- IntPtr dest = IntPtr.Zero;
- try
- {
- // Note that GetStream returns Unicode to us so we don't need to do any conversions
- dest = Marshal.AllocCoTaskMem((lBufferSize + 1) * 2);
- ErrorHandler.ThrowOnFailure(srpStream.GetStream(0, lBufferSize, dest));
- //Get the contents
- bufferContents = Marshal.PtrToStringUni(dest);
- }
- finally
- {
- if (dest != IntPtr.Zero)
- Marshal.FreeCoTaskMem(dest);
- }
- }
- }
-
- }
- // Unlock the document in the RDT if necessary
- if (docInRdt && rdt != null)
- {
- ErrorHandler.ThrowOnFailure(rdt.UnlockDocument((uint)(_VSRDTFLAGS.RDT_ReadLock | _VSRDTFLAGS.RDT_Unlock_NoSave), cookie));
- }
-
- if (ErrorHandler.Failed(hr))
- {
- // If this failed then it's probably not a text file. In that case,
- // we just read the file as a binary
- bufferContents = File.ReadAllText(fileName);
- }
-
-
- }
- return bufferContents;
- }
-
- ///
- /// Returns TRUE if open and dirty. Note that documents can be open without a
- /// window frame so be careful. Returns the DocData and doc cookie if requested
- ///
- /// document path
- /// hierarchy
- /// doc data associated with document
- /// item cookie
- /// True if FIle is dirty
- public bool VerifyFileDirtyInRdt(string document, out IVsHierarchy pHier, out IVsPersistDocData ppDocData, out uint cookie)
- {
- int ret = 0;
- pHier = null;
- ppDocData = null;
- cookie = 0;
-
- IVsRunningDocumentTable rdt = this.ProjectMgr.GetService(typeof(IVsRunningDocumentTable)) as IVsRunningDocumentTable;
- if (rdt != null)
- {
- IntPtr docData;
- uint dwCookie = 0;
- IVsHierarchy srpHier;
- uint itemid = VSConstants.VSITEMID_NIL;
-
- ErrorHandler.ThrowOnFailure(rdt.FindAndLockDocument((uint)_VSRDTFLAGS.RDT_NoLock, document, out srpHier, out itemid, out docData, out dwCookie));
- IVsPersistHierarchyItem srpIVsPersistHierarchyItem = srpHier as IVsPersistHierarchyItem;
- if (srpIVsPersistHierarchyItem != null)
- {
- // Found in the RDT. See if it is dirty
- ErrorHandler.ThrowOnFailure(srpIVsPersistHierarchyItem.IsItemDirty(itemid, docData, out ret));
- cookie = dwCookie;
- ppDocData = Marshal.GetObjectForIUnknown(docData) as IVsPersistDocData;
- Marshal.Release(docData);
- pHier = srpHier;
- }
- }
- return (ret == 1);
- }
-
- ///
- /// Runs the generator on the current project item.
- ///
- ///
- ///
- public virtual void RunGenerator(string document)
- {
- // Go run the generator on that node, but only if the file is dirty
- // in the running document table. Otherwise there is no need to rerun
- // the generator because if the original document is not dirty then
- // the generated output should be already up to date.
- uint itemid = VSConstants.VSITEMID_NIL;
- IVsHierarchy hier = (IVsHierarchy)this.ProjectMgr;
- if (document != null && hier != null && ErrorHandler.Succeeded(hier.ParseCanonicalName((string)document, out itemid)))
- {
- IVsHierarchy rdtHier;
- IVsPersistDocData perDocData;
- uint cookie;
- if (VerifyFileDirtyInRdt((string)document, out rdtHier, out perDocData, out cookie))
- {
- // Run the generator on the indicated document
- FileNode node = (FileNode)this.ProjectMgr.NodeFromItemId(itemid);
- string customTool = ((FileNodeProperties)(node.NodeProperties)).CustomTool;
- if (!string.IsNullOrEmpty(customTool))
- {
- string customToolNamespace = ((FileNodeProperties)(node.NodeProperties)).CustomToolNamespace;
- node.InvokeGenerator(customTool, customToolNamespace);
- }
- }
- }
- }
-
- ///
/// Event handler for the Custom tool property changes
///
--- 971,974 ----
***************
*** 1239,1243 ****
internal virtual void OnCustomToolChanged(object sender, HierarchyNodeEventArgs e)
{
! RunGenerator(((FileNodeProperties)this.NodeProperties).FullPath);
}

--- 977,981 ----
internal virtual void OnCustomToolChanged(object sender, HierarchyNodeEventArgs e)
{
! this.RunGenerator();
}

***************
*** 1249,1391 ****
internal virtual void OnCustomToolNameSpaceChanged(object sender, HierarchyNodeEventArgs e)
{
! RunGenerator(((FileNodeProperties)this.NodeProperties).FullPath);
! }
!
! ///
! /// This is called after the single file generator has been invoked to create or update the code file.
! ///
! /// data to update the file with
! /// full path of the file
! ///
! /// This is called after the single file generator has been invoked to create or update the code file.
! ///
! /// data to update the file with
! /// size of the data
! /// Name of the file to update or create
! /// full path of the file
! protected string UpdateGeneratedCodeFile(byte[] data, int size, string fileName)
! {
! string filePath = Path.Combine(Path.GetDirectoryName(this.GetMkDocument()), fileName);
! IVsRunningDocumentTable rdt = this.ProjectMgr.GetService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable;
!
! // (kberes) Shouldn't this be an InvalidOperationException instead with some not to annoying errormessage to the user?
! if (rdt == null)
! {
! ErrorHandler.ThrowOnFailure(VSConstants.E_FAIL);
! }
!
! IVsHierarchy hier;
! uint cookie;
! uint itemid;
! IntPtr docData = IntPtr.Zero;
! ErrorHandler.ThrowOnFailure(rdt.FindAndLockDocument((uint)(_VSRDTFLAGS.RDT_NoLock), filePath, out hier, out itemid, out docData, out cookie));
! if (docData != IntPtr.Zero)
! {
! Marshal.Release(docData);
! IVsTextStream srpStream;
! string inputFileContents = GetBufferContents(filePath, out srpStream);
! if (srpStream != null)
! {
! int oldLen = 0;
! int hr = srpStream.GetSize(out oldLen);
! if (ErrorHandler.Succeeded(hr))
! {
! IntPtr dest = IntPtr.Zero;
! try
! {
! dest = Marshal.AllocCoTaskMem(data.Length);
! Marshal.Copy(data, 0, dest, data.Length);
! ErrorHandler.ThrowOnFailure(srpStream.ReplaceStream(0, oldLen, dest, size / 2));
! }
! finally
! {
! if (dest != IntPtr.Zero)
! {
! Marshal.Release(dest);
! }
! }
! }
! }
! }
! else
! {
! using (FileStream generatedFileStream = File.Open(filePath, FileMode.OpenOrCreate))
! {
! generatedFileStream.Write(data, 0, size);
! }
!
! EnvDTE.ProjectItem projectItem = this.GetAutomationObject() as EnvDTE.ProjectItem;
! if (projectItem != null && (this.ProjectMgr.FindChild(this.FileName) == null))
! {
! projectItem.ProjectItems.AddFromFile(filePath);
! }
! }
! return filePath;
! }
! #endregion
!
! #region IVsGeneratorProgress Members
!
! public virtual int GeneratorError(int warning, uint level, string err, uint line, uint col)
! {
! return VSConstants.E_NOTIMPL;
! }
!
! public virtual int Progress(uint complete, uint total)
! {
! return VSConstants.E_NOTIMPL;
}

#endregion

! #region QueryEditQuerySave helpers
///
! /// This function asks to the QueryEditQuerySave service if it is possible to
! /// edit the file.
///
! private bool CanEditFile(string documentMoniker)
{
! Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "\t**** CanEditFile called ****"));
!
! // Check the status of the recursion guard
! if (gettingCheckoutStatus)
! return false;
!
! try
! {
! // Set the recursion guard
! gettingCheckoutStatus = true;
!
! // Get the QueryEditQuerySave service
! IVsQueryEditQuerySave2 queryEditQuerySave = (IVsQueryEditQuerySave2)GetService(typeof(SVsQueryEditQuerySave));
!
! // Now call the QueryEdit method to find the edit status of this file
! string[] documents = { documentMoniker };
! uint result;
! uint outFlags;
!
! // Note that this function can popup a dialog to ask the user to checkout the file.
! // When this dialog is visible, it is possible to receive other request to change
! // the file and this is the reason for the recursion guard.
! int hr = queryEditQuerySave.QueryEditFiles(
! 0, // Flags
! 1, // Number of elements in the array
! documents, // Files to edit
! null, // Input flags
! null, // Input array of VSQEQS_FILE_ATTRIBUTE_DATA
! out result, // result of the checkout
! out outFlags // Additional flags
! );
! if (ErrorHandler.Succeeded(hr) && (result == (uint)tagVSQueryEditResult.QER_EditOK))
! {
! // In this case (and only in this case) we can return true from this function.
! return true;
! }
! }
! finally
{
! gettingCheckoutStatus = false;
}
- return false;
}

--- 987,1006 ----
internal virtual void OnCustomToolNameSpaceChanged(object sender, HierarchyNodeEventArgs e)
{
! this.RunGenerator();
}

#endregion

! #region helpers
///
! /// Runs a generator.
///
! internal void RunGenerator()
{
! ISingleFileGenerator generator = this.CreateSingleFileGenerator();
! if (generator != null)
{
! generator.RunGenerator(this.Url);
}
}

***************
*** 1412,1416 ****
}
return childNodes;
! }
#endregion
}
--- 1027,1031 ----
}
return childNodes;
! }
#endregion
}

Index: NestedProjectNode.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/NestedProjectNode.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NestedProjectNode.cs 4 Oct 2006 08:07:33 -0000 1.2
--- NestedProjectNode.cs 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 48,52 ****
private string projectPath = String.Empty;

! private ImageList nestedHierarchyImageList;

///
--- 48,52 ----
private string projectPath = String.Empty;

! private ImageHandler imageHandler;

///
***************
*** 295,322 ****
Debug.Assert(this.nestedHierarchy != null, "The nested hierarchy object must be created before calling this method");

! object iconHandle = null;
! this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconHandle, out iconHandle);
! if (iconHandle == null)
! {
! // Try to get an icon from the nested hierrachy image list.
! if (this.nestedHierarchyImageList != null)
! {
! object imageIndexAsObject = null;
! if (this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconIndex, out imageIndexAsObject) == VSConstants.S_OK &&
! imageIndexAsObject != null)
! {
! int imageIndex = (int)imageIndexAsObject;
! if (imageIndex < this.nestedHierarchyImageList.Images.Count)
! {
! iconHandle = (int)PackageUtilities.GetIntPointerFromImage(this.nestedHierarchyImageList.Images[imageIndex]);
! }
! }
! }

! if (iconHandle == null)
! {
! iconHandle = (int)PackageUtilities.GetIntPointerFromImage(this.ProjectMgr.ImageList.Images[(int)ProjectNode.ImageName.Application]);
! }
! }

return iconHandle;
--- 295,326 ----
Debug.Assert(this.nestedHierarchy != null, "The nested hierarchy object must be created before calling this method");

! object iconHandle = null;
! this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconHandle, out iconHandle);
! if (iconHandle == null)
! {
! if (null == imageHandler)
! {
! InitImageHandler();
! }
! // Try to get an icon from the nested hierrachy image list.
! if (imageHandler.ImageList != null)
! {
! object imageIndexAsObject = null;
! if (this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconIndex, out imageIndexAsObject) == VSConstants.S_OK &&
! imageIndexAsObject != null)
! {
! int imageIndex = (int)imageIndexAsObject;
! if (imageIndex < imageHandler.ImageList.Images.Count)
! {
! iconHandle = imageHandler.GetIconHandle(imageIndex);
! }
! }
! }

! if (null == iconHandle)
! {
! iconHandle = this.ProjectMgr.ImageHandler.GetIconHandle((int)ProjectNode.ImageName.Application);
! }
! }

return iconHandle;
***************
*** 602,607 ****
this.LockRDTEntry();

- this.InitImageList();
-
}

--- 606,609 ----
***************
*** 651,655 ****
{
this.StopObservingNestedProjectFile();
! this.nestedHierarchyImageList.Dispose();
}

--- 653,657 ----
{
this.StopObservingNestedProjectFile();
! this.imageHandler.Close();
}

***************
*** 885,897 ****
}

! private void InitImageList()
{
Debug.Assert(this.nestedHierarchy != null, "The nested hierarchy object must be created before calling this method");

object imageListAsPointer = null;
this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconImgList, out imageListAsPointer);
if (imageListAsPointer != null)
{
! this.nestedHierarchyImageList = Utilities.GetImageList(imageListAsPointer);
}
}
--- 887,903 ----
}

! private void InitImageHandler()
{
Debug.Assert(this.nestedHierarchy != null, "The nested hierarchy object must be created before calling this method");

+ if (null == imageHandler)
+ {
+ imageHandler = new ImageHandler();
+ }
object imageListAsPointer = null;
this.nestedHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_IconImgList, out imageListAsPointer);
if (imageListAsPointer != null)
{
! this.imageHandler.ImageList = Utilities.GetImageList(imageListAsPointer);
}
}

Index: Output.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/Output.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Output.cs 20 Sep 2006 10:43:20 -0000 1.1
--- Output.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 73,78 ****
public virtual int get_DeploySourceURL(out string pbstrDeploySourceURL)
{
! string path;
! ErrorHandler.ThrowOnFailure(this.get_CanonicalName(out path));
if (path.Length < 9 || String.Compare(path.Substring(0, 8), "file:///", StringComparison.OrdinalIgnoreCase) != 0)
path = "file:///" + path;
--- 73,81 ----
public virtual int get_DeploySourceURL(out string pbstrDeploySourceURL)
{
! string path = output.GetEvaluatedMetadata(ProjectFileConstants.FinalOutputPath);
! if (string.IsNullOrEmpty(path))
! {
! throw new InvalidOperationException();
! }
if (path.Length < 9 || String.Compare(path.Substring(0, 8), "file:///", StringComparison.OrdinalIgnoreCase) != 0)
path = "file:///" + path;

--- NEW FILE: ImageHandler.cs ---
/***************************************************************************

Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

***************************************************************************/

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Windows.Forms;

namespace Microsoft.VisualStudio.Package
{
public class ImageHandler
{
private ImageList imageList;
private List iconHandles;

///
/// Builds an empty ImageHandler object.
///
public ImageHandler()
{
this.imageList = null;
this.iconHandles = null;
}

///
/// Builds an ImageHandler object from a Stream providing the bitmap that
/// stores the images for the image list.
///
public ImageHandler(Stream resourceStream)
{
if (null == resourceStream)
{
throw new ArgumentNullException("resourceStream");
}
imageList = Utilities.GetImageList(resourceStream);
}

///
/// Builds an ImageHandler object from an ImageList object.
///
public ImageHandler(ImageList list)
{
if (null == list)
{
throw new ArgumentNullException("imageList");
}
imageList = list;
}

///
/// Closes the ImageHandler object freeing its resources.
///
public void Close()
{
if (null != iconHandles)
{
foreach (IntPtr hnd in iconHandles)
{
if (hnd != IntPtr.Zero)
{
NativeMethods.DestroyIcon(hnd);
}
}
iconHandles = null;
}

if (null != imageList)
{
imageList.Dispose();
imageList = null;
}
}

///
/// Add an image to the ImageHandler.
///
public void AddImage(Image img)
{
if (null == img)
{
throw new ArgumentNullException("img");
}
if (null == imageList)
{
imageList = new ImageList();
}
imageList.Images.Add(img);
if (null != iconHandles)
{
iconHandles.Add(IntPtr.Zero);
}
}

///
/// Get or set the ImageList object for this ImageHandler.
///
public ImageList ImageList
{
get { return imageList; }
set
{
Close();
imageList = value;
}
}

///
/// Returns the handle to an icon build from the image of index
/// iconIndex in the image list.
///
public IntPtr GetIconHandle(int iconIndex)
{
// Verify that the object is in a consistent state.
if ((null == imageList))
{
throw new InvalidOperationException();
}
// Make sure that the list of handles is initialized.
if (null == iconHandles)
{
InitHandlesList();
}

// Verify that the index is inside the expected range.
if ((iconIndex < 0) || (iconIndex >= iconHandles.Count))
{
throw new ArgumentOutOfRangeException("iconIndex");
}

// Check if the icon is in the cache.
if (IntPtr.Zero == iconHandles[iconIndex])
{
Bitmap bitmap = imageList.Images[iconIndex] as Bitmap;
// If the image is not a bitmap, then we can not build the icon,
// so we have to return a null handle.
if (null == bitmap)
{
return IntPtr.Zero;
}

iconHandles[iconIndex] = bitmap.GetHicon();
}

return iconHandles[iconIndex];
}

private void InitHandlesList()
{
iconHandles = new List(imageList.Images.Count);
for (int i = 0; i < imageList.Images.Count; ++i)
{
iconHandles.Add(IntPtr.Zero);
}
}
}
}

Index: OutputGroup.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/OutputGroup.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** OutputGroup.cs 20 Sep 2006 10:43:20 -0000 1.1
--- OutputGroup.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 95,99 ****

// Rebuild the content of our list of output
! string outputType = this.targetName + "Output";
this.outputs.Clear();
foreach (MSBuild.BuildItem assembly in project.BuildProject.GetEvaluatedItemsByName(outputType))
--- 95,99 ----

// Rebuild the content of our list of output
! string outputType = this.targetName + "KeyOutput";
this.outputs.Clear();
foreach (MSBuild.BuildItem assembly in project.BuildProject.GetEvaluatedItemsByName(outputType))
***************
*** 108,111 ****
--- 108,135 ----
project.SetCurrentConfiguration();

+ // Now that the group is built we have to check if it is invalidated by a property
+ // change on the project.
+ project.OnProjectPropertyChanged += new EventHandler(OnProjectPropertyChanged);
+ }
+
+ public virtual void InvalidateGroup()
+ {
+ // Set keyOutput to null so that a refresh will be performed the next time
+ // a property getter is called.
+ if (null != keyOutput)
+ {
+ // Once the group is invalidated there is no more reason to listen for events.
+ project.OnProjectPropertyChanged -= new EventHandler(OnProjectPropertyChanged);
+ }
+ keyOutput = null;
+ }
+ #endregion
+
+ #region event handlers
+ private void OnProjectPropertyChanged(object sender, ProjectPropertyChangedArgs args)
+ {
+ // In theory here we should decide if we have to invalidate the group according with the kind of property
+ // that is changed.
+ InvalidateGroup();
}
#endregion

Index: ProjectElement.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ProjectElement.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ProjectElement.cs 20 Sep 2006 10:43:20 -0000 1.1
--- ProjectElement.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 184,188 ****
}

!
///
/// Get the value of an attribute on a project element
--- 184,212 ----
}

! public string GetEvaluatedMetadata(string attributeName)
! {
! if (this.IsVirtual)
! {
! // For virtual items, use our virtual property collection
! if (!virtualProperties.ContainsKey(attributeName))
! {
! return String.Empty;
! }
! return virtualProperties[attributeName];
! }
!
! // cannot ask MSBuild for Include, so intercept it and return the corresponding property
! if (String.Compare(attributeName, ProjectFileConstants.Include, StringComparison.OrdinalIgnoreCase) == 0)
! return item.FinalItemSpec;
!
! // Build Action is the type, not a property, so intercept this one as well
! if (String.Compare(attributeName, ProjectFileConstants.BuildAction, StringComparison.OrdinalIgnoreCase) == 0)
! {
! return item.Name;
! }
!
! return item.GetEvaluatedMetadata(attributeName);
! }
!
///
/// Get the value of an attribute on a project element

Index: HierarchyNode.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/HierarchyNode.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** HierarchyNode.cs 4 Oct 2006 08:07:33 -0000 1.2
--- HierarchyNode.cs 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 674,680 ****

case __VSHPROPID.VSHPROPID_IconImgList:
! result = this.ProjectMgr.ImageList.Handle;
break;

case __VSHPROPID.VSHPROPID_IconIndex:
int index = this.ImageIndex;
--- 674,681 ----

case __VSHPROPID.VSHPROPID_IconImgList:
! result = this.ProjectMgr.ImageHandler.ImageList.Handle;
break;

+ case __VSHPROPID.VSHPROPID_OpenFolderIconIndex:
case __VSHPROPID.VSHPROPID_IconIndex:
int index = this.ImageIndex;

Index: Microsoft.VisualStudio.Package.Project.resx
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/Microsoft.VisualStudio.Package.Project.resx,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Microsoft.VisualStudio.Package.Project.resx 20 Sep 2006 10:43:20 -0000 1.1
--- Microsoft.VisualStudio.Package.Project.resx 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 475,477 ****
--- 475,480 ----
The nested project has failed to reload.

+
+ The item '{0}' cannot be found on disk, either because it has been renamed, deleted, or moved to a new location.
+

\ No newline at end of file

Index: ReferenceContainerNode.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ReferenceContainerNode.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ReferenceContainerNode.cs 4 Oct 2006 08:07:33 -0000 1.2
--- ReferenceContainerNode.cs 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 33,39 ****
[CLSCompliant(false), ComVisible(true)]
public class ReferenceContainerNode : HierarchyNode, IReferenceContainer
! {
! #region fields
! internal const string ReferencesNodeVirtualName = "References";
#endregion

--- 33,39 ----
[CLSCompliant(false), ComVisible(true)]
public class ReferenceContainerNode : HierarchyNode, IReferenceContainer
! {
! #region fields
! internal const string ReferencesNodeVirtualName = "References";
#endregion

***************
*** 135,140 ****
public override object GetIconHandle(bool open)
{
! return PackageUtilities.GetIntPointerFromImage(open ? this.ProjectMgr.ImageList.Images[(int)ProjectNode.ImageName.OpenReferenceFolder] : this.ProjectMgr.ImageList.Images[(int)ProjectNode.ImageName.ReferenceFolder]);
! }


--- 135,140 ----
public override object GetIconHandle(bool open)
{
! return this.ProjectMgr.ImageHandler.GetIconHandle(open ? (int)ProjectNode.ImageName.OpenReferenceFolder : (int)ProjectNode.ImageName.ReferenceFolder);
! }


***************
*** 243,252 ****
MSBuild.BuildItemGroup refererncesGroup = buildProject.GetEvaluatedItemsByName(referenceType);

! ReferenceNode node;
!
! bool isComReference = referenceType == ProjectFileConstants.COMReference;
! bool isAssemblyReference = referenceType == ProjectFileConstants.Reference;
! bool isProjectReference = referenceType == ProjectFileConstants.ProjectReference;
!
if (isAssemblyReference && this.ProjectMgr.Build(MsBuildTarget.ResolveAssemblyReferences) != MSBuildResult.Sucessful)
{
--- 243,247 ----
MSBuild.BuildItemGroup refererncesGroup = buildProject.GetEvaluatedItemsByName(referenceType);

! bool isAssemblyReference = referenceType == ProjectFileConstants.Reference;
if (isAssemblyReference && this.ProjectMgr.Build(MsBuildTarget.ResolveAssemblyReferences) != MSBuildResult.Sucessful)
{
***************
*** 257,281 ****
{
ProjectElement element = new ProjectElement(this.ProjectMgr, item, false);
! if (isComReference)
! {
! node = this.CreateComReferenceNode(element);
! }
! else if (isAssemblyReference)
! {
! node = this.CreateAssemblyReferenceNode(element);
! }
! else if (isProjectReference)
! {
! node = this.CreateProjectReferenceNode(element);
! }
! else
! {
! // JRock: Added support for other references
! node = this.CreateOtherReferenceNode(element);
! }

if (node != null)
{
! this.AddChild(node);
}
}
--- 252,278 ----
{
ProjectElement element = new ProjectElement(this.ProjectMgr, item, false);
!
! ReferenceNode node = CreateReferenceNode(referenceType, element);

if (node != null)
{
! // Make sure that we do not want to add the item twice to the ui hierarchy
! // We are using here the UI representation of the Node namely the Caption to find that out, in order to
! // avoid different representation problems.
! // Example :
! //
! bool found = false;
! for (HierarchyNode n = this.FirstChild; n != null && !found; n = n.NextSibling)
! {
! if (String.Compare(n.Caption, node.Caption, StringComparison.OrdinalIgnoreCase) == 0)
! {
! found = true;
! }
! }
!
! if (!found)
! {
! this.AddChild(node);
! }
}
}
***************
*** 293,312 ****
}

! ReferenceNode node = null;
! switch (selectorData.type)
! {
! case VSCOMPONENTTYPE.VSCOMPONENTTYPE_Project:
! node = this.CreateProjectReferenceNode(selectorData);
! break;
! case VSCOMPONENTTYPE.VSCOMPONENTTYPE_File:
! // This is the case for managed assembly
! case VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus:
! node = this.CreateFileComponent(selectorData);
! break;
! case VSCOMPONENTTYPE.VSCOMPONENTTYPE_Com2:
! node = this.CreateComReferenceNode(selectorData);
! break;
!
! }

if (node != null)
--- 290,294 ----
}

! ReferenceNode node = CreateReferenceNode(selectorData);

if (node != null)
***************
*** 327,332 ****
#endregion

! #region Helper functions to add references
! ///
/// Creates a project reference node given an existing project element.
///
--- 309,361 ----
#endregion

! #region virtual methods
! protected virtual ReferenceNode CreateReferenceNode(string referenceType, ProjectElement element)
! {
! ReferenceNode node = null;
! if (referenceType == ProjectFileConstants.COMReference)
! {
! node = this.CreateComReferenceNode(element);
! }
! else if (referenceType == ProjectFileConstants.Reference)
! {
! node = this.CreateAssemblyReferenceNode(element);
! }
! else if (referenceType == ProjectFileConstants.ProjectReference)
! {
! node = this.CreateProjectReferenceNode(element);
! }
! else
! {
! // JRock: Added support for other references
! node = this.CreateOtherReferenceNode(element);
! }
!
! return node;
! }
!
! protected virtual ReferenceNode CreateReferenceNode(VSCOMPONENTSELECTORDATA selectorData)
! {
! ReferenceNode node = null;
! switch (selectorData.type)
! {
! case VSCOMPONENTTYPE.VSCOMPONENTTYPE_Project:
! node = this.CreateProjectReferenceNode(selectorData);
! break;
! case VSCOMPONENTTYPE.VSCOMPONENTTYPE_File:
! // This is the case for managed assembly
! case VSCOMPONENTTYPE.VSCOMPONENTTYPE_ComPlus:
! node = this.CreateFileComponent(selectorData);
! break;
! case VSCOMPONENTTYPE.VSCOMPONENTTYPE_Com2:
! node = this.CreateComReferenceNode(selectorData);
! break;
! }
!
! return node;
! }
! #endregion
!
! #region Helper functions to add references
! ///
/// Creates a project reference node given an existing project element.
///

Index: TokenProcessor.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/TokenProcessor.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** TokenProcessor.cs 20 Sep 2006 10:43:22 -0000 1.1
--- TokenProcessor.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 92,99 ****
throw new ArgumentNullException("Token replacement target file is not valid.");

//Open the file. Check to see if the File is binary or text.

uint binaryType;
- bool rc = NativeMethods.GetBinaryType(source, out binaryType);
if (!NativeMethods.GetBinaryType(source, out binaryType))
{
--- 92,108 ----
throw new ArgumentNullException("Token replacement target file is not valid.");

+ // Make sure that the destination folder exists.
+ string destinationFolder = Path.GetDirectoryName(destination);
+ if (!Directory.Exists(destinationFolder))
+ {
+ Directory.CreateDirectory(destinationFolder);
+ }
+
//Open the file. Check to see if the File is binary or text.
+ // NOTE: This is not correct because GetBinaryType will return true
+ // only if the file is executable, not if it is a dll, a library or
+ // any other type of binary file.

uint binaryType;
if (!NativeMethods.GetBinaryType(source, out binaryType))
{

Index: ProjectFileConstants.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ProjectFileConstants.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ProjectFileConstants.cs 20 Sep 2006 10:43:21 -0000 1.1
--- ProjectFileConstants.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 44,47 ****
--- 44,48 ----
public const string HintPath = "HintPath";
public const string AssemblyName = "AssemblyName";
+ public const string FinalOutputPath = "FinalOutputPath";
public const string Project = "Project";
public const string LinkedIntoProjectAt = "LinkedIntoProjectAt";

Index: NodeProperties.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/NodeProperties.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** NodeProperties.cs 4 Oct 2006 08:07:33 -0000 1.2
--- NodeProperties.cs 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 291,318 ****
[CLSCompliant(false), ComVisible(true)]
public class FileNodeProperties : NodeProperties
! {
! #region fields
! private EventHandler onCustomToolChanged;
! private EventHandler onCustomToolNameSpaceChanged;
! protected string customTool = "";
! protected string customToolNamespace = "";
!
! #endregion
!
! #region custom tool events
! internal event EventHandler OnCustomToolChanged
! {
! add { onCustomToolChanged += value; }
! remove { onCustomToolChanged -= value; }
! }
!
! internal event EventHandler OnCustomToolNameSpaceChanged
! {
! add { onCustomToolNameSpaceChanged += value; }
! remove { onCustomToolNameSpaceChanged -= value; }
! }
!
! #endregion
!
#region properties
[SRCategoryAttribute(SR.Advanced)]
--- 291,295 ----
[CLSCompliant(false), ComVisible(true)]
public class FileNodeProperties : NodeProperties
! {
#region properties
[SRCategoryAttribute(SR.Advanced)]
***************
*** 369,372 ****
--- 346,411 ----
}

+ #region non-browsable properties - used for automation only
+ [Browsable(false)]
+ public string Extension
+ {
+ get
+ {
+ Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");
+
+ return Path.GetExtension(this.Node.Caption);
+ }
+ }
+ #endregion
+
+ #endregion
+
+ #region ctors
+ public FileNodeProperties()
+ {
+ }
+
+ public FileNodeProperties(HierarchyNode node)
+ : base(node)
+ {
+ }
+ #endregion
+
+ #region overridden methods
+ public override string GetClassName()
+ {
+ return SR.GetString("FileProperties");
+ }
+ #endregion
+
+ }
+
+ [CLSCompliant(false), ComVisible(true)]
+ public class SingleFileGeneratorNodeProperties : FileNodeProperties
+ {
+ #region fields
+ private EventHandler onCustomToolChanged;
+ private EventHandler onCustomToolNameSpaceChanged;
+ protected string customTool = "";
+ protected string customToolNamespace = "";
+
+ #endregion
+
+ #region custom tool events
+ internal event EventHandler OnCustomToolChanged
+ {
+ add { onCustomToolChanged += value; }
+ remove { onCustomToolChanged -= value; }
+ }
+
+ internal event EventHandler OnCustomToolNameSpaceChanged
+ {
+ add { onCustomToolNameSpaceChanged += value; }
+ remove { onCustomToolNameSpaceChanged -= value; }
+ }
+
+ #endregion
+
+ #region properties
[SRCategoryAttribute(SR.Advanced)]
[LocDisplayName(SR.CustomTool)]
***************
*** 418,454 ****
}
}
- #region non-browsable properties - used for automation only
- [Browsable(false)]
- public string Extension
- {
- get
- {
- Debug.Assert(this.Node != null, "The associated hierarchy node has not been initialized");
-
- return Path.GetExtension(this.Node.Caption);
- }
- }
- #endregion
-
#endregion

#region ctors
! public FileNodeProperties()
{
}

! public FileNodeProperties(HierarchyNode node)
: base(node)
{
}
! #endregion
!
! #region overridden methods
! public override string GetClassName()
! {
! return SR.GetString("FileProperties");
! }
! #endregion
!
}

--- 457,472 ----
}
}
#endregion

#region ctors
! public SingleFileGeneratorNodeProperties()
{
}

! public SingleFileGeneratorNodeProperties(HierarchyNode node)
: base(node)
{
}
! #endregion
}

***************
*** 734,736 ****
--- 752,775 ----
#endregion
}
+
+ [ComVisible(true)]
+ public class ProjectReferencesProperties : ReferenceNodeProperties
+ {
+ #region ctors
+ public ProjectReferencesProperties(ProjectReferenceNode node)
+ : base(node)
+ {
+ }
+ #endregion
+
+ #region overriden methods
+ public override string FullPath
+ {
+ get
+ {
+ return ((ProjectReferenceNode)Node).ReferencedProjectOutputPath;
+ }
+ }
+ #endregion
+ }
}

Index: ProjectNode.CopyPaste.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ProjectNode.CopyPaste.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ProjectNode.CopyPaste.cs 4 Oct 2006 08:07:33 -0000 1.1
--- ProjectNode.CopyPaste.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 25,1070 ****
namespace Microsoft.VisualStudio.Package
{
! ///
! /// Manages the CopyPaste and Drag and Drop scenarios for a Project.
! ///
! /// This is a partial class.
! public partial class ProjectNode : IVsUIHierWinClipboardHelperEvents
! {
! #region fields
! private uint copyPasteCookie;
[...2066 lines suppressed...]
! IntPtr data = IntPtr.Zero;
! try
! {
! data = UnsafeNativeMethods.GlobalLock(ptr);
! Marshal.StructureToPtr(df, data, false);
! IntPtr strData = new IntPtr((long)data + dwSize);
! DragDropHelper.CopyStringToHGlobal(sb.ToString(), strData, structSize);
! }
! finally
! {
! if (data != IntPtr.Zero)
! UnsafeNativeMethods.GlobalUnLock(data);
! }
!
! return ptr;
! }
!
! #endregion
! }
}

--- NEW FILE: ProjectNode.Events.cs ---
/***************************************************************************

Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

***************************************************************************/

using System;


namespace Microsoft.VisualStudio.Package
{
///
/// Argument of the event raised when a project property is changed.
///
public class ProjectPropertyChangedArgs : EventArgs
{
private string propertyName;
private string oldValue;
private string newValue;

internal ProjectPropertyChangedArgs(string propertyName, string oldValue, string newValue)
{
this.propertyName = propertyName;
this.oldValue = oldValue;
this.newValue = newValue;
}

public string NewValue
{
get { return newValue; }
}

public string OldValue
{
get { return oldValue; }
}

public string PropertyName
{
get { return propertyName; }
}
}

public partial class ProjectNode
{
#region fields
private EventHandler projectPropertiesListeners;
#endregion

#region events
public event EventHandler OnProjectPropertyChanged
{
add { projectPropertiesListeners += value; }
remove { projectPropertiesListeners -= value; }
}
#endregion

#region methods
protected void RaiseProjectPropertyChanged(string propertyName, string oldValue, string newValue)
{
if (null != projectPropertiesListeners)
{
projectPropertiesListeners(this, new ProjectPropertyChangedArgs(propertyName, oldValue, newValue));
}
}
#endregion
}

}
Index: FolderNode.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/FolderNode.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** FolderNode.cs 4 Oct 2006 08:07:33 -0000 1.2
--- FolderNode.cs 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 92,96 ****
public override object GetIconHandle(bool open)
{
! return PackageUtilities.GetIntPointerFromImage(open ? this.ProjectMgr.ImageList.Images[(int)ProjectNode.ImageName.OpenFolder] : this.ProjectMgr.ImageList.Images[(int)ProjectNode.ImageName.Folder]);
}

--- 92,96 ----
public override object GetIconHandle(bool open)
{
! return this.ProjectMgr.ImageHandler.GetIconHandle(open ? (int)ProjectNode.ImageName.OpenFolder : (int)ProjectNode.ImageName.Folder);
}


Index: ProjectReferenceNode.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ProjectReferenceNode.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ProjectReferenceNode.cs 4 Oct 2006 08:07:33 -0000 1.2
--- ProjectReferenceNode.cs 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 32,55 ****
public class ProjectReferenceNode : ReferenceNode
{
- #region Nested Types
- [ComVisible(true)]
- private class ProjectReferencesProperties : ReferenceNodeProperties
- {
- public ProjectReferencesProperties(ProjectReferenceNode node)
- : base(node)
- {
- }
-
- public override string FullPath
- {
- get
- {
- return ((ProjectReferenceNode)Node).ReferencedProjectOutputPath;
- }
- }
-
- }
- #endregion
-
#region fieds
///
--- 32,35 ----
***************
*** 155,213 ****
get
{
! // Avoid searching for the object if we have found it before.
! if (null != referencedProject)
{
- return referencedProject;
- }

! // Search for the project in the collection of the projects in the
! // current solution.
! EnvDTE.DTE dte = (EnvDTE.DTE)this.ProjectMgr.GetService(typeof(EnvDTE.DTE));
! if ((null == dte) || (null == dte.Solution))
! {
! return null;
! }
! foreach (EnvDTE.Project prj in dte.Solution.Projects)
! {
! // Get the full path of the current project.
! EnvDTE.Property pathProperty = null;
! try
{
! pathProperty = prj.Properties.Item("FullPath");
! if (null == pathProperty)
{
- // The full path should alway be availabe, but if this is not the
- // case then we have to skip it.
continue;
}
! }
! catch (ArgumentException)
! {
! continue;
! }
! string prjPath = pathProperty.Value.ToString();
! EnvDTE.Property fileNameProperty = null;
! // Get the name of the project file.
! try
! {
! fileNameProperty = prj.Properties.Item("FileName");
! if (null == fileNameProperty)
{
- // Again, this should never be the case, but we handle it anyway.
continue;
}
! }
! catch (ArgumentException)
! {
! continue;
! }
! prjPath = System.IO.Path.Combine(prjPath, fileNameProperty.Value.ToString());

! // If the full path of this project is the same as the one of this
! // reference, then we have found the right project.
! if (NativeMethods.IsSamePath(prjPath, referencedProjectFullPath))
! {
! referencedProject = prj;
! break;
}
}
--- 135,197 ----
get
{
! if (referencedProject == null)
{

! // Search for the project in the collection of the projects in the
! // current solution.
! EnvDTE.DTE dte = (EnvDTE.DTE)this.ProjectMgr.GetService(typeof(EnvDTE.DTE));
! if ((null == dte) || (null == dte.Solution))
{
! return null;
! }
! foreach (EnvDTE.Project prj in dte.Solution.Projects)
! {
! //Skip this project if it is an umodeled project (unloaded)
! if (string.Compare(EnvDTE.Constants.vsProjectKindUnmodeled, prj.Kind, StringComparison.OrdinalIgnoreCase) == 0)
{
continue;
}
!
! // Get the full path of the current project.
! EnvDTE.Property pathProperty = null;
! try
! {
! pathProperty = prj.Properties.Item("FullPath");
! if (null == pathProperty)
! {
! // The full path should alway be availabe, but if this is not the
! // case then we have to skip it.
! continue;
! }
! }
! catch (ArgumentException)
{
continue;
}
! string prjPath = pathProperty.Value.ToString();
! EnvDTE.Property fileNameProperty = null;
! // Get the name of the project file.
! try
! {
! fileNameProperty = prj.Properties.Item("FileName");
! if (null == fileNameProperty)
! {
! // Again, this should never be the case, but we handle it anyway.
! continue;
! }
! }
! catch (ArgumentException)
! {
! continue;
! }
! prjPath = System.IO.Path.Combine(prjPath, fileNameProperty.Value.ToString());

! // If the full path of this project is the same as the one of this
! // reference, then we have found the right project.
! if (NativeMethods.IsSamePath(prjPath, referencedProjectFullPath))
! {
! referencedProject = prj;
! break;
! }
}
}
***************
*** 443,446 ****
--- 427,436 ----
}

+ //If the Project is unloaded return false
+ if (this.ReferencedProjectObject == null)
+ {
+ return false;
+ }
+
return (!String.IsNullOrEmpty(this.referencedProjectFullPath) && File.Exists(this.referencedProjectFullPath));
}

Index: ProjectNode.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ProjectNode.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ProjectNode.cs 4 Oct 2006 08:07:33 -0000 1.2
--- ProjectNode.cs 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 62,67 ****
IProjectEventsProvider,
IReferenceContainerProvider,
! IVsProjectSpecialFiles,
! IVsSingleFileGeneratorFactory
{
#region nested types
--- 62,67 ----
IProjectEventsProvider,
IReferenceContainerProvider,
! IVsProjectSpecialFiles
!
{
#region nested types
***************
*** 121,221 ****
PFX = 50,
SNK = 51,
- }
-
- private class GeneratorMetaData
- {
- #region fields
- private Guid generatorClsid = Guid.Empty;
- private int generatesDesignTimeSource = -1;
- private int generatesSharedDesignTimeSource = -1;
- private int useDesignTimeCompilationFlag = -1;
- object generator = null;
- #endregion
-
- #region ctor
- ///
- /// Constructor
- ///
- public GeneratorMetaData()
- {
- }
- #endregion
-
- #region Public Properties
- ///
- /// Generator instance
- ///
- public Object Generator
- {
- get
- {
- return generator;
- }
- set
- {
- generator = value;
- }
- }
-
- ///
- /// GeneratesDesignTimeSource reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
- ///
- public int GeneratesDesignTimeSource
- {
- get
- {
- return generatesDesignTimeSource;
- }
- set
- {
- generatesDesignTimeSource = value;
- }
- }
-
- ///
- /// GeneratesSharedDesignTimeSource reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
- ///
- public int GeneratesSharedDesignTimeSource
- {
- get
- {
- return generatesSharedDesignTimeSource;
- }
- set
- {
- generatesSharedDesignTimeSource = value;
- }
- }

! ///
! /// UseDesignTimeCompilationFlag reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
! ///
! public int UseDesignTimeCompilationFlag
! {
! get
! {
! return useDesignTimeCompilationFlag;
! }
! set
! {
! useDesignTimeCompilationFlag = value;
! }
! }
!
! ///
! /// Generator Class ID.
! ///
! public Guid GeneratorClsid
! {
! get
! {
! return generatorClsid;
! }
! set
! {
! generatorClsid = value;
! }
! }
! #endregion
}

--- 121,126 ----
PFX = 50,
SNK = 51,

! ImageLast = 51
}

***************
*** 296,300 ****
private bool buildIsPrepared;

! private ImageList imageList;

private string errorString;
--- 201,205 ----
private bool buildIsPrepared;

! private ImageHandler imageHandler;

private string errorString;
***************
*** 378,411 ****

///
- /// Base generator registry key for MPF based project
- ///
- private RegistryKey baseGeneratorRegistryKey = null;
-
- ///
- /// CLSID reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
- ///
- private string GeneratorClsid = "CLSID";
-
- ///
- /// GeneratesDesignTimeSource reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
- ///
- private string GeneratesDesignTimeSource = "GeneratesDesignTimeSource";
-
- ///
- /// GeneratesSharedDesignTimeSource reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
- ///
- private string GeneratesSharedDesignTimeSource = "GeneratesSharedDesignTimeSource";
-
- ///
- /// UseDesignTimeCompilationFlag reg value name under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\[VsVer]\Generators\[ProjFacGuid]\[GeneratorProgId]
- ///
- private string UseDesignTimeCompilationFlag = "UseDesignTimeCompilationFlag";
-
- ///
- /// Caches all the generators registered for the project type.
- ///
- private Dictionary generatorsMap = new Dictionary();
-
- ///
/// Used for flavoring to hold the XML fragments
///
--- 283,286 ----
***************
*** 686,698 ****

/// The icons used in the hierarchy view.
! public ImageList ImageList
{
get
{
! return this.imageList;
! }
! set
! {
! this.imageList = value;
}
}
--- 561,573 ----

/// The icons used in the hierarchy view.
! public ImageHandler ImageHandler
{
get
{
! if (null == imageHandler)
! {
! imageHandler = new ImageHandler(typeof(ProjectNode).Assembly.GetManifestResourceStream("Resources.imagelis.bmp"));
! }
! return imageHandler;
}
}
***************
*** 1035,1038 ****
--- 910,919 ----
}

+ // Now check whether the original file is still there. It could have been renamed.
+ if (!File.Exists(this.Url))
+ {
+ throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.FileOrFolderCannotBeFound), this.ProjectFile));
+ }
+
// Get the full file name and then rename the project file.
string newFile = Path.Combine(this.ProjectFolder, label);
***************
*** 1125,1128 ****
--- 1006,1014 ----
this.buildProject = null;
}
+ if (null != imageHandler)
+ {
+ imageHandler.Close();
+ imageHandler = null;
+ }
}
catch (Exception e)
***************
*** 1940,1943 ****
--- 1826,1830 ----

this.buildProject.SetProperty(propertyName, propertyValue, null);
+ RaiseProjectPropertyChanged(propertyName, oldValue, propertyValue);

// property cache will need to be updated
***************
*** 1976,1980 ****
options.OutputAssembly = outputPath + this.GetAssemblyName(config);

! string outputtype = GetProjectProperty(ProjectFileConstants.OutputType, false).ToLower(CultureInfo.InvariantCulture);

if (outputtype == "library")
--- 1863,1871 ----
options.OutputAssembly = outputPath + this.GetAssemblyName(config);

! string outputtype = GetProjectProperty(ProjectFileConstants.OutputType, false);
! if (!string.IsNullOrEmpty(outputtype))
! {
! outputtype = outputtype.ToLower(CultureInfo.InvariantCulture);
! }

if (outputtype == "library")
***************
*** 2285,2289 ****
protected virtual Guid[] GetConfigurationDependentPropertyPages()
{
! return new Guid[] { Guid.Empty };
}

--- 2176,2180 ----
protected virtual Guid[] GetConfigurationDependentPropertyPages()
{
! return new Guid[0];
}

***************
*** 2575,2579 ****

// Nothing to do if the name is the same
! if (String.Compare(oldFile, newFile, StringComparison.OrdinalIgnoreCase) == 0)
{
return;
--- 2466,2470 ----

// Nothing to do if the name is the same
! if (String.Compare(oldFile, newFile, StringComparison.Ordinal) == 0)
{
return;
***************
*** 2619,2626 ****
this.SetProjectFileDirty(false);

! // Now that the new file name has been created delete the old one.
! // TODO: Handle source control issues.
! File.SetAttributes(oldFile, FileAttributes.Normal);
! File.Delete(oldFile);

this.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_Caption, 0);
--- 2510,2520 ----
this.SetProjectFileDirty(false);

! if (!isFileSame)
! {
! // Now that the new file name has been created delete the old one.
! // TODO: Handle source control issues.
! File.SetAttributes(oldFile, FileAttributes.Normal);
! File.Delete(oldFile);
! }

this.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_Caption, 0);
***************
*** 3279,3282 ****
--- 3173,3179 ----
{
string strPath = folder.FinalItemSpec;
+
+ // We do not need any special logic for assuring that a folder is only added once to the ui hierarchy.
+ // The below method will only add once the folder to the ui hierarchy
this.CreateFolderNodes(strPath);
}
***************
*** 3291,3294 ****
--- 3188,3194 ----
Dictionary subitems = new Dictionary();

+ // Define a set for our build items. The value does not really matter here.
+ Dictionary items = new Dictionary();
+
// Process Files
MSBuild.BuildItemGroup projectFiles = this.buildProject.EvaluatedItems;
***************
*** 3305,3308 ****
--- 3205,3216 ----
continue;

+ // If the item is already contained do nothing.
+ // TODO: possibly report in the error list that the the item is already contained in the project file similar to Language projects.
+ if (items.ContainsKey(item.FinalItemSpec.ToUpperInvariant()))
+ continue;
+
+ // Make sure that we do not want to add the item, dependent, or independent twice to the ui hierarchy
+ items.Add(item.FinalItemSpec.ToUpperInvariant(), item);
+
string dependentOf = item.GetMetadata(ProjectFileConstants.DependentUpon);

***************
*** 5115,5130 ****
set
{
this.projectEventsProvider = value;
! }
! }
!
! ///
! /// Subscribes to the project events on this project.
! ///
! void IProjectEventsProvider.SubscibeToProjectEvents()
! {
! if (null != this.projectEventsProvider)
! {
! this.projectEventsProvider.AfterProjectFileOpened += this.OnAfterProjectOpen;
}
}
--- 5023,5035 ----
set
{
+ if (null != this.projectEventsProvider)
+ {
+ this.projectEventsProvider.AfterProjectFileOpened -= this.OnAfterProjectOpen;
+ }
this.projectEventsProvider = value;
! if (null != this.projectEventsProvider)
! {
! this.projectEventsProvider.AfterProjectFileOpened += this.OnAfterProjectOpen;
! }
}
}
***************
*** 5191,5313 ****
#endregion

- #region IVsSingleFileGeneratorFactory Members
- ///
- /// Creates an instance of the single file generator requested
- ///
- /// prog id of the generator to be created. For e.g HKLM\SOFTWARE\Microsoft\VisualStudio\8.0Exp\Generators\[prjfacguid]\[wszProgId]
- /// GeneratesDesignTimeSource key value
- /// GeneratesSharedDesignTimeSource key value
- /// UseDesignTimeCompilationFlag key value
- /// IVsSingleFileGenerator interface
- /// S_OK if succesful
- public virtual int CreateGeneratorInstance(string progId, out int generatesDesignTimeSource, out int generatesSharedDesignTimeSource, out int useTempPEFlag, out IVsSingleFileGenerator generate)
- {
- Guid genGuid;
- ErrorHandler.ThrowOnFailure(GetGeneratorInformation(progId, out generatesDesignTimeSource, out generatesSharedDesignTimeSource, out useTempPEFlag, out genGuid));
-
- //Create the single file generator and pass it out. Check to see if it is in the cache
- if (!this.generatorsMap.ContainsKey(progId) || ((this.generatorsMap[progId]).Generator == null))
- {
- Guid riid = VSConstants.IID_IUnknown;
- uint dwClsCtx = (uint)CLSCTX.CLSCTX_INPROC_SERVER;
- IntPtr genIUnknown = IntPtr.Zero;
- //create a new one.
- ErrorHandler.ThrowOnFailure(LocalRegistry.CreateInstance(genGuid, null, ref riid, dwClsCtx, out genIUnknown));
- if (genIUnknown != IntPtr.Zero)
- {
- try
- {
- object generator = Marshal.GetObjectForIUnknown(genIUnknown);
- //Build the generator meta data object and cache it.
- GeneratorMetaData genData = new GeneratorMetaData();
- genData.GeneratesDesignTimeSource = generatesDesignTimeSource;
- genData.GeneratesSharedDesignTimeSource = generatesSharedDesignTimeSource;
- genData.UseDesignTimeCompilationFlag = useTempPEFlag;
- genData.GeneratorClsid = genGuid;
- genData.Generator = generator;
- generatorsMap[progId] = genData;
- }
- finally
- {
- Marshal.Release(genIUnknown);
- }
- }
- }
-
- generate = (generatorsMap[progId]).Generator as IVsSingleFileGenerator;
-
- return VSConstants.S_OK;
- }
-
- ///
- /// Gets the default generator based on the file extension. HKLM\Software\Microsoft\VS\8.0\Generators\[prjfacguid]\.extension
- ///
- /// File name with extension
- /// The generator prog ID
- /// S_OK if successful
- public virtual int GetDefaultGenerator(string filename, out string progID)
- {
- progID = "";
- return VSConstants.E_NOTIMPL;
- }
-
- ///
- /// Gets the generator information.
- ///
- /// prog id of the generator to be created. For e.g HKLM\SOFTWARE\Microsoft\VisualStudio\8.0Exp\Generators\[prjfacguid]\[wszProgId]
- /// GeneratesDesignTimeSource key value
- /// GeneratesSharedDesignTimeSource key value
- /// UseDesignTimeCompilationFlag key value
- /// CLSID key value
- /// S_OK if succesful
- public virtual int GetGeneratorInformation(string progId, out int generatesDesignTimeSource, out int generatesSharedDesignTimeSource, out int useTempPEFlag, out Guid guidGenerator)
- {
- RegistryKey genKey;
- generatesDesignTimeSource = -1;
- generatesSharedDesignTimeSource = -1;
- useTempPEFlag = -1;
- guidGenerator = Guid.Empty;
- if (string.IsNullOrEmpty(progId))
- return VSConstants.S_FALSE;
-
- //Create the single file generator and pass it out.
- if (!generatorsMap.ContainsKey(progId))
- {
- if ((genKey = BaseGeneratorsKey.OpenSubKey(progId)) == null)
- {
- return VSConstants.S_FALSE;
- }
- //Get the CLSID
- string guid = (string)genKey.GetValue(GeneratorClsid, "");
- if (string.IsNullOrEmpty(guid))
- return VSConstants.S_FALSE;
-
- GeneratorMetaData genData = new GeneratorMetaData();
-
- genData.GeneratorClsid = guidGenerator = new Guid(guid);
- //Get the GeneratesDesignTimeSource flag. Assume 0 if not present.
- genData.GeneratesDesignTimeSource = generatesDesignTimeSource = (int)genKey.GetValue(this.GeneratesDesignTimeSource, 0);
- //Get the GeneratesSharedDesignTimeSource flag. Assume 0 if not present.
- genData.GeneratesSharedDesignTimeSource = generatesSharedDesignTimeSource = (int)genKey.GetValue(GeneratesSharedDesignTimeSource, 0);
- //Get the UseDesignTimeCompilationFlag flag. Assume 0 if not present.
- genData.UseDesignTimeCompilationFlag = useTempPEFlag = (int)genKey.GetValue(UseDesignTimeCompilationFlag, 0);
- generatorsMap.Add(progId, genData);
- }
- else
- {
- GeneratorMetaData genData = generatorsMap[progId];
- generatesDesignTimeSource = genData.GeneratesDesignTimeSource;
- //Get the GeneratesSharedDesignTimeSource flag. Assume 0 if not present.
- generatesSharedDesignTimeSource = genData.GeneratesSharedDesignTimeSource;
- //Get the UseDesignTimeCompilationFlag flag. Assume 0 if not present.
- useTempPEFlag = genData.UseDesignTimeCompilationFlag;
- //Get the CLSID
- guidGenerator = genData.GeneratorClsid;
- }
-
- return VSConstants.S_OK;
- }
- #endregion
-
#region IVsProjectFlavorCfgProvider Members

--- 5096,5099 ----
***************
*** 5428,5462 ****

#region private helper methods
- #region IVsSingleFileGeneratorFactory Helpers
- ///
- /// Returns the project generator key under HKLM\SOFTWARE\Microsoft\VisualStudio\[version]\Generators
- ///
- private RegistryKey BaseGeneratorsKey
- {
- get
- {
- if (baseGeneratorRegistryKey == null)
- {
- string regRoot;
- ILocalRegistry2 pLocReg = LocalRegistry as ILocalRegistry2;
- ErrorHandler.ThrowOnFailure(pLocReg.GetLocalRegistryRoot(out regRoot));
- string regPath = Path.Combine(Path.Combine(regRoot, "Generators"), this.ProjectGuid.ToString("B"));
- baseGeneratorRegistryKey = Registry.LocalMachine.OpenSubKey(regPath);
- }
- return baseGeneratorRegistryKey;
- }
- }
-
- ///
- /// Returns the local registry instance
- ///
- private ILocalRegistry LocalRegistry
- {
- get
- {
- return this.ProjectMgr.GetService(typeof(SLocalRegistry)) as ILocalRegistry;
- }
- }
- #endregion

///
--- 5214,5217 ----
***************
*** 5467,5471 ****
this.ID = VSConstants.VSITEMID_ROOT;
this.tracker = new TrackDocumentsHelper(this);
- this.imageList = Utilities.GetImageList(typeof(ProjectNode).Assembly.GetManifestResourceStream("Resources.imagelis.bmp"));
}

--- 5222,5225 ----
***************
*** 5526,5530 ****
}

! private MSBuild.BuildProperty GetMsBuildProperty(string propertyName, bool resetCache)
{
if (resetCache || this.currentConfig == null)
--- 5280,5285 ----
}

! // JROCK: Changed from private to public
! public MSBuild.BuildProperty GetMsBuildProperty(string propertyName, bool resetCache)
{
if (resetCache || this.currentConfig == null)

Index: Microsoft.VisualStudio.Package.Project.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/Microsoft.VisualStudio.Package.Project.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Microsoft.VisualStudio.Package.Project.cs 20 Sep 2006 10:43:20 -0000 1.1
--- Microsoft.VisualStudio.Package.Project.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 11,231 ****


! namespace Microsoft.VisualStudio.Package {
! using System;
! using System.Reflection;
! using System.Globalization;
! using System.Resources;
! using System.Text;
! using System.Threading;
! using System.ComponentModel;
! using System.Security.Permissions;

! [AttributeUsage(AttributeTargets.All)]
! internal sealed class SRDescriptionAttribute : DescriptionAttribute {

! private bool replaced = false;

! public SRDescriptionAttribute(string description) : base(description) {
! }

! public override string Description {
! get {
! if (!replaced) {
! replaced = true;
! DescriptionValue = SR.GetString(base.Description);
! }
! return base.Description;
! }
! }
! }

! [AttributeUsage(AttributeTargets.All)]
! internal sealed class SRCategoryAttribute : CategoryAttribute {

! public SRCategoryAttribute(string category) : base(category) {
! }

! protected override string GetLocalizedString(string value) {
! return SR.GetString(value);
! }
! }
! internal sealed class SR
! {
! internal const string AddReferenceDialogTitle = "AddReferenceDialogTitle";
! internal const string AddToNullProjectError = "AddToNullProjectError";
! internal const string Advanced = "Advanced";
! internal const string AssemblyReferenceAlreadyExists = "AssemblyReferenceAlreadyExists";
! internal const string AttributeLoad = "AttributeLoad";
! internal const string BuildAction = "BuildAction";
! internal const string BuildActionDescription = "BuildActionDescription";
! internal const string BuildCaption = "BuildCaption";
! internal const string BuildVerbosity = "BuildVerbosity";
! internal const string BuildVerbosityDescription = "BuildVerbosityDescription";
! internal const string CancelQueryEdit = "CancelQueryEdit";
! internal const string CannotAddFileThatIsOpenInEditor = "CannotAddFileThatIsOpenInEditor";
! internal const string CanNotSaveFileNotOpeneInEditor = "CanNotSaveFileNotOpeneInEditor";
! internal const string cli1 = "cli1";
! internal const string Compile = "Compile";
! internal const string ConfirmExtensionChange = "ConfirmExtensionChange";
! internal const string Content = "Content";
! internal const string CopyToLocal = "CopyToLocal";
! internal const string CopyToLocalDescription = "CopyToLocalDescription";
! internal const string CustomTool = "CustomTool";
! internal const string CustomToolDescription = "CustomToolDescription";
! internal const string CustomToolNamespace = "CustomToolNamespace";
! internal const string CustomToolNamespaceDescription = "CustomToolNamespaceDescription";
! internal const string Detailed = "Detailed";
! internal const string Diagnostic = "Diagnostic";
! internal const string DirectoryExistError = "DirectoryExistError";
! internal const string EditorViewError = "EditorViewError";
! internal const string EmbeddedResource = "EmbeddedResource";
! internal const string Error = "Error";
! internal const string ErrorInvalidFileName = "ErrorInvalidFileName";
! internal const string ErrorInvalidProjectName = "ErrorInvalidProjectName";
! internal const string ErrorMsBuildRegistration = "ErrorMsBuildRegistration";
! internal const string ErrorSaving = "ErrorSaving";
! internal const string Exe = "Exe";
! internal const string ExpectedObjectOfType = "ExpectedObjectOfType";
! internal const string FailedToGetService = "FailedToGetService";
! internal const string FailedToRetrieveProperties = "FailedToRetrieveProperties";
! internal const string FileNameCannotContainALeadingPeriod = "FileNameCannotContainALeadingPeriod";
! internal const string FileCannotBeRenamedToAnExistingFile = "FileCannotBeRenamedToAnExistingFile";
! internal const string FileAlreadyExistsAndCannotBeRenamed = "FileAlreadyExistsAndCannotBeRenamed";
! internal const string FileAlreadyExists = "FileAlreadyExists";
! internal const string FileAlreadyExistsCaption = "FileAlreadyExistsCaption";
! internal const string FileAlreadyInProject = "FileAlreadyInProject";
! internal const string FileAlreadyInProjectCaption = "FileAlreadyInProjectCaption";
! internal const string FileCopyError = "FileCopyError";
! internal const string FileName = "FileName";
! internal const string FileNameDescription = "FileNameDescription";
! internal const string FileOrFolderAlreadyExists = "FileOrFolderAlreadyExists";
! internal const string FileProperties = "File Properties";
! internal const string FolderName = "FolderName";
! internal const string FolderNameDescription = "FolderNameDescription";
! internal const string FolderProperties = "Folder Properties";
! internal const string FullPath = "FullPath";
! internal const string FullPathDescription = "FullPathDescription";
! internal const string ItemDoesNotExistInProjectDirectory = "ItemDoesNotExistInProjectDirectory";
! internal const string InvalidAutomationObject = "InvalidAutomationObject";
! internal const string InvalidLoggerType = "InvalidLoggerType";
! internal const string InvalidParameter = "InvalidParameter";
! internal const string Library = "Library";
! internal const string LinkedItemsAreNotSupported = "LinkedItemsAreNotSupported";
! internal const string Minimal = "Minimal";
! internal const string Misc = "Misc";
! internal const string None = "None";
! internal const string Normal = "Normal";
internal const string NestedProjectFailedToReload = "NestedProjectFailedToReload";
! internal const string OutputPath = "OutputPath";
! internal const string OutputPathDescription = "OutputPathDescription";
! internal const string PasteFailed = "PasteFailed";
! internal const string ParameterMustBeAValidGuid = "ParameterMustBeAValidGuid";
! internal const string ParameterMustBeAValidItemId = "ParameterMustBeAValidItemId";
! internal const string ParameterCannotBeNullOrEmpty = "ParameterCannotBeNullOrEmpty";
! internal const string PathTooLong = "PathTooLong";
! internal const string ProjectContainsCircularReferences = "ProjectContainsCircularReferences";
! internal const string Program = "Program";
! internal const string Project = "Project";
! internal const string ProjectFile = "ProjectFile";
! internal const string ProjectFileDescription = "ProjectFileDescription";
! internal const string ProjectFolder = "ProjectFolder";
! internal const string ProjectFolderDescription = "ProjectFolderDescription";
! internal const string ProjectProperties = "Project Properties";
! internal const string Quiet = "Quiet";
internal const string QueryReloadNestedProject = "QueryReloadNestedProject";
! internal const string ReferenceAlreadyExists = "ReferenceAlreadyExists";
! internal const string ReferencesNodeName = "ReferencesNodeName";
! internal const string ReferenceProperties = "Reference Properties";
! internal const string RefName = "RefName";
! internal const string RefNameDescription = "RefNameDescription";
! internal const string RenameFolder = "RenameFolder";
! internal const string RTL = "RTL";
! internal const string SaveCaption = "SaveCaption";
! internal const string SaveModifiedDocuments = "SaveModifiedDocuments";
! internal const string SaveOfProjectFileOutsideCurrentDirectory = "SaveOfProjectFileOutsideCurrentDirectory";
! internal const string StandardEditorViewError = "StandardEditorViewError";
! internal const string URL = "URL";
! internal const string UseOfDeletedItemError = "UseOfDeletedItemError";
! internal const string v1 = "v1";
! internal const string v11 = "v11";
! internal const string v2 = "v2";
! internal const string Warning = "Warning";
! internal const string WinExe = "WinExe";

! static SR loader = null;
! ResourceManager resources;

! private static Object s_InternalSyncObject;
! private static Object InternalSyncObject {
! get {
! if (s_InternalSyncObject == null) {
! Object o = new Object();
! Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
! }
! return s_InternalSyncObject;
! }
! }
!
! internal SR() {
! resources = new System.Resources.ResourceManager("Microsoft.VisualStudio.Package.Project", this.GetType().Assembly);
! }
!
! private static SR GetLoader() {
! if (loader == null) {
! lock (InternalSyncObject) {
! if (loader == null) {
! loader = new SR();
! }
! }
! }
!
! return loader;
! }

! private static CultureInfo Culture {
! get { return null/*use ResourceManager default, CultureInfo.CurrentUICulture*/; }
! }
!
! public static ResourceManager Resources {
! get {
! return GetLoader().resources;
! }
! }
!
! public static string GetString(string name, params object[] args) {
! SR sys = GetLoader();
! if (sys == null)
! return null;
! string res = sys.resources.GetString(name, SR.Culture);

! if (args != null && args.Length > 0) {
! return String.Format(CultureInfo.CurrentCulture, res, args);
! }
! else {
! return res;
! }
! }

! public static string GetString(string name) {
! SR sys = GetLoader();
! if (sys == null)
! return null;
! return sys.resources.GetString(name, SR.Culture);
! }
!
! public static string GetString(string name, CultureInfo culture)
! {
! SR sys = GetLoader();
! if (sys == null)
! return null;
! return sys.resources.GetString(name, culture);
! }
!
! public static object GetObject(string name) {
! SR sys = GetLoader();
! if (sys == null)
! return null;
! return sys.resources.GetObject(name, SR.Culture);
! }
! }
}
--- 11,259 ----


! namespace Microsoft.VisualStudio.Package
! {
! using System;
! using System.Reflection;
! using System.Globalization;
! using System.Resources;
! using System.Text;
! using System.Threading;
! using System.ComponentModel;
! using System.Security.Permissions;

! [AttributeUsage(AttributeTargets.All)]
! internal sealed class SRDescriptionAttribute : DescriptionAttribute
! {

! private bool replaced = false;

! public SRDescriptionAttribute(string description)
! : base(description)
! {
! }

! public override string Description
! {
! get
! {
! if (!replaced)
! {
! replaced = true;
! DescriptionValue = SR.GetString(base.Description);
! }
! return base.Description;
! }
! }
! }

! [AttributeUsage(AttributeTargets.All)]
! internal sealed class SRCategoryAttribute : CategoryAttribute
! {

! public SRCategoryAttribute(string category)
! : base(category)
! {
! }

! protected override string GetLocalizedString(string value)
! {
! return SR.GetString(value);
! }
! }
! internal sealed class SR
! {
! internal const string AddReferenceDialogTitle = "AddReferenceDialogTitle";
! internal const string AddToNullProjectError = "AddToNullProjectError";
! internal const string Advanced = "Advanced";
! internal const string AssemblyReferenceAlreadyExists = "AssemblyReferenceAlreadyExists";
! internal const string AttributeLoad = "AttributeLoad";
! internal const string BuildAction = "BuildAction";
! internal const string BuildActionDescription = "BuildActionDescription";
! internal const string BuildCaption = "BuildCaption";
! internal const string BuildVerbosity = "BuildVerbosity";
! internal const string BuildVerbosityDescription = "BuildVerbosityDescription";
! internal const string CancelQueryEdit = "CancelQueryEdit";
! internal const string CannotAddFileThatIsOpenInEditor = "CannotAddFileThatIsOpenInEditor";
! internal const string CanNotSaveFileNotOpeneInEditor = "CanNotSaveFileNotOpeneInEditor";
! internal const string cli1 = "cli1";
! internal const string Compile = "Compile";
! internal const string ConfirmExtensionChange = "ConfirmExtensionChange";
! internal const string Content = "Content";
! internal const string CopyToLocal = "CopyToLocal";
! internal const string CopyToLocalDescription = "CopyToLocalDescription";
! internal const string CustomTool = "CustomTool";
! internal const string CustomToolDescription = "CustomToolDescription";
! internal const string CustomToolNamespace = "CustomToolNamespace";
! internal const string CustomToolNamespaceDescription = "CustomToolNamespaceDescription";
! internal const string Detailed = "Detailed";
! internal const string Diagnostic = "Diagnostic";
! internal const string DirectoryExistError = "DirectoryExistError";
! internal const string EditorViewError = "EditorViewError";
! internal const string EmbeddedResource = "EmbeddedResource";
! internal const string Error = "Error";
! internal const string ErrorInvalidFileName = "ErrorInvalidFileName";
! internal const string ErrorInvalidProjectName = "ErrorInvalidProjectName";
! internal const string ErrorMsBuildRegistration = "ErrorMsBuildRegistration";
! internal const string ErrorSaving = "ErrorSaving";
! internal const string Exe = "Exe";
! internal const string ExpectedObjectOfType = "ExpectedObjectOfType";
! internal const string FailedToGetService = "FailedToGetService";
! internal const string FailedToRetrieveProperties = "FailedToRetrieveProperties";
! internal const string FileNameCannotContainALeadingPeriod = "FileNameCannotContainALeadingPeriod";
! internal const string FileCannotBeRenamedToAnExistingFile = "FileCannotBeRenamedToAnExistingFile";
! internal const string FileAlreadyExistsAndCannotBeRenamed = "FileAlreadyExistsAndCannotBeRenamed";
! internal const string FileAlreadyExists = "FileAlreadyExists";
! internal const string FileAlreadyExistsCaption = "FileAlreadyExistsCaption";
! internal const string FileAlreadyInProject = "FileAlreadyInProject";
! internal const string FileAlreadyInProjectCaption = "FileAlreadyInProjectCaption";
! internal const string FileCopyError = "FileCopyError";
! internal const string FileName = "FileName";
! internal const string FileNameDescription = "FileNameDescription";
! internal const string FileOrFolderAlreadyExists = "FileOrFolderAlreadyExists";
! internal const string FileOrFolderCannotBeFound = "FileOrFolderCannotBeFound";
! internal const string FileProperties = "File Properties";
! internal const string FolderName = "FolderName";
! internal const string FolderNameDescription = "FolderNameDescription";
! internal const string FolderProperties = "Folder Properties";
! internal const string FullPath = "FullPath";
! internal const string FullPathDescription = "FullPathDescription";
! internal const string ItemDoesNotExistInProjectDirectory = "ItemDoesNotExistInProjectDirectory";
! internal const string InvalidAutomationObject = "InvalidAutomationObject";
! internal const string InvalidLoggerType = "InvalidLoggerType";
! internal const string InvalidParameter = "InvalidParameter";
! internal const string Library = "Library";
! internal const string LinkedItemsAreNotSupported = "LinkedItemsAreNotSupported";
! internal const string Minimal = "Minimal";
! internal const string Misc = "Misc";
! internal const string None = "None";
! internal const string Normal = "Normal";
internal const string NestedProjectFailedToReload = "NestedProjectFailedToReload";
! internal const string OutputPath = "OutputPath";
! internal const string OutputPathDescription = "OutputPathDescription";
! internal const string PasteFailed = "PasteFailed";
! internal const string ParameterMustBeAValidGuid = "ParameterMustBeAValidGuid";
! internal const string ParameterMustBeAValidItemId = "ParameterMustBeAValidItemId";
! internal const string ParameterCannotBeNullOrEmpty = "ParameterCannotBeNullOrEmpty";
! internal const string PathTooLong = "PathTooLong";
! internal const string ProjectContainsCircularReferences = "ProjectContainsCircularReferences";
! internal const string Program = "Program";
! internal const string Project = "Project";
! internal const string ProjectFile = "ProjectFile";
! internal const string ProjectFileDescription = "ProjectFileDescription";
! internal const string ProjectFolder = "ProjectFolder";
! internal const string ProjectFolderDescription = "ProjectFolderDescription";
! internal const string ProjectProperties = "Project Properties";
! internal const string Quiet = "Quiet";
internal const string QueryReloadNestedProject = "QueryReloadNestedProject";
! internal const string ReferenceAlreadyExists = "ReferenceAlreadyExists";
! internal const string ReferencesNodeName = "ReferencesNodeName";
! internal const string ReferenceProperties = "Reference Properties";
! internal const string RefName = "RefName";
! internal const string RefNameDescription = "RefNameDescription";
! internal const string RenameFolder = "RenameFolder";
! internal const string RTL = "RTL";
! internal const string SaveCaption = "SaveCaption";
! internal const string SaveModifiedDocuments = "SaveModifiedDocuments";
! internal const string SaveOfProjectFileOutsideCurrentDirectory = "SaveOfProjectFileOutsideCurrentDirectory";
! internal const string StandardEditorViewError = "StandardEditorViewError";
! internal const string URL = "URL";
! internal const string UseOfDeletedItemError = "UseOfDeletedItemError";
! internal const string v1 = "v1";
! internal const string v11 = "v11";
! internal const string v2 = "v2";
! internal const string Warning = "Warning";
! internal const string WinExe = "WinExe";

! static SR loader = null;
! ResourceManager resources;

! private static Object s_InternalSyncObject;
! private static Object InternalSyncObject
! {
! get
! {
! if (s_InternalSyncObject == null)
! {
! Object o = new Object();
! Interlocked.CompareExchange(ref s_InternalSyncObject, o, null);
! }
! return s_InternalSyncObject;
! }
! }

! internal SR()
! {
! resources = new System.Resources.ResourceManager("Microsoft.VisualStudio.Package.Project", this.GetType().Assembly);
! }

! private static SR GetLoader()
! {
! if (loader == null)
! {
! lock (InternalSyncObject)
! {
! if (loader == null)
! {
! loader = new SR();
! }
! }
! }

! return loader;
! }
!
! private static CultureInfo Culture
! {
! get { return null/*use ResourceManager default, CultureInfo.CurrentUICulture*/; }
! }
!
! public static ResourceManager Resources
! {
! get
! {
! return GetLoader().resources;
! }
! }
!
! public static string GetString(string name, params object[] args)
! {
! SR sys = GetLoader();
! if (sys == null)
! return null;
! string res = sys.resources.GetString(name, SR.Culture);
!
! if (args != null && args.Length > 0)
! {
! return String.Format(CultureInfo.CurrentCulture, res, args);
! }
! else
! {
! return res;
! }
! }
!
! public static string GetString(string name)
! {
! SR sys = GetLoader();
! if (sys == null)
! return null;
! return sys.resources.GetString(name, SR.Culture);
! }
!
! public static string GetString(string name, CultureInfo culture)
! {
! SR sys = GetLoader();
! if (sys == null)
! return null;
! return sys.resources.GetString(name, culture);
! }
!
! public static object GetObject(string name)
! {
! SR sys = GetLoader();
! if (sys == null)
! return null;
! return sys.resources.GetObject(name, SR.Culture);
! }
! }
}

Index: Interfaces.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/Interfaces.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Interfaces.cs 20 Sep 2006 10:43:20 -0000 1.1
--- Interfaces.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 157,165 ****
set;
}

! ///
! /// Subscribes to events defined by IProjectEvents for the project.
///
! void SubscibeToProjectEvents();
}
}
\ No newline at end of file
--- 157,172 ----
set;
}
+ }

! ///
! /// Defines support for single file generator
! ///
! public interface ISingleFileGenerator
! {
! ///
! /// Runs the generator on the item represented by the document moniker.
///
! ///
! void RunGenerator(string document);
}
}
\ No newline at end of file

Index: Utilities.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/Utilities.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Utilities.cs 20 Sep 2006 10:43:23 -0000 1.1
--- Utilities.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 132,143 ****
}

! string stringList = null;
for (int i = 0; i < guids.Length; i++)
{
! stringList += guids[i].ToString("B");
! stringList += ";";
}

! return stringList.TrimEnd(';');
}

--- 132,145 ----
}

! // Create a StringBuilder with a pre-allocated buffer big enough for the
! // final string. 39 is the length of a GUID in the "B" form plus the final ';'
! StringBuilder stringList = new StringBuilder(39 * guids.Length);
for (int i = 0; i < guids.Length; i++)
{
! stringList.Append(guids[i].ToString("B"));
! stringList.Append(";");
}

! return stringList.ToString().TrimEnd(';');
}


Index: ProjectConfig.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ProjectConfig.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ProjectConfig.cs 20 Sep 2006 10:43:20 -0000 1.1
--- ProjectConfig.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 25,813 ****
namespace Microsoft.VisualStudio.Package
{
! [CLSCompliant(false), ComVisible(true)]
! public class ProjectConfig :
! IVsCfg,
! IVsProjectCfg,
! IVsProjectCfg2,
! IVsProjectFlavorCfg,
! IVsDebuggableProjectCfg,
! ISpecifyPropertyPages,
[...1587 lines suppressed...]
! int success = ((result == MSBuildResult.Sucessful) ? 1 : 0);

! foreach (IVsBuildStatusCallback cb in callbacks)
! {
! try
! {
! ErrorHandler.ThrowOnFailure(cb.BuildEnd(success));
! }
! catch (Exception e)
! {
! // If those who ask for status have bugs in their code it should not prevent the build/notification from happening
! Debug.Fail(String.Format("Exception was thrown during BuildEnd event\n{0}", e.Message));
! }
! }
! ErrorHandler.ThrowOnFailure(output.FlushToTaskList());
! }
! }
! #endregion
! }
}

--- NEW FILE: SingleFileGenerator.cs ---
/***************************************************************************

Copyright (c) Microsoft Corporation. All rights reserved.
This code is licensed under the Visual Studio SDK license terms.
THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.

***************************************************************************/


namespace Microsoft.VisualStudio.Package
{
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.IO;
using System.Diagnostics;
using System.Globalization;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;
using Microsoft.VisualStudio.OLE.Interop;
using Microsoft.VisualStudio.TextManager.Interop;

///
/// Provides support for single file generator.
///
internal class SingleFileGenerator : ISingleFileGenerator, IVsGeneratorProgress
{

#region fields
private bool gettingCheckoutStatus;
private bool runningGenerator;
private ProjectNode projectMgr;
#endregion

#region ctors
///
/// Overloadde ctor.
///
/// The associated project
internal SingleFileGenerator(ProjectNode projectMgr)
{
this.projectMgr = projectMgr;
}
#endregion

#region IVsGeneratorProgress Members

public virtual int GeneratorError(int warning, uint level, string err, uint line, uint col)
{
return VSConstants.E_NOTIMPL;
}

public virtual int Progress(uint complete, uint total)
{
return VSConstants.E_NOTIMPL;
}

#endregion

#region ISingleFileGenerator
///
/// Runs the generator on the current project item.
///
///
///
public virtual void RunGenerator(string document)
{
// Go run the generator on that node, but only if the file is dirty
// in the running document table. Otherwise there is no need to rerun
// the generator because if the original document is not dirty then
// the generated output should be already up to date.
uint itemid = VSConstants.VSITEMID_NIL;
IVsHierarchy hier = (IVsHierarchy)this.projectMgr;
if (document != null && hier != null && ErrorHandler.Succeeded(hier.ParseCanonicalName((string)document, out itemid)))
{
IVsHierarchy rdtHier;
IVsPersistDocData perDocData;
uint cookie;
if (this.VerifyFileDirtyInRdt((string)document, out rdtHier, out perDocData, out cookie))
{
// Run the generator on the indicated document
FileNode node = (FileNode)this.projectMgr.NodeFromItemId(itemid);
this.InvokeGenerator(node);
}
}
}
#endregion

#region virtual methods
///
/// Invokes the specified generator
///
/// The node on which to invoke the generator.
protected internal virtual void InvokeGenerator(FileNode fileNode)
{
if (fileNode == null)
{
throw new ArgumentNullException("node");
}

SingleFileGeneratorNodeProperties nodeproperties = fileNode.NodeProperties as SingleFileGeneratorNodeProperties;
if (nodeproperties == null)
{
throw new InvalidOperationException();
}

string customToolProgID = nodeproperties.CustomTool;
if (string.IsNullOrEmpty(customToolProgID))
{
return;
}

string customToolNamespace = nodeproperties.CustomToolNamespace;

try
{
if (!this.runningGenerator)
{
//Get the buffer contents for the current node
string moniker = fileNode.GetMkDocument();

this.runningGenerator = true;

//Get the generator
IVsSingleFileGenerator generator;
int generateDesignTimeSource;
int generateSharedDesignTimeSource;
int generateTempPE;
SingleFileGeneratorFactory factory = new SingleFileGeneratorFactory(this.projectMgr.ProjectGuid, this.projectMgr.Site);
ErrorHandler.ThrowOnFailure(factory.CreateGeneratorInstance(customToolProgID, out generateDesignTimeSource, out generateSharedDesignTimeSource, out generateTempPE, out generator));

//Check to see if the generator supports siting
IObjectWithSite objWithSite = generator as IObjectWithSite;
if (objWithSite != null)
{
objWithSite.SetSite(fileNode.OleServiceProvider);
}

//Determine the namespace
if (string.IsNullOrEmpty(customToolNamespace))
{
customToolNamespace = this.ComputeNamespace(moniker);
}

//Run the generator
IntPtr[] output = new IntPtr[1];
output[0] = IntPtr.Zero;
uint outPutSize;
string extension;
ErrorHandler.ThrowOnFailure(generator.DefaultExtension(out extension));

//Find if any dependent node exists
string dependentNodeName = Path.GetFileNameWithoutExtension(fileNode.FileName) + extension;
HierarchyNode dependentNode = fileNode.FirstChild;
while (dependentNode != null)
{
if (string.Compare(dependentNode.ItemNode.GetMetadata(ProjectFileConstants.DependentUpon), fileNode.FileName, StringComparison.OrdinalIgnoreCase) == 0)
{
dependentNodeName = ((FileNode)dependentNode).FileName;
break;
}

dependentNode = dependentNode.NextSibling;
}

//If you found a dependent node.
if (dependentNode != null)
{
//Then check out the node and dependent node from SCC
if (!this.CanEditFile(dependentNode.GetMkDocument()))
{
throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
}
}
else //It is a new node to be added to the project
{
// Check out the project file if necessary.
if (!this.projectMgr.QueryEditProjectFile(false))
{
throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
}
}
IVsTextStream stream;
string inputFileContents = this.GetBufferContents(moniker, out stream);

ErrorHandler.ThrowOnFailure(generator.Generate(moniker, inputFileContents, customToolNamespace, output, out outPutSize, this));
byte[] data = new byte[outPutSize];

if (output[0] != IntPtr.Zero)
{
Marshal.Copy(output[0], data, 0, (int)outPutSize);
Marshal.FreeCoTaskMem(output[0]);
}

//Todo - Create a file and add it to the Project
string fileToAdd = this.UpdateGeneratedCodeFile(fileNode, data, (int)outPutSize, dependentNodeName);
}
}
finally
{
this.runningGenerator = false;
}
}

///
/// Computes the names space based on the folder for the ProjectItem. It just replaces DirectorySeparatorCharacter
/// with "." for the directory in which the file is located.
///
/// Returns the computed name space
protected virtual string ComputeNamespace(string projectItemPath)
{
if (String.IsNullOrEmpty(projectItemPath))
{
throw new ArgumentException(SR.GetString(SR.ParameterCannotBeNullOrEmpty), "projectItemPath");
}


string nspace = "";
string filePath = Path.GetDirectoryName(projectItemPath);
string[] toks = filePath.Split(new char[] { ':', '\\' });
foreach (string tok in toks)
{
if (tok != "")
{
string temp = tok.Replace(" ", "");
nspace += (temp + ".");
}
}
nspace = nspace.Remove(nspace.LastIndexOf("."), 1);
return nspace;
}

///
/// This is called after the single file generator has been invoked to create or update the code file.
///
/// The node associated to the generator
/// data to update the file with
/// size of the data
/// Name of the file to update or create
/// full path of the file
protected virtual string UpdateGeneratedCodeFile(FileNode fileNode, byte[] data, int size, string fileName)
{
string filePath = Path.Combine(Path.GetDirectoryName(fileNode.GetMkDocument()), fileName);
IVsRunningDocumentTable rdt = this.projectMgr.GetService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable;

// (kberes) Shouldn't this be an InvalidOperationException instead with some not to annoying errormessage to the user?
if (rdt == null)
{
ErrorHandler.ThrowOnFailure(VSConstants.E_FAIL);
}

IVsHierarchy hier;
uint cookie;
uint itemid;
IntPtr docData = IntPtr.Zero;
ErrorHandler.ThrowOnFailure(rdt.FindAndLockDocument((uint)(_VSRDTFLAGS.RDT_NoLock), filePath, out hier, out itemid, out docData, out cookie));
if (docData != IntPtr.Zero)
{
Marshal.Release(docData);
IVsTextStream srpStream;
string inputFileContents = this.GetBufferContents(filePath, out srpStream);
if (srpStream != null)
{
int oldLen = 0;
int hr = srpStream.GetSize(out oldLen);
if (ErrorHandler.Succeeded(hr))
{
IntPtr dest = IntPtr.Zero;
try
{
dest = Marshal.AllocCoTaskMem(data.Length);
Marshal.Copy(data, 0, dest, data.Length);
ErrorHandler.ThrowOnFailure(srpStream.ReplaceStream(0, oldLen, dest, size / 2));
}
finally
{
if (dest != IntPtr.Zero)
{
Marshal.Release(dest);
}
}
}
}
}
else
{
using (FileStream generatedFileStream = File.Open(filePath, FileMode.OpenOrCreate))
{
generatedFileStream.Write(data, 0, size);
}

EnvDTE.ProjectItem projectItem = fileNode.GetAutomationObject() as EnvDTE.ProjectItem;
if (projectItem != null && (this.projectMgr.FindChild(fileNode.FileName) == null))
{
projectItem.ProjectItems.AddFromFile(filePath);
}
}
return filePath;
}
#endregion

#region helpers
///
/// Returns the buffer contents for a moniker.
///
/// Buffer contents
private string GetBufferContents(string fileName, out IVsTextStream srpStream)
{
Guid CLSID_VsTextBuffer = new Guid("{8E7B96A8-E33D-11d0-A6D5-00C04FB67F6A}");
string bufferContents = "";
srpStream = null;

IVsRunningDocumentTable rdt = this.projectMgr.GetService(typeof(SVsRunningDocumentTable)) as IVsRunningDocumentTable;
if (rdt != null)
{
IVsHierarchy hier;
IVsPersistDocData persistDocData;
uint itemid, cookie;
bool docInRdt = true;
IntPtr docData = IntPtr.Zero;
int hr = NativeMethods.E_FAIL;
try
{
//Getting a read lock on the document. Must be released later.
hr = rdt.FindAndLockDocument((uint)_VSRDTFLAGS.RDT_ReadLock, fileName, out hier, out itemid, out docData, out cookie);
if (ErrorHandler.Failed(hr) || docData == IntPtr.Zero)
{
Guid iid = VSConstants.IID_IUnknown;
cookie = 0;
docInRdt = false;
ILocalRegistry localReg = this.projectMgr.GetService(typeof(SLocalRegistry)) as ILocalRegistry;
ErrorHandler.ThrowOnFailure(localReg.CreateInstance(CLSID_VsTextBuffer, null, ref iid, (uint)CLSCTX.CLSCTX_INPROC_SERVER, out docData));
}

persistDocData = Marshal.GetObjectForIUnknown(docData) as IVsPersistDocData;
}
finally
{
if (docData != IntPtr.Zero)
{
Marshal.Release(docData);
}
}

//Try to get the Text lines
IVsTextLines srpTextLines = persistDocData as IVsTextLines;
if (srpTextLines == null)
{
// Try getting a text buffer provider first
IVsTextBufferProvider srpTextBufferProvider = persistDocData as IVsTextBufferProvider;
if (srpTextBufferProvider != null)
{
hr = srpTextBufferProvider.GetTextBuffer(out srpTextLines);
}
}

if (ErrorHandler.Succeeded(hr))
{
srpStream = srpTextLines as IVsTextStream;
if (srpStream != null)
{
// QI for IVsBatchUpdate and call FlushPendingUpdates if they support it
IVsBatchUpdate srpBatchUpdate = srpStream as IVsBatchUpdate;
if (srpBatchUpdate != null)
srpBatchUpdate.FlushPendingUpdates(0);

int lBufferSize = 0;
hr = srpStream.GetSize(out lBufferSize);

if (ErrorHandler.Succeeded(hr))
{
IntPtr dest = IntPtr.Zero;
try
{
// Note that GetStream returns Unicode to us so we don't need to do any conversions
dest = Marshal.AllocCoTaskMem((lBufferSize + 1) * 2);
ErrorHandler.ThrowOnFailure(srpStream.GetStream(0, lBufferSize, dest));
//Get the contents
bufferContents = Marshal.PtrToStringUni(dest);
}
finally
{
if (dest != IntPtr.Zero)
Marshal.FreeCoTaskMem(dest);
}
}
}

}
// Unlock the document in the RDT if necessary
if (docInRdt && rdt != null)
{
ErrorHandler.ThrowOnFailure(rdt.UnlockDocument((uint)(_VSRDTFLAGS.RDT_ReadLock | _VSRDTFLAGS.RDT_Unlock_NoSave), cookie));
}

if (ErrorHandler.Failed(hr))
{
// If this failed then it's probably not a text file. In that case,
// we just read the file as a binary
bufferContents = File.ReadAllText(fileName);
}


}
return bufferContents;
}

///
/// Returns TRUE if open and dirty. Note that documents can be open without a
/// window frame so be careful. Returns the DocData and doc cookie if requested
///
/// document path
/// hierarchy
/// doc data associated with document
/// item cookie
/// True if FIle is dirty
private bool VerifyFileDirtyInRdt(string document, out IVsHierarchy pHier, out IVsPersistDocData ppDocData, out uint cookie)
{
int ret = 0;
pHier = null;
ppDocData = null;
cookie = 0;

IVsRunningDocumentTable rdt = this.projectMgr.GetService(typeof(IVsRunningDocumentTable)) as IVsRunningDocumentTable;
if (rdt != null)
{
IntPtr docData;
uint dwCookie = 0;
IVsHierarchy srpHier;
uint itemid = VSConstants.VSITEMID_NIL;

ErrorHandler.ThrowOnFailure(rdt.FindAndLockDocument((uint)_VSRDTFLAGS.RDT_NoLock, document, out srpHier, out itemid, out docData, out dwCookie));
IVsPersistHierarchyItem srpIVsPersistHierarchyItem = srpHier as IVsPersistHierarchyItem;
if (srpIVsPersistHierarchyItem != null)
{
// Found in the RDT. See if it is dirty
try
{
ErrorHandler.ThrowOnFailure(srpIVsPersistHierarchyItem.IsItemDirty(itemid, docData, out ret));
cookie = dwCookie;
ppDocData = Marshal.GetObjectForIUnknown(docData) as IVsPersistDocData;
}
finally
{
if (docData != IntPtr.Zero)
{
Marshal.Release(docData);
}

pHier = srpHier;
}
}
}
return (ret == 1);
}
#endregion




#region QueryEditQuerySave helpers
///
/// This function asks to the QueryEditQuerySave service if it is possible to
/// edit the file.
///
private bool CanEditFile(string documentMoniker)
{
Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "\t**** CanEditFile called ****"));

// Check the status of the recursion guard
if (this.gettingCheckoutStatus)
{
return false;
}

try
{
// Set the recursion guard
this.gettingCheckoutStatus = true;

// Get the QueryEditQuerySave service
IVsQueryEditQuerySave2 queryEditQuerySave = (IVsQueryEditQuerySave2)this.projectMgr.GetService(typeof(SVsQueryEditQuerySave));

// Now call the QueryEdit method to find the edit status of this file
string[] documents = { documentMoniker };
uint result;
uint outFlags;

// Note that this function can popup a dialog to ask the user to checkout the file.
// When this dialog is visible, it is possible to receive other request to change
// the file and this is the reason for the recursion guard.
int hr = queryEditQuerySave.QueryEditFiles(
0, // Flags
1, // Number of elements in the array
documents, // Files to edit
null, // Input flags
null, // Input array of VSQEQS_FILE_ATTRIBUTE_DATA
out result, // result of the checkout
out outFlags // Additional flags
);

if (ErrorHandler.Succeeded(hr) && (result == (uint)tagVSQueryEditResult.QER_EditOK))
{
// In this case (and only in this case) we can return true from this function.
return true;
}
}
finally
{
this.gettingCheckoutStatus = false;
}

return false;
}
#endregion
}
}

Index: ReferenceNode.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ReferenceNode.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ReferenceNode.cs 4 Oct 2006 08:07:33 -0000 1.2
--- ReferenceNode.cs 27 Jun 2007 05:38:35 -0000 1.3
***************
*** 32,37 ****
[CLSCompliant(false), ComVisible(true)]
public abstract class ReferenceNode : HierarchyNode
! {
! protected delegate void CannotAddReferenceErrorMessage();
#region ctor

--- 32,37 ----
[CLSCompliant(false), ComVisible(true)]
public abstract class ReferenceNode : HierarchyNode
! {
! protected delegate void CannotAddReferenceErrorMessage();
#region ctor

***************
*** 115,120 ****
{
int offset = (this.CanShowDefaultIcon() ? (int)ProjectNode.ImageName.Reference : (int)ProjectNode.ImageName.DanglingReference);
! return PackageUtilities.GetIntPointerFromImage(this.ProjectMgr.ImageList.Images[offset]);
! }

///
--- 115,120 ----
{
int offset = (this.CanShowDefaultIcon() ? (int)ProjectNode.ImageName.Reference : (int)ProjectNode.ImageName.DanglingReference);
! return this.ProjectMgr.ImageHandler.GetIconHandle(offset);
! }

///

Index: ProjectFactory.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/ProjectFactory.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ProjectFactory.cs 20 Sep 2006 10:43:21 -0000 1.1
--- ProjectFactory.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 137,141 ****
IProjectEventsProvider eventsProvider = (IProjectEventsProvider)Marshal.GetTypedObjectForIUnknown(project, typeof(IProjectEventsProvider));
eventsProvider.ProjectEventsProvider = this.GetProjectEventsProvider();
- eventsProvider.SubscibeToProjectEvents();

this.buildProject = null;
--- 137,140 ----

Index: IDEBuildLogger.cs
===================================================================
RCS file: /cvsroot/wix/wix/src/votive/SDK/Common/Source/CSharp/Project/IDEBuildLogger.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** IDEBuildLogger.cs 20 Sep 2006 10:43:20 -0000 1.1
--- IDEBuildLogger.cs 27 Jun 2007 05:38:35 -0000 1.2
***************
*** 116,119 ****
--- 116,123 ----
public override void Initialize(IEventSource eventSource)
{
+ if (null == eventSource)
+ {
+ throw new ArgumentNullException("eventSource");
+ }
eventSource.BuildStarted += new BuildStartedEventHandler(BuildStartedHandler);
eventSource.BuildFinished += new BuildFinishedEventHandler(BuildFinishedHandler);
***************
*** 428,435 ****
{
StringBuilder msg = new StringBuilder(this.currentIndent + buildEvent.Message.Length + 1);
! for (int i = 0; i < this.currentIndent; ++i)
! msg.Append("\t");
! msg.Append(buildEvent.Message);
! msg.Append(Environment.NewLine);
this.OutputWindowPane.OutputStringThreadSafe(msg.ToString());
}
--- 432,440 ----
{
StringBuilder msg = new StringBuilder(this.currentIndent + buildEvent.Message.Length + 1);
! if (this.currentIndent > 0)
! {
! msg.Append('\t', this.currentIndent);
! }
! msg.AppendLine(buildEvent.Message);
this.OutputWindowPane.OutputStringThreadSafe(msg.ToString());
}
***************
*** 454,467 ****

string errCode = (e.IsWarning) ? this.warningString : this.errorString;
! string fileRef = e.FileName;

! if (fileRef == null)
! fileRef = String.Empty;
! else if (fileRef.Length != 0)
{
! fileRef += "(" + e.Line + "," + e.Column + "): ";
}

! return fileRef + String.Format(CultureInfo.CurrentCulture, "{0} {1}", errCode, e.ErrorNumber) + ": " + e.ErrorText;
}

--- 459,472 ----

string errCode = (e.IsWarning) ? this.warningString : this.errorString;
! StringBuilder fileRef = new StringBuilder();

! if (!string.IsNullOrEmpty(e.FileName))
{
! fileRef.AppendFormat(CultureInfo.CurrentUICulture, "{0}({1},{2})",
! e.FileName, e.Line, e.Column);
}
+ fileRef.AppendFormat(CultureInfo.CurrentUICulture, "{0} {1}: ", errCode, e.ErrorNumber, e.ErrorText);

! return fileRef.ToString();
}

***************
*** 480,485 ****
StringBuilder sb = new StringBuilder(message.Length + Environment.NewLine.Length);

! sb.Append(message);
! sb.Append(Environment.NewLine);
return sb.ToString();
}
--- 485,489 ----
StringBuilder sb = new StringBuilder(message.Length + Environment.NewLine.Length);

! sb.AppendLine(message);
return sb.ToString();
}




------------------------------

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

------------------------------

_______________________________________________
Wix-commits mailing list

https://lists.sourceforge.net/lists/listinfo/wix-commits


End of Wix-commits Digest, Vol 11, Issue 28
*******************************************