示例#1
0
 private void BtnAddModel_Click(object sender, EventArgs e)
 {
     Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
     foreach (string file in DteExtends.GetProjectFilesInSolution())
     {
         if (file.Contains(".Domain"))
         {
             openFileDialog1.InitialDirectory = Path.GetDirectoryName(file);
             break;
         }
     }
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         var lines       = File.ReadAllLines(openFileDialog1.FileName);
         var bClassStart = false;
         var iRow        = 1;
         var sb          = new StringBuilder();
         sb.AppendLine(System.Environment.NewLine);
         foreach (var line in lines)
         {
             if (!bClassStart && Regex.IsMatch(line, "\\sclass\\s"))
             {
                 bClassStart = true;
             }
             if (bClassStart && iRow < lines.Length)
             {
                 sb.AppendLine(line);
             }
             iRow++;
         }
         txtSrc.Text += sb.ToString();
     }
 }
示例#2
0
        private void BtnOpenModelFile_Click(object sender, EventArgs e)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

            foreach (string file in DteExtends.GetProjectFilesInSolution())
            {
                if (file.Contains(".Domain"))
                {
                    openFileDialog1.InitialDirectory = Path.GetDirectoryName(file);
                    break;
                }
            }
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                txtSrc.Text = File.ReadAllText(openFileDialog1.FileName).ReplaceLF2CrLF();
            }
        }
示例#3
0
        public static Dictionary <AbpProjectType, string> GetALLProjectPath()
        {
            if (_allProjectPaths.Count() > 0)
            {
                return(_allProjectPaths);
            }
#pragma warning disable VSTHRD010
            string[] files = DteExtends.GetProjectFilesInSolution();
            foreach (AbpProjectType t in Enum.GetValues(typeof(AbpProjectType)))
            {
                var file = files.FirstOrDefault(x => x.EndsWith($".{t.ToString()}.csproj"));
                if (!string.IsNullOrWhiteSpace(file))
                {
                    _allProjectPaths.Add(t, Path.GetDirectoryName(file));
                }
            }
            return(_allProjectPaths);
        }