本文整理汇总了C#中IResource.SetResourceData方法的典型用法代码示例。如果您正苦于以下问题:C# IResource.SetResourceData方法的具体用法?C# IResource.SetResourceData怎么用?C# IResource.SetResourceData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IResource
的用法示例。
在下文中一共展示了IResource.SetResourceData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CopyResourceDataTo
/// <summary>
/// Copies the resource data to the specified resource
/// </summary>
/// <remarks>
/// Avoid using this method if you are copying a IFeatureSource with MG_USER_CREDENTIALS resource data, as MapGuide will automatically return
/// the decrypted username for MG_USER_CREDENTIALS, rendering the resource data invalid for the target resource. Instead use the
/// <see cref="M:OSGeo.MapGuide.MaestroAPI.Services.IResourceService.CopyResource"/> method, which will copy the resource and its resource
/// data and keep any MG_USER_CREDENTIALS items intact
/// </remarks>
/// <param name="source">The source.</param>
/// <param name="target">The target.</param>
public static void CopyResourceDataTo(this IResource source, IResource target)
{
Check.NotNull(source, "source"); //NOXLATE
Check.NotNull(target, "target"); //NOXLATE
foreach (var res in source.EnumerateResourceData())
{
var data = source.GetResourceData(res.Name);
if (!data.CanSeek)
{
var ms = new MemoryStream();
Utility.CopyStream(data, ms);
data = ms;
}
target.SetResourceData(res.Name, res.Type, data);
}
}