コード例 #1
0
 public TSqlStandardFormatterTests()
 {
     _tokenizer = new TSqlStandardTokenizer();
     _parser = new TSqlStandardParser();
     _treeFormatter = new TSqlStandardFormatter();
     _treeFormatter.HTMLColoring = false;
 }
 public TSqlObfuscatingFormatterTests()
 {
     _tokenizer = new TSqlStandardTokenizer();
     _parser = new TSqlStandardParser();
     _standardFormatter = new TSqlStandardFormatter("\t", 4, 999, true, true, false, true, true, true, false, true, false, true);
     _obfuscatingFormatter = new TSqlObfuscatingFormatter();
 }
コード例 #3
0
 public TSqlIdentityFormatterTest()
 {
     _tokenizer = new TSqlStandardTokenizer();
     _parser = new TSqlStandardParser();
     _tokenFormatter = new TSqlIdentityFormatter();
     _treeFormatter = (ISqlTreeFormatter)_tokenFormatter;
 }
コード例 #4
0
 public TSqlObfuscatingFormatterTests()
 {
     _tokenizer            = new TSqlStandardTokenizer();
     _parser               = new TSqlStandardParser();
     _standardFormatter    = new TSqlStandardFormatter("\t", 4, 999, true, true, false, true, true, true, false, true, false, true);
     _obfuscatingFormatter = new TSqlObfuscatingFormatter();
 }
コード例 #5
0
 public TSqlIdentityFormatterTest()
 {
     _tokenizer      = new TSqlStandardTokenizer();
     _parser         = new TSqlStandardParser();
     _tokenFormatter = new TSqlIdentityFormatter();
     _treeFormatter  = (ISqlTreeFormatter)_tokenFormatter;
 }
コード例 #6
0
 public TSqlStandardFormatterTests()
 {
     _tokenizer     = new TSqlStandardTokenizer();
     _parser        = new TSqlStandardParser();
     _treeFormatter = new TSqlStandardFormatter();
     _treeFormatter.HTMLColoring = false;
 }
コード例 #7
0
 public TSqlIdentityFormatterTest()
 {
     _tokenizer      = new TSqlStandardTokenizer();
     _parser         = new TSqlStandardParser();
     _tokenFormatter = new TSqlIdentityFormatter();
     _treeFormatter  = (ISqlTreeFormatter)_tokenFormatter;
     _tokenFormatter.ErrorOutputPrefix = "";
 }
コード例 #8
0
ファイル: MainForm.cs プロジェクト: yanzj/SqlFormat
        public MainForm()
        {
            this.StartPosition = FormStartPosition.CenterScreen;
            InitializeComponent();

            formatUserControl   = CreateUserControl("SQL格式调整");
            parseLogUserControl = CreateUserControl("SQL解析记录");
            accordionControl.SelectedElement = formatAccordionControlElement;

            _tokenizer = new BaiSqlFormatLib.Tokenizers.TSqlStandardTokenizer();
            _parser    = new BaiSqlFormatLib.Parsers.TSqlStandardParser();

            if (Properties.Settings.Default.chkdefault)
            {
                ts_default.EditValue = true;

                chk_addSemicolon.Enabled      = false;
                txt_maxWidth.Enabled          = false;
                chk_columnNotNewline.Enabled  = false;
                chk_keywordAlign.Enabled      = false;
                chk_conditionNewline.Enabled  = false;
                chk_expandCase.Enabled        = false;
                chk_expandBetween.Enabled     = false;
                chk_expandIn.Enabled          = false;
                chk_expandOn.Enabled          = false;
                chk_uppercaseKeywords.Enabled = false;
                chk_allUpper.Enabled          = false;
                chk_coloring.Enabled          = false;
                chk_allIndent.Enabled         = false;
                chk_asAlign.Enabled           = false;
                txt_asMaxWidth.Enabled        = false;
            }
            else
            {
                ts_custom.EditValue = true;
            }

            txt_maxWidth.Text             = Properties.Settings.Default.MaxLineWidth.ToString();
            chk_columnNotNewline.Checked  = !Properties.Settings.Default.ExpandCommaLists;
            chk_keywordAlign.Checked      = Properties.Settings.Default.KeywordAlign;
            chk_conditionNewline.Checked  = Properties.Settings.Default.ExpandBooleanExpressions;
            chk_expandCase.Checked        = Properties.Settings.Default.ExpandCaseStatements;
            chk_expandBetween.Checked     = Properties.Settings.Default.ExpandBetweenConditions;
            chk_expandIn.Checked          = Properties.Settings.Default.ExpandInLists;
            chk_expandOn.Checked          = Properties.Settings.Default.BreakJoinOnSections;
            chk_uppercaseKeywords.Checked = Properties.Settings.Default.UppercaseKeywords;
            chk_allUpper.Checked          = Properties.Settings.Default.AllUpper;
            chk_coloring.Checked          = Properties.Settings.Default.HTMLColoring;
            chk_allIndent.Checked         = Properties.Settings.Default.AllIndent;
            chk_asAlign.Checked           = Properties.Settings.Default.AsAlign;
            txt_asMaxWidth.Text           = Properties.Settings.Default.KeywordLengthOfAs.ToString();
            chk_addSemicolon.Checked      = Properties.Settings.Default.addSemicolon;

            SetFormatter();
            _settingsLoaded = true;
        }
コード例 #9
0
 public TSqlObfuscatingFormatterTests()
 {
     _tokenizer         = new TSqlStandardTokenizer();
     _parser            = new TSqlStandardParser();
     _standardFormatter = new TSqlStandardFormatter(new TSqlStandardFormatterOptions
     {
         TrailingCommas         = true,
         KeywordStandardization = true
     });
     _obfuscatingFormatter = new TSqlObfuscatingFormatter();
 }
 public TSqlObfuscatingFormatterTests()
 {
     _tokenizer = new TSqlStandardTokenizer();
     _parser = new TSqlStandardParser();
     _standardFormatter = new TSqlStandardFormatter(new TSqlStandardFormatterOptions
         {
             TrailingCommas = true,
             KeywordStandardization = true
         });
     _obfuscatingFormatter = new TSqlObfuscatingFormatter();
 }
コード例 #11
0
 public ParserTests()
 {
     _tokenizer = new TSqlStandardTokenizer();
     _parser = new TSqlStandardParser();
 }
コード例 #12
0
 public TSqlStandardFormatterTests()
 {
     _tokenizer  = new TSqlStandardTokenizer();
     _parser     = new TSqlStandardParser();
     _formatters = new Dictionary <string, TSqlStandardFormatter>(StringComparer.OrdinalIgnoreCase);
 }
コード例 #13
0
 public ParserTests()
 {
     _tokenizer = new TSqlStandardTokenizer();
     _parser    = new TSqlStandardParser();
 }
コード例 #14
0
 public SqlFormattingManager(ISqlTokenizer tokenizer, ISqlTokenParser parser, ISqlTreeFormatter formatter)
 {
     Tokenizer = tokenizer;
     Parser    = parser;
     Formatter = formatter;
 }
コード例 #15
0
        public MainForm()
        {
            if (!Properties.Settings.Default.UpgradeCompleted)
            {
                Properties.Settings.Default.Upgrade();
                if (!Properties.Settings.Default.UpgradeCompleted)
                {
                    //this is an initial install - detect language if possible
                    if (Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName.Equals(UILANGUAGE_FR, StringComparison.InvariantCultureIgnoreCase))
                    {
                        Properties.Settings.Default.UILanguage = UILANGUAGE_FR;
                    }
                    else if (Thread.CurrentThread.CurrentUICulture.TwoLetterISOLanguageName.Equals(UILANGUAGE_ES, StringComparison.InvariantCultureIgnoreCase))
                    {
                        Properties.Settings.Default.UILanguage = UILANGUAGE_ES;
                    }
                    else
                    {
                        Properties.Settings.Default.UILanguage = UILANGUAGE_EN;
                    }
                }
                Properties.Settings.Default.UpgradeCompleted = true;
                Properties.Settings.Default.Save();
            }

            //set the UI language BEFORE initializeComponent...
            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(Properties.Settings.Default.UILanguage);
            System.Globalization.CultureInfo test1 = Thread.CurrentThread.CurrentUICulture;
            _generalResourceManager = new FrameworkClassReplacements.SingleAssemblyResourceManager("GeneralLanguageContent", System.Reflection.Assembly.GetExecutingAssembly(), typeof(Program));

            InitializeComponent();

            _tokenizer = new PoorMansTSqlFormatterLib.Tokenizers.TSqlStandardTokenizer();
            _parser    = new PoorMansTSqlFormatterLib.Parsers.TSqlStandardParser();

            //Now that controls exist, update UI from settings.
            if (Properties.Settings.Default.UILanguage.Equals(UILANGUAGE_EN))
            {
                englishToolStripMenuItem.Checked = true;
            }
            if (Properties.Settings.Default.UILanguage.Equals(UILANGUAGE_FR))
            {
                frenchToolStripMenuItem.Checked = true;
            }
            if (Properties.Settings.Default.UILanguage.Equals(UILANGUAGE_ES))
            {
                spanishToolStripMenuItem.Checked = true;
            }

            displayTokenListToolStripMenuItem.Checked             = Properties.Settings.Default.DisplayTokenList;
            displayParsedSqlToolStripMenuItem.Checked             = Properties.Settings.Default.DisplayParsedSqlXml;
            displayFormattingOptionsAreaToolStripMenuItem.Checked = Properties.Settings.Default.DisplayFormattingOptions;

            radio_Formatting_Standard.Checked = Properties.Settings.Default.Formatter.Equals(FORMATTER_STANDARD, StringComparison.InvariantCultureIgnoreCase);
            txt_Indent.Text                          = Properties.Settings.Default.Indent;
            txt_IndentWidth.Text                     = Properties.Settings.Default.IndentWidth.ToString();
            txt_MaxWidth.Text                        = Properties.Settings.Default.MaxWidth.ToString();
            txt_StatementBreaks.Text                 = Properties.Settings.Default.NewStatementLineBreaks.ToString();
            txt_ClauseBreaks.Text                    = Properties.Settings.Default.NewClauseLineBreaks.ToString();
            chk_ExpandCommaLists.Checked             = Properties.Settings.Default.ExpandCommaLists;
            chk_TrailingCommas.Checked               = Properties.Settings.Default.TrailingCommas;
            chk_SpaceAfterComma.Checked              = Properties.Settings.Default.SpaceAfterComma;
            chk_ExpandBooleanExpressions.Checked     = Properties.Settings.Default.ExpandBooleanExpressions;
            chk_ExpandCaseStatements.Checked         = Properties.Settings.Default.ExpandCaseStatements;
            chk_ExpandBetweenConditions.Checked      = Properties.Settings.Default.ExpandBetweenConditions;
            chk_ExpandInLists.Checked                = Properties.Settings.Default.ExpandInLists;
            chk_BreakJoinOnSections.Checked          = Properties.Settings.Default.BreakJoinOnSections;
            chk_UppercaseKeywords.Checked            = Properties.Settings.Default.UppercaseKeywords;
            chk_Coloring.Checked                     = Properties.Settings.Default.StandardColoring;
            chk_EnableKeywordStandardization.Checked = Properties.Settings.Default.EnableKeywordStandardization;

            radio_Formatting_Identity.Checked = Properties.Settings.Default.Formatter.Equals(FORMATTER_IDENTITY, StringComparison.InvariantCultureIgnoreCase);
            chk_IdentityColoring.Checked      = Properties.Settings.Default.IdentityColoring;

            radio_Formatting_Obfuscate.Checked = Properties.Settings.Default.Formatter.Equals(FORMATTER_OBFUSCATE, StringComparison.InvariantCultureIgnoreCase);
            chk_RandomizeKeywordCase.Checked   = Properties.Settings.Default.RandomizeKeywordCase;
            chk_RandomizeColor.Checked         = Properties.Settings.Default.RandomizeColor;
            chk_RandomizeLineLength.Checked    = Properties.Settings.Default.RandomizeLineLength;
            chk_PreserveComments.Checked       = Properties.Settings.Default.PreserveComments;
            chk_KeywordSubstitution.Checked    = Properties.Settings.Default.KeywordSubstitution;

            _settingsLoaded = true;

            SetFormatter();
            UpdateDisplayLayout();
        }
コード例 #16
0
 public TSqlStandardFormatterTests()
 {
     _tokenizer = new TSqlStandardTokenizer();
     _parser = new TSqlStandardParser();
     _formatters = new Dictionary<string, TSqlStandardFormatter>(StringComparer.OrdinalIgnoreCase);
 }