public void ApplyRule(List <ISourceCodeBuilderStep> steps) { foreach (ChildSteps typeSteps in steps.GetChildSteps(typeof(IClassType), typeof(IInterfaceType), typeof(IStructType))) { SourceCodeStepRange range = typeSteps.Steps.GetRange( SourceCodePlaceholder.BeginGenericParametersDefinition, SourceCodePlaceholder.BeginGenericParametersDefinition); int typeDefinitionLength = typeSteps.Steps.GetRange( SourceCodePlaceholder.BeginTypeDefinition, SourceCodePlaceholder.EndTypeDefinition).Range.FindFirstLine().ToSourceCode().Length; if (range == null || typeDefinitionLength <= MaximumLineLength) { continue; } range.Range.Insert(0, new IncrementIndent()); range.Range.Add(new DecrementIndent()); range.Range.ReplaceAll(typeof(WriteWhitespace), new WriteIndentedNewLine()); range.Apply(); } }
public void ApplyRule(List <ISourceCodeBuilderStep> steps) { foreach (ChildSteps methodSteps in steps.GetChildSteps(typeof(IMethod))) { SourceCodeStepRange range = methodSteps.Steps.GetRange( SourceCodePlaceholder.BeginMethodParametersDefinition, SourceCodePlaceholder.EndMethodParametersDefinition); int methodDefinitionLength = methodSteps.Steps.GetRange( SourceCodePlaceholder.BeginMethodDefinition, SourceCodePlaceholder.EndMethodDefinition).Range.FindFirstLine().ToSourceCode().Length; if (range == null || methodDefinitionLength <= MaximumLineLength) { continue; } range.Range.Insert(0, new IncrementIndent()); range.Range.Insert(1, new WriteIndentedNewLine()); range.Range.Add(new DecrementIndent()); range.Range.ReplaceAll(typeof(WriteWhitespace), new WriteIndentedNewLine()); range.Apply(); } }