Exemple #1
0
        private void btnImport_Click(object sender, EventArgs e)
        {
            var dig = new OpenFileDialog();

            dig.Multiselect      = true;
            dig.Filter           = "sql files (*.sql)|*.sql";
            dig.RestoreDirectory = false;
            var rst = dig.ShowDialog();

            if (rst != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            // Init Cop Context
            tbSql.TabPages.Clear();
            Contexts.Clear();
            FileNames = dig.FileNames.ToList();
            foreach (var fpath in FileNames)
            {
                var fileName = HelperMethod.GetFileNameByPath(fpath);
                tbSql.TabPages.Add(fileName);
                Contexts.Add(new StyleCopContext(fpath));
            }

            InitRunContext();
            tbSql_SelectedIndexChanged(sender, EventArgs.Empty);
        }
Exemple #2
0
 public StyleCopContext(string fpath)
 {
     UserDefinedDict = new Dictionary <string, object>();
     FilePath        = fpath;
     SqlFileName     = HelperMethod.GetFileNameByPath(fpath);
     if (!string.IsNullOrEmpty(FilePath))
     {
         SqlScript = File.ReadAllText(FilePath);
     }
     else
     {
         SqlScript = string.Empty;
     }
 }