コード例 #1
0
        private void Excute(object sender, EventArgs e)
        {
            lstExcludeEndsWith = dte.GetValue("ExcludeEndsWith");
            count = 0;

            selectedMenu = (PkgCmdIDList)((MenuCommand)sender).CommandID.ID;

            var table = new RunningDocumentTable(this);

            lstAlreadyOpenFiles = (from info in table select info.Moniker).ToList <string>();

            var selectedItem = dte.SelectedItems.Item(1);

            WriteLog("\r\n====================================================================================");
            WriteLog("Start :" + DateTime.Now.ToString());

            Stopwatch sp = new Stopwatch();

            sp.Start();

            if (selectedItem.Project == null && selectedItem.ProjectItem == null)
            {
                ProcessSolution();
            }
            else if (selectedItem.Project != null)
            {
                ProcessProject(selectedItem.Project);
            }
            else if (selectedItem.ProjectItem != null)
            {
                if (selectedItem.ProjectItem.ProjectItems.Count > 0)
                {
                    ProcessProjectItem(selectedItem.ProjectItem);
                    ProcessProjectItems(selectedItem.ProjectItem.ProjectItems);
                }
                else
                {
                    ProcessProjectItem(selectedItem.ProjectItem);
                }
            }
            sp.Stop();

            WriteLog(string.Format("Finish:{0}  Times:{1}s  Files:{2}", DateTime.Now.ToString(), sp.ElapsedMilliseconds / 1000, count - 2));
            dte.ExecuteCommand("View.Output");
            myOutPane.Activate();
        }