コード例 #1
0
ファイル: SA1505.cs プロジェクト: rafflesgun/StyleRepair
        public static void Run(DTE dte, VsError selectedError)
        {
            selectedError.Navigate();
            var ep = ErrorUtilities.GetEditPoint(dte);

            ep.LineDown();
            ep.Delete(1);
        }
コード例 #2
0
ファイル: SA1513.cs プロジェクト: rafflesgun/StyleRepair
        public static void Run(DTE dte, VsError selectedError)
        {
            selectedError.Navigate();
            EditPoint2 ep = ErrorUtilities.GetEditPoint(dte);

            ep.LineDown();
            ep.StartOfLine();
            ep.InsertNewLine();
        }
コード例 #3
0
        public static void Run(DTE dte, VsError selectedError)
        {
            selectedError.Navigate();
            var ep = ErrorUtilities.GetEditPoint(dte);

            ep.LineUp();
            while (ep.LineLength == 0)
            {
                ep.Delete(1);
                ep.LineUp();
            }
        }
コード例 #4
0
        public static void Run(DTE dte, VsError error)
        {
            error.Navigate();
            EditPoint2 ep = ErrorUtilities.GetEditPoint(dte);

            ep.StartOfLine();
            string variableName  = error.Description.Split(" ".ToCharArray())[7];
            string replaceString = ep.GetLines(ep.Line, ep.Line + 1);

            replaceString = Regex.Replace(replaceString, string.Format(@"(\s|\(|\!)({0})(\W)", variableName), "$1this.$2$3",
                                          RegexOptions.None);
            ep.ReplaceText(ep.LineLength, replaceString, (int )vsEPReplaceTextOptions.vsEPReplaceTextAutoformat);
        }
コード例 #5
0
        /// <summary>
        /// Fix error SA1600
        /// </summary>
        /// <param name="dte">Current design environment</param>
        /// <param name="selectedError">Error selected by the user to fix.</param>
        public static void Run(DTE dte, VsError selectedError)
        {
            EditPoint2 ep = ErrorUtilities.GetEditPoint(dte);

            selectedError.Navigate();
            var selection       = (TextSelection)dte.ActiveDocument.Selection;
            var propertyElement = (CodeProperty)selection.ActivePoint.CodeElement[vsCMElement.vsCMElementProperty];

            if (propertyElement != null)
            {
                ProcessPropertyUpdate(propertyElement, ep);
            }
        }
コード例 #6
0
ファイル: SA1027.cs プロジェクト: rafflesgun/StyleRepair
        public static void Run(DTE dte, VsError selectedError)
        {
            selectedError.Navigate();
            EditPoint2 ep = ErrorUtilities.GetEditPoint(dte);

            ep.StartOfLine();
            string testString = ep.GetLines(ep.Line, ep.Line + 1);

            if (Regex.Match(testString, @"\t").Success)
            {
                testString = Regex.Replace(testString, @"\t", @"    ");
                ep.ReplaceText(ep.LineLength, testString, (int)vsEPReplaceTextOptions.vsEPReplaceTextAutoformat);
            }
        }
コード例 #7
0
        public static void Run(DTE dte, VsError selectedError)
        {
            selectedError.Navigate();
            EditPoint2 ep = ErrorUtilities.GetEditPoint(dte);

            ep.StartOfLine();
            string editLine = ep.GetLines(ep.Line, ep.Line + 1);

            editLine = editLine.Replace(";", "");
            string varName = string.Empty;

            if (editLine.IndexOf("=") > -1)
            {
                varName = editLine.Split("=".ToCharArray()).First().Split(" ".ToCharArray()).Where(item => item.Length > 0).Last();
            }
            else
            {
                varName = editLine.Split(" ".ToCharArray()).Last();
            }
            ep.Parent.Selection.CharRight(Count: editLine.IndexOf(varName));
            dte.ExecuteCommand("Refactor.Rename");
            //// todo
        }
コード例 #8
0
        public static void Run(DTE dte, VsError selectedError)
        {
            selectedError.Navigate();
            EditPoint2 editPoint = ErrorUtilities.GetEditPoint(dte);

            editPoint.StartOfDocument();
            string fileName = selectedError.FileName.Substring(
                selectedError.FileName.LastIndexOf(@"\") + 1,
                selectedError.FileName.Length - (selectedError.FileName.LastIndexOf(@"\") + 1));

            editPoint.InsertNewLine();
            editPoint.StartOfDocument();
            editPoint.Insert(
                string.Format(
                    @"//-----------------------------------------------------------------------
// <copyright file=""{0}"" company=""{1}"">
//     {2}
// </copyright>
//-----------------------------------------------------------------------",
                    fileName,
                    StyleRepair.Properties.StyleRepair.Default.CompanyName,
                    StyleRepair.Properties.StyleRepair.Default.CopyrightMessage));
        }