本文整理汇总了C#中IResourceService.GetResourceXmlData方法的典型用法代码示例。如果您正苦于以下问题:C# IResourceService.GetResourceXmlData方法的具体用法?C# IResourceService.GetResourceXmlData怎么用?C# IResourceService.GetResourceXmlData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IResourceService
的用法示例。
在下文中一共展示了IResourceService.GetResourceXmlData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDirectDependents
private static IEnumerable<string> GetDirectDependents(string resId, IResourceService resSvc)
{
using (var s = resSvc.GetResourceXmlData(resId))
{
XmlDocument doc = new XmlDocument();
doc.Load(s);
var matches = Utility.GetResourceIdPointers(doc);
//Need to weed out any empty results and self-references
return matches.Select(x => x.Value).Where(x => !string.IsNullOrEmpty(x) && x != resId);
}
}
示例2: PrepareForComparison
/// <summary>
/// Prepares the source and target resource content for XML comparison
/// </summary>
/// <param name="resSvc"></param>
/// <param name="sourceId"></param>
/// <param name="targetId"></param>
/// <param name="sourceFile"></param>
/// <param name="targetFile"></param>
public static void PrepareForComparison(IResourceService resSvc, string sourceId, string targetId, out string sourceFile, out string targetFile)
{
//Route both source and target XML content through
//XmlDocument objects to ensure issues like whitespacing do
//not throw us off
sourceFile = Path.GetTempFileName();
targetFile = Path.GetTempFileName();
using (var sourceStream = resSvc.GetResourceXmlData(sourceId))
using (var targetStream = resSvc.GetResourceXmlData(targetId))
{
var sourceDoc = new XmlDocument();
var targetDoc = new XmlDocument();
sourceDoc.Load(sourceStream);
targetDoc.Load(targetStream);
using (var fs = File.OpenWrite(sourceFile))
using (var ft = File.OpenWrite(targetFile))
{
sourceDoc.Save(fs);
targetDoc.Save(ft);
}
}
}