protected int IsFlavorDirty()
{
var isDirty = 0;
// See if one of our flavor consider us dirty
var outerHierarchy = InteropSafeIVsHierarchy as IPersistXMLFragment;
if (outerHierarchy != null)
{
// First check the project
ErrorHandler.ThrowOnFailure(outerHierarchy.IsFragmentDirty((uint) _PersistStorageType.PST_PROJECT_FILE,
out isDirty));
// While we don't yet support user files, our flavors might, so we will store that in the project file until then
// TODO: Refactor this code when we support user files
if (isDirty == 0)
ErrorHandler.ThrowOnFailure(outerHierarchy.IsFragmentDirty(
(uint) _PersistStorageType.PST_USER_FILE, out isDirty));
}
if (isDirty == 0)
{
// Then look at the configurations
var count = new uint[1];
var hr = ConfigProvider.GetCfgs(0, null, count, null);
if (ErrorHandler.Succeeded(hr) && count[0] > 0)
{
// We need to loop through the configurations
var configs = new IVsCfg[count[0]];
hr = ConfigProvider.GetCfgs((uint) configs.Length, configs, count, null);
Debug.Assert(ErrorHandler.Succeeded(hr), "failed to retrieve configurations");
foreach (var config in configs)
{
isDirty = ((ProjectConfig) config).IsFlavorDirty(_PersistStorageType.PST_PROJECT_FILE);
if (isDirty != 0)
break;
}
}
}
return isDirty;
}