Exemple #1
0
        private void menuItem39_Click(object sender, EventArgs e)
        {
            // Format Selection
            AutoFormatter autoFormatter = new AutoFormatter();

            this.numberedTextBoxUC1.TextBox.SelectedText =
                autoFormatter.ApplyFormatting(this.numberedTextBoxUC1.TextBox.SelectedText);
        }
Exemple #2
0
 private string RemoveComments(string strC)
 {
     if (Properties.Settings.Default.CommentCStyle)
     {
         int intI = strC.IndexOf("/*");
         while (intI > 0)
         {
             int intJ = strC.IndexOf("*" + "/", intI);
             if (intJ < 0)
             {
                 break;
             }
             strC = strC.Remove(intI, intJ - intI + 2);
             intI = strC.IndexOf("/*");
         }
     }
     return(AutoFormatter.RemoveCommentsFromLines(strC));
 }
        public static string GetNewWhiteSpace(string[] lines, int intIndex)
        {
            int           intTab  = 0;
            int           intOnce = 0;
            string        strLine = "";
            StringBuilder sb      = new StringBuilder();

            while (intIndex >= 0 && intIndex < lines.Length)
            {
                strLine = lines[intIndex];
                if (TrimCommentTrim(strLine).Length > 0)
                {
                    intTab = GetTabCountFromLine(strLine, out intOnce);
                    break;
                }
                intIndex--;
            }

            if (TrimCommentTrim(strLine) != "{")
            {
                intIndex--;
                while (intIndex >= 0 && intIndex < lines.Length)
                {
                    strLine = lines[intIndex];
                    if (TrimCommentTrim(strLine).Length > 0)
                    {
                        GetTabCountFromLine(strLine, out intOnce);
                        break;
                    }
                    intIndex--;
                }
            }

            for (int intI = 0; intI < (intTab - intOnce); intI++)
            {
                sb.Append(AutoFormatter.GetTab());
            }

            return(sb.ToString());
        }