/// <summary>
        /// Public method to paste format clipboard text into a specified region
        /// </summary>
        /// <param name="application">application to insert</param>
        public void PasteAsRegion(DTE2 application)
        {
            //get the region name
            const string region = "myRegion";

            //it's so simple, we really don't need a function
            string csRegionized = "#region " + region + Environment.NewLine + SmartFormatter.LimparTexto(ClipboardText) + Environment.NewLine + "#endregion";

            //and paste
            Paste(application, csRegionized);
        }
Example #2
0
        /// <summary>
        /// Public method to paste and format clipboard text as comment the cursor
        /// location for the configured or active window's langage .
        /// </summary>
        /// <param name="application">application to insert</param>
        public void PasteAsComment(DTE2 application)
        {
            string text;

            if (IsVb(application))
            {
                text = SmartFormatter.CommentizeInVb(ClipboardText);
            }
            else if (IsXml(application))
            {
                text = SmartFormatter.CommentizeInXml(ClipboardText);
            }
            else
            {
                text = SmartFormatter.CommentizeInCs(ClipboardText);
            }
            Paste(application, text);
        }
        /// <summary>
        /// Public method to paste and format clipboard text as string the cursor
        /// location for the configured or active window's langage .
        /// </summary>
        /// <param name="application">application to insert</param>
        public void PasteAsString(DTE2 application)
        {
            string text;

            if (IsVb(application))
            {
                text = SmartFormatter.LiterallyInVb(ClipboardText);
            }
            else if (IsCs(application))
            {
                text = SmartFormatter.LiterallyInCs(ClipboardText);
            }
            else if (IsCxx(application))
            {
                text = SmartFormatter.LiterallyInCxx(ClipboardText);
            }
            else
            {
                text = ClipboardText;
            }
            Paste(application, text);
        }
        /// <summary>
        /// Pastes as verbatim string.
        /// </summary>
        /// <param name="application">The application.</param>
        public void PasteAsVerbatimString(DTE2 application)
        {
            if (IsVb(application))
            {
                //vb14 has verbatim strings, otherwise do the CData trick
                int version;
                var appVersion = application.Version;
                var p          = appVersion.IndexOf('.'); //12.0 in VS2013, but MSDN says dp is optional
                if (p > 0)
                {
                    appVersion = appVersion.Substring(0, p);
                }

                int.TryParse(appVersion, out version);

                Paste(application,
                      version < 14
                        ? SmartFormatter.CDataizeInVb(ClipboardText)
                        : SmartFormatter.StringinizeInVb(ClipboardText));
                return;
            }
            //c#
            Paste(application, SmartFormatter.StringinizeInCs(ClipboardText));
        }
 public void PasteAsLowerCamelCase(DTE2 application)
 {
     Paste(application, TranformaEmNotacaoCameloMinuscula(SmartFormatter.LimparTexto(RemoverAcentos(ClipboardText))));
 }