Skip to content

Commit dbfa3e3

Browse files
committed
style(ProtoExport): 统一使用制表符缩进代码注释和定义
将ProtoBuffServerHelper.cs中的代码生成部分从空格缩进改为制表符缩进,保持代码风格一致性
1 parent 3a9214a commit dbfa3e3

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

ProtoExport/ProtoBuffServerHelper.cs

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ public void Run(MessageInfoList messageInfoList, string outputPath, string names
2828
{
2929
if (operationCodeInfo.IsEnum)
3030
{
31-
sb.AppendLine($" /// <summary>");
32-
sb.AppendLine($" /// {operationCodeInfo.Description}");
33-
sb.AppendLine($" /// </summary>");
34-
sb.AppendLine($" [System.ComponentModel.Description(\"{operationCodeInfo.Description}\")]");
35-
sb.AppendLine($" public enum {operationCodeInfo.Name}");
36-
sb.AppendLine(" {");
31+
sb.AppendLine($"\t/// <summary>");
32+
sb.AppendLine($"\t/// {operationCodeInfo.Description}");
33+
sb.AppendLine($"\t/// </summary>");
34+
sb.AppendLine($"\t[System.ComponentModel.Description(\"{operationCodeInfo.Description}\")]");
35+
sb.AppendLine($"\tpublic enum {operationCodeInfo.Name}");
36+
sb.AppendLine("\t{");
3737
for (var index = 0; index < operationCodeInfo.Fields.Count; index++)
3838
{
3939
var operationField = operationCodeInfo.Fields[index];
@@ -42,38 +42,38 @@ public void Run(MessageInfoList messageInfoList, string outputPath, string names
4242
continue;
4343
}
4444

45-
sb.AppendLine($" /// <summary>");
46-
sb.AppendLine($" /// {operationField.Description}");
47-
sb.AppendLine($" /// </summary>");
48-
sb.AppendLine($" [System.ComponentModel.Description(\"{operationField.Description}\")]");
49-
sb.AppendLine($" {operationField.Type} = {operationField.Members},");
45+
sb.AppendLine($"\t\t/// <summary>");
46+
sb.AppendLine($"\t\t/// {operationField.Description}");
47+
sb.AppendLine($"\t\t/// </summary>");
48+
sb.AppendLine($"\t\t[System.ComponentModel.Description(\"{operationField.Description}\")]");
49+
sb.AppendLine($"\t\t{operationField.Type} = {operationField.Members},");
5050
if (index < operationCodeInfo.Fields.Count - 1)
5151
{
5252
sb.AppendLine();
5353
}
5454
}
5555

56-
sb.AppendLine(" }");
56+
sb.AppendLine("\t}");
5757
sb.AppendLine();
5858
}
5959
else
6060
{
61-
sb.AppendLine($" /// <summary>");
62-
sb.AppendLine($" /// {operationCodeInfo.Description}");
63-
sb.AppendLine($" /// </summary>");
64-
sb.AppendLine($" [ProtoContract]");
65-
sb.AppendLine($" [System.ComponentModel.Description(\"{operationCodeInfo.Description}\")]");
61+
sb.AppendLine($"\t/// <summary>");
62+
sb.AppendLine($"\t/// {operationCodeInfo.Description}");
63+
sb.AppendLine($"\t/// </summary>");
64+
sb.AppendLine($"\t[ProtoContract]");
65+
sb.AppendLine($"\t[System.ComponentModel.Description(\"{operationCodeInfo.Description}\")]");
6666
if (string.IsNullOrEmpty(operationCodeInfo.ParentClass))
6767
{
68-
sb.AppendLine($" public sealed class {operationCodeInfo.Name}");
68+
sb.AppendLine($"\tpublic sealed class {operationCodeInfo.Name}");
6969
}
7070
else
7171
{
72-
sb.AppendLine($" public sealed class {operationCodeInfo.Name} : MessageObject, {operationCodeInfo.ParentClass}");
7372
sb.AppendLine($"\t[MessageTypeHandler((({messageInfoList.Module}) << 16) + {operationCodeInfo.Opcode})]");
73+
sb.AppendLine($"\tpublic sealed class {operationCodeInfo.Name} : MessageObject, {operationCodeInfo.ParentClass}");
7474
}
7575

76-
sb.AppendLine(" {");
76+
sb.AppendLine("\t{");
7777
for (var index = 0; index < operationCodeInfo.Fields.Count; index++)
7878
{
7979
var operationField = operationCodeInfo.Fields[index];
@@ -82,25 +82,25 @@ public void Run(MessageInfoList messageInfoList, string outputPath, string names
8282
continue;
8383
}
8484

85-
sb.AppendLine($" /// <summary>");
86-
sb.AppendLine($" /// {operationField.Description}");
87-
sb.AppendLine($" /// </summary>");
88-
sb.AppendLine($" [ProtoMember({operationField.Members})]");
89-
sb.AppendLine($" [System.ComponentModel.Description(\"{operationField.Description}\")]");
85+
sb.AppendLine($"\t\t/// <summary>");
86+
sb.AppendLine($"\t\t/// {operationField.Description}");
87+
sb.AppendLine($"\t\t/// </summary>");
88+
sb.AppendLine($"\t\t[ProtoMember({operationField.Members})]");
89+
sb.AppendLine($"\t\t[System.ComponentModel.Description(\"{operationField.Description}\")]");
9090
if (operationField.IsRepeated)
9191
{
92-
sb.AppendLine($" public List<{operationField.Type}> {operationField.Name} {{ get; set; }} = new List<{operationField.Type}>();");
92+
sb.AppendLine($"\t\tpublic List<{operationField.Type}> {operationField.Name} {{ get; set; }} = new List<{operationField.Type}>();");
9393
}
9494
else
9595
{
9696
string defaultValue = string.Empty;
9797
if (operationField.IsKv)
9898
{
9999
defaultValue = $" = new {operationField.Type}();";
100-
sb.AppendLine($" [ProtoMap(DisableMap = true)]");
100+
sb.AppendLine($"\t\t[ProtoMap(DisableMap = true)]");
101101
}
102102

103-
sb.AppendLine($" public {operationField.Type} {operationField.Name} {{ get; set; }}{defaultValue}");
103+
sb.AppendLine($"\t\tpublic {operationField.Type} {operationField.Name} {{ get; set; }}{defaultValue}");
104104
}
105105

106106
if (index < operationCodeInfo.Fields.Count - 1)

0 commit comments

Comments
 (0)