| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | |
| | | 6 | | namespace CoreWCF.BuildTools; |
| | | 7 | | |
| | | 8 | | internal sealed class Indentor |
| | | 9 | | { |
| | | 10 | | const string ____ = " "; |
| | | 11 | | const string ________ = " "; |
| | | 12 | | const string ____________ = " "; |
| | | 13 | | const string ________________ = " "; |
| | | 14 | | const string ____________________ = " "; |
| | | 15 | | const string ________________________ = " "; |
| | | 16 | | const string ____________________________ = " "; |
| | | 17 | | const string ________________________________ = " "; |
| | 18980 | 18 | | public int Level { get; private set; } = 0; |
| | | 19 | | public void Increment() |
| | | 20 | | { |
| | 2220 | 21 | | Level++; |
| | 2220 | 22 | | } |
| | | 23 | | |
| | | 24 | | public void Decrement() |
| | | 25 | | { |
| | 2220 | 26 | | Level--; |
| | 2220 | 27 | | } |
| | | 28 | | |
| | 8604 | 29 | | public override string ToString() => Level switch |
| | 8604 | 30 | | { |
| | 496 | 31 | | 0 => string.Empty, |
| | 1168 | 32 | | 1 => ____, |
| | 1728 | 33 | | 2 => ________, |
| | 2652 | 34 | | 3 => ____________, |
| | 1468 | 35 | | 4 => ________________, |
| | 836 | 36 | | 5 => ____________________, |
| | 216 | 37 | | 6 => ________________________, |
| | 24 | 38 | | 7 => ____________________________, |
| | 16 | 39 | | 8 => ________________________________, |
| | 0 | 40 | | _ => throw new InvalidOperationException() |
| | 8604 | 41 | | }; |
| | | 42 | | } |