Exemplo n.º 1
0
        public static bool AreContextMenuCommandsEnabled()
        {
            if (IsOpenFolderModeActive())
            {
                return(true);
            }

            ItemsCollector itemCollector = new ItemsCollector();

            itemCollector.CollectSelectedItems();
            List <string> selectedItems = new List <string>();

            if (itemCollector.IsEmpty)
            {
                return(false);
            }

            itemCollector.Items.ForEach(e => selectedItems.Add(e.GetName()));

            if (selectedItems.Count == 0)
            {
                return(false);
            }

            foreach (var item in selectedItems)
            {
                var fileExtension = Path.GetExtension(item).ToLower();
                if (ScriptConstants.kAcceptedFileExtensions.Contains(fileExtension))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        internal static bool AreContextMenuCommandsEnabled()
        {
            if (IsOpenFolderModeActive())
            {
                return(true);
            }

            ItemsCollector itemCollector = new ItemsCollector();

            itemCollector.CollectSelectedItems();
            List <string> selectedItems = new List <string>();

            if (itemCollector.HaveItems == false)
            {
                return(false);
            }
            itemCollector.Items.ForEach(i => selectedItems.Add(i.GetName()));

            if (selectedItems.Count == 0)
            {
                return(false);
            }

            var extensions = ScriptConstants.kAcceptedFileExtensions;

            extensions.Add(".vcxproj");

            foreach (var item in selectedItems)
            {
                var fileExtension = Path.GetExtension(item).ToLower();
                if (extensions.Contains(fileExtension))
                {
                    return(true);
                }
            }

            return(false);
        }