Show only top-level resources in combox

Oct 21, 2013 at 1:40 PM
The "Resource file:" combox can contain rather a lot of resources when you a couple of language resources and quite a number of forms.

My suggestion is that only the top-level resources in the project is shown in the combo-box.

I have implemented this, I have modified the method IsValidResourceFile in ExtractResourceActionBase to be like this:
    public virtual bool IsValidResourceFile(EnvDTE.ProjectItem item) {
        if (item == null) return false;
        try {

            if (item.Properties.Item("Extension").Value.ToString().Equals(".resx", StringComparison.InvariantCultureIgnoreCase)) {                    
                if (item.Properties.Item("ItemType").Value.Equals("EmbeddedResource")) 
                {
                    bool ret = true;
                    if (item.Properties.Item("IsDependentFile").Value is bool)
                    {
                        ret = !(bool)item.Properties.Item("IsDependentFile").Value;
                    }
                    return ret;
                }
            }
            return false;
        } catch (ArgumentException) {
            // This can happen if item does not contain the properties we are looking for.
            return false;
        }
    }