2 using System.Collections.Generic;
 
    5 using System.Text.RegularExpressions;
 
    8 namespace SiliconStudio.AssemblyProcessor
 
   12         private readonly 
string inputFile;
 
   16             if (inputFile == null) 
throw new ArgumentNullException(
"inputFile");
 
   17             this.inputFile = inputFile;
 
   22             var basePath = Path.Combine(Path.GetDirectoryName(inputFile) ?? 
"", Path.GetFileNameWithoutExtension(inputFile) ?? 
"");
 
   23             var xmlFile = basePath + 
".xml";
 
   24             var targetFile = basePath + 
".usrdoc";
 
   27             if (!
File.Exists(xmlFile))
 
   30             var result = 
new Dictionary<string, string>();
 
   32             var document = XElement.Load(xmlFile);
 
   33             foreach (var member 
in document.Descendants(
"member"))
 
   35                 var nameAttribute = member.Attribute(
"name");
 
   36                 if (nameAttribute == null)
 
   38                 string key = nameAttribute.Value;
 
   40                 string userdoc = null;
 
   41                 foreach (var userdocElement 
in member.Descendants(
"userdoc"))
 
   45                         LogLine(
"Warning: the member {0} has multiple userdoc, only the first one will be used.", key);
 
   48                     if (userdocElement.Descendants().Any())
 
   50                         LogLine(
"Warning: the userdoc of member {0} has descendant nodes, which is not supported.", key);
 
   53                     userdoc = userdocElement.Value;
 
   54                     userdoc = userdoc.Replace(
'\t', 
' ').Replace(
'\r', 
' ').Replace(
'\n', 
' ').Trim();
 
   56                     var regex = 
new Regex(
@"[ ]{2,}", RegexOptions.None);
 
   57                     userdoc = regex.Replace(userdoc, 
@" ");
 
   61                     result.Add(key, userdoc);
 
   65             using (var writer = 
new StreamWriter(targetFile))
 
   67                 foreach (var entry 
in result)
 
   69                     writer.WriteLine(
"{0}={1}", entry.Key, entry.Value);
 
   76         private static void LogLine(
string format, params 
object[] args)
 
   78             Console.WriteLine(
format, args);
 
GenerateUserDocumentationProcessor(string inputFile)
 
bool Process(AssemblyProcessorContext context)
 
_In_ size_t _In_ size_t _In_ DXGI_FORMAT format