SHA256
Refactor Every namespace Keyword Usage
This commit is contained in:
1 parent
4e67cb9b09
commit
27be2141f7
44 files changed
+4619
-4545
No files matched your search
@@ -110,4 +110,68 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="FFmpeg.AutoGen" Version="8.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Build 후 XML 문서에서 ADOFAIRenderer.API 네임스페이스만 남기고 나머지 제거 -->
|
||||
<UsingTask TaskName="FilterXmlDoc" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
|
||||
<ParameterGroup>
|
||||
<XmlFilePath ParameterType="System.String" Required="true" />
|
||||
<TargetNamespace ParameterType="System.String" Required="true" />
|
||||
</ParameterGroup>
|
||||
<Task>
|
||||
<Using Namespace="System" />
|
||||
<Using Namespace="System.IO" />
|
||||
<Using Namespace="System.Collections.Generic" />
|
||||
<Using Namespace="System.Xml.Linq" />
|
||||
<Code Type="Fragment" Language="cs">
|
||||
<![CDATA[
|
||||
if (!File.Exists(XmlFilePath)) return true;
|
||||
try
|
||||
{
|
||||
var doc = XDocument.Load(XmlFilePath);
|
||||
var members = doc.Root?.Element("members");
|
||||
if (members != null)
|
||||
{
|
||||
var prefix = TargetNamespace + ".";
|
||||
var toRemove = new List<XElement>();
|
||||
|
||||
foreach (var member in members.Elements("member"))
|
||||
{
|
||||
var nameAttr = member.Attribute("name")?.Value;
|
||||
if (string.IsNullOrEmpty(nameAttr)) continue;
|
||||
|
||||
// XML 주석 형식: T:네임스페이스.타입, M:메서드, P:프로퍼티, F:필드/열거형, E:이벤트 등
|
||||
int colonIndex = nameAttr.IndexOf(':');
|
||||
string fullName = colonIndex >= 0 ? nameAttr.Substring(colonIndex + 1) : nameAttr;
|
||||
|
||||
if (!fullName.StartsWith(prefix, StringComparison.Ordinal) && !fullName.Equals(TargetNamespace, StringComparison.Ordinal))
|
||||
{
|
||||
toRemove.Add(member);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var elem in toRemove)
|
||||
{
|
||||
elem.Remove();
|
||||
}
|
||||
|
||||
doc.Save(XmlFilePath);
|
||||
Log.LogMessage(Microsoft.Build.Framework.MessageImportance.High, $"[FilterXmlDoc] Kept '{TargetNamespace}' namespace docs. Removed {toRemove.Count} other members.");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.LogWarning($"[FilterXmlDoc] XML filtering failed: {ex.Message}");
|
||||
}
|
||||
]]>
|
||||
</Code>
|
||||
</Task>
|
||||
</UsingTask>
|
||||
|
||||
<Target Name="FilterDocumentationFile" AfterTargets="Build" Condition="'$(GenerateDocumentationFile)' == 'true'">
|
||||
<PropertyGroup>
|
||||
<_XmlDocPath Condition="'$(_XmlDocPath)' == '' and Exists('$(TargetDir)$(TargetName).xml')">$(TargetDir)$(TargetName).xml</_XmlDocPath>
|
||||
<_XmlDocPath Condition="'$(_XmlDocPath)' == '' and Exists('$(DocumentationFile)')">$(DocumentationFile)</_XmlDocPath>
|
||||
</PropertyGroup>
|
||||
<FilterXmlDoc Condition="'$(_XmlDocPath)' != ''" XmlFilePath="$(_XmlDocPath)" TargetNamespace="ADOFAIRenderer.API" />
|
||||
</Target>
|
||||
</Project>
|
||||
Reference in new issue
Block a user