public static LevelX.ObjectLayerX ToXmlProxyX(ObjectLayer layer)
{
if (layer == null)
{
return(null);
}
List <LevelX.ObjectInstanceX> objs = new List <LevelX.ObjectInstanceX>();
foreach (ObjectInstance inst in layer.Objects)
{
objs.Add(ObjectInstance.ToXProxy(inst));
}
List <CommonX.PropertyX> props = new List <CommonX.PropertyX>();
foreach (Property prop in layer.PropertyManager.CustomProperties)
{
props.Add(Property.ToXmlProxyX(prop));
}
return(new LevelX.ObjectLayerX()
{
Name = layer.Name,
Opacity = layer.Opacity,
Visible = layer.IsVisible,
RasterMode = layer.RasterMode,
GridColor = layer.GridColor.ToArgbHex(),
GridWidth = layer.GridWidth,
GridHeight = layer.GridHeight,
Objects = objs.Count > 0 ? objs : null,
Properties = props.Count > 0 ? props : null,
});
}