|
@@ -18,10 +18,32 @@ namespace Grpc.Extension.Common.Internal
|
|
|
static List<Type> protoTypes;
|
|
|
static ProtoCommentGenerator()
|
|
|
{
|
|
|
+
|
|
|
+
|
|
|
+ string path = Environment.CurrentDirectory;
|
|
|
+ string[] temp = path.Split("\\".ToCharArray());
|
|
|
+ string patha = "";
|
|
|
+ for (int i = 0; i < temp.Length - 1; i++)
|
|
|
+ {
|
|
|
+ patha += temp[i];
|
|
|
+ patha += "\\";
|
|
|
+ }
|
|
|
//加载注释xml文件
|
|
|
- var files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.xml");
|
|
|
+ ///var files = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.xml");
|
|
|
+ var files = Directory.GetFiles(patha, "*.xml", SearchOption.AllDirectories);
|
|
|
+ Dictionary<string, string> keys = new Dictionary<string, string>();
|
|
|
+ foreach (string file in files) {
|
|
|
+ string[] p= file.Split("\\".ToCharArray());
|
|
|
+ string fileName = p[p.Length - 1];
|
|
|
+ keys[fileName] = file;
|
|
|
+ }
|
|
|
+ List<string> fils = new List<string>();
|
|
|
+ foreach (string file in keys.Keys)
|
|
|
+ {
|
|
|
+ fils.Add(keys[file]);
|
|
|
+ }
|
|
|
var assembliyNames = new List<string>();
|
|
|
- foreach (var file in files)
|
|
|
+ foreach (var file in fils)
|
|
|
{
|
|
|
var xe = XElement.Load(file);
|
|
|
//检查是否为注释xml文件
|
|
@@ -30,6 +52,15 @@ namespace Grpc.Extension.Common.Internal
|
|
|
foreach (var item in xe.Element("members").Elements())
|
|
|
{
|
|
|
var name = item.Attribute("name")?.Value;
|
|
|
+ //bool flag = false;
|
|
|
+ //foreach (XmlCommentInfo commentInfo in xmlComments) {
|
|
|
+ // if (name.Equals(commentInfo.FullName)) {
|
|
|
+ // flag = true;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+ //if (flag) {
|
|
|
+ // continue;
|
|
|
+ //}
|
|
|
var nameArr = name?.Split(':');
|
|
|
if (name != null && nameArr.Length > 1)
|
|
|
{
|