Пример #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);
        }
 /// <summary>
 /// This function is the callback used to execute the command when the menu item is clicked.
 /// See the constructor to see how the menu item is associated with this function using
 /// OleMenuCommandService service and MenuCommand class.
 /// </summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">Event args.</param>
 public void RunIgnoreFormatCommand(int aId)
 {
     var task = System.Threading.Tasks.Task.Run(() =>
     {
         List <string> documentsToIgnore = ItemsCollector.GetDocumentsToIgnore();
         AddIgnoreFilesToSettings(documentsToIgnore);
     });
 }
Пример #3
0
 /// <summary>
 /// This function is the callback used to execute the command when the menu item is clicked.
 /// See the constructor to see how the menu item is associated with this function using
 /// OleMenuCommandService service and MenuCommand class.
 /// </summary>
 /// <param name="sender">Event sender.</param>
 /// <param name="e">Event args.</param>
 public void RunIgnoreCompileCommand(int aId)
 {
     var task = Task.Run(() =>
     {
         List <string> documentsToIgnore = ItemsCollector.GetDocumentsToIgnore();
         AddIgnoreFilesToSettings(documentsToIgnore);
     });
 }
Пример #4
0
        private void FormatActiveDocument()
        {
            ItemsCollector itemsCollector = new ItemsCollector();

            itemsCollector.CollectActiveProjectItem();

            var document = (itemsCollector.items[0].GetObject() as ProjectItem).Document;

            mDocument = document;
            ExecuteFormatCommand();
        }
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        public void RunIgnoreFormatCommand()
        {
            _ = Task.Run(() =>
            {
                ItemsCollector itemsCollector   = new ItemsCollector();
                SettingsHandler settingsHandler = new SettingsHandler();

                var settings = SettingsProvider.FormatSettingsModel;
                List <string> documentsToIgnore = itemsCollector.GetFilesToIgnore();

                AddItemsToIgnore(documentsToIgnore, settings, "FilesToIgnore");
                settingsHandler.SaveSettings();
            });
        }
Пример #6
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        public void RunIgnoreCompileCommand()
        {
            _ = Task.Run(() =>
            {
                var settingsHandler            = new SettingsHandler();
                var itemsCollector             = new ItemsCollector();
                List <string> projectsToIgnore = itemsCollector.GetProjectsToIgnore();

                var settingsModel = SettingsProvider.CompilerSettingsModel;
                AddItemsToIgnore(projectsToIgnore, settingsModel, "ProjectsToIgnore");
                if (projectsToIgnore.Any() == false)
                {
                    List <string> filesToIgnore = itemsCollector.GetFilesToIgnore();
                    AddItemsToIgnore(filesToIgnore, settingsModel, "FilesToIgnore");
                    settingsHandler.SaveSettings();
                }
            });
        }
Пример #7
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        public void RunIgnoreFormatCommand()
        {
            _ = Task.Run(() =>
            {
                SettingsProvider settingsProvider       = new SettingsProvider();
                FormatSettingsModel formatSettingsModel = settingsProvider.GetFormatSettingsModel();
                string filesToIgnore = formatSettingsModel.FilesToIgnore;

                if (filesToIgnore.Length > 0)
                {
                    ItemsCollector itemsCollector   = new ItemsCollector();
                    List <string> documentsToIgnore = itemsCollector.GetFilesToIgnore();
                    SettingsHandler settingsHandler = new SettingsHandler();

                    FormatSettingsModel settings = formatSettingsModel;
                    AddItemsToIgnore(documentsToIgnore, settings, "FilesToIgnore");
                    settingsHandler.SaveSettings();
                }
            });
        }
Пример #8
0
        private void Start()
        {
            random = CreateSeed();

            bonusRegisterer = ship.GetComponent <ItemsCollector>();

            LevelList structure = LevelSettings.GetStructureOfPieces();

            if (structure == null)
            {
                pieces = new List <LevelPiece>();
                pieces.Add(new LevelPiece("EmptyPiece"));
            }
            else
            {
                pieces = RemoveNotSelected(LevelSettings.GetStructureOfPieces().levels);
            }

            piecePosition = new Vector3();
            lastPosition  = GenerateChunk(ship.position.x, 0);
        }
Пример #9
0
        public static bool AreToolbarCommandsEnabled()
        {
            if (IsOpenFolderModeActive())
            {
                return(true);
            }

            ItemsCollector itemCollector = new ItemsCollector();

            itemCollector.CollectActiveProjectItem();

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

            string activeItem    = itemCollector.Items[0].GetName().ToLower();
            var    fileExtension = Path.GetExtension(activeItem);

            return(ScriptConstants.kAcceptedFileExtensions.Contains(fileExtension));
        }
Пример #10
0
        private void FormatAllSelectedDocuments()
        {
            ItemsCollector itemsCollector = new ItemsCollector();

            itemsCollector.CollectSelectedProjectItems();
            List <Document> activeDocs     = DocumentHandler.GetListOfActiveDocuments();
            Document        activeDocument = DocumentHandler.GetActiveDocument();

            foreach (var item in itemsCollector.Items)
            {
                try
                {
                    var projectItem = item.GetObject() as ProjectItem;
                    mDocument = projectItem.Open().Document;
                    ExecuteFormatCommand();

                    if (DocumentHandler.IsOpen(mDocument, activeDocs))
                    {
                        mDocument.Save();
                    }
                    else
                    {
                        mDocument.Close(vsSaveChanges.vsSaveChangesYes);
                    }
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    mDocument = null;
                }
            }
            if (activeDocument != null)
            {
                activeDocument.Activate();
            }
        }
Пример #11
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);
        }
Пример #12
0
        internal static bool AreToolbarCommandsEnabled()
        {
            if (IsOpenFolderModeActive())
            {
                return(true);
            }

            ItemsCollector itemCollector = new ItemsCollector();

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

            if (itemCollector.HaveItems == false)
            {
                return(false);
            }

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

            var fileExtension = Path.GetExtension(selectedItems.FirstOrDefault()).ToLower();

            return(ScriptConstants.kAcceptedFileExtensions.Contains(fileExtension));
        }