Update ShapePlacementParsingStrategy.cs

This commit is contained in:
Sergio Navarro
2015-07-14 20:51:29 +02:00
parent 43315c349f
commit 3e1087ff58

View File

@@ -107,22 +107,19 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy {
} }
} }
private void GetShapeType(PlacementShapeLocation shapeLocation, out string shapeType, out string differentiator) private void GetShapeType(PlacementShapeLocation shapeLocation, out string shapeType, out string differentiator) {
{
differentiator = ""; differentiator = "";
shapeType = shapeLocation.ShapeType; shapeType = shapeLocation.ShapeType;
var separatorLengh = 2; var separatorLengh = 2;
var separatorIndex = shapeType.LastIndexOf("__"); var separatorIndex = shapeType.LastIndexOf("__");
var dashIndex = shapeType.LastIndexOf('-'); var dashIndex = shapeType.LastIndexOf('-');
if (dashIndex > separatorIndex) if (dashIndex > separatorIndex) {
{
separatorIndex = dashIndex; separatorIndex = dashIndex;
separatorLengh = 1; separatorLengh = 1;
} }
if (separatorIndex > 0 && separatorIndex < shapeType.Length - separatorLengh) if (separatorIndex > 0 && separatorIndex < shapeType.Length - separatorLengh) {
{
differentiator = shapeType.Substring(separatorIndex + separatorLengh); differentiator = shapeType.Substring(separatorIndex + separatorLengh);
shapeType = shapeType.Substring(0, separatorIndex); shapeType = shapeType.Substring(0, separatorIndex);
} }