Exemplo n.º 1
0
        /// <summary>
        /// File has been added.
        /// Maybe we need to update it's type.
        /// </summary>
        private void OnFileAdded(object sender, ProjectDocumentsChangeEventArgs e)
        {
            var  mkDocument = e.MkDocument;
            uint itemId;

            if (!ErrorHandler.Succeeded(ParseCanonicalName(e.MkDocument, out itemId)))
            {
                return;
            }
            if (!File.Exists(mkDocument))
            {
                return;
            }
            string itemType;
            var    frameworkFolder = GetFrameworkFolder();

            if (!ItemTypeDetector.TryDetectItemType(mkDocument, frameworkFolder, out itemType))
            {
                return;
            }
            // Found item type, set it
            var pItem = _innerVsHierarchy.GetProjectItemFromHierarchy(itemId);

            pItem.Properties.Item("ItemType").Value = itemType;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Detect item type.
        /// </summary>
        public override ItemType GetDefaultItemType(string fileName)
        {
            string itemType;
            var    frameworkFolder = GetFrameworkFolder();

            if (ItemTypeDetector.TryDetectItemType(fileName, frameworkFolder, out itemType))
            {
                return(new ItemType(itemType));
            }
            return(base.GetDefaultItemType(fileName));
        }