Пример #1
0
        private static string GetIndent(IndentMode indentMode, int spaceIndentSize)
        {
            switch (indentMode)
            {
            case IndentMode.Spaces: return(new string(' ', spaceIndentSize));

            case IndentMode.Tabs: return("\t");
            }

            throw new Exception($"Unrecognized indent-mode: '{indentMode}'");
        }
Пример #2
0
        /// <summary>
        /// Initializes object data from setting value.
        /// </summary>
        public void ConvertFromValue(string settingValue)
        {
            try
            {
                string[] parts = settingValue.Split(':');

                Mode = (IndentMode)Enum.Parse(typeof(IndentMode), parts[0]);
                AllowPadding = Boolean.Parse(parts[1]);
            }
            catch
            {
            }
        }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="quantity">Can be negative</param>
 /// <param name="mode"></param>
 public IndentLvAttribute(int quantity, IndentMode mode = IndentMode.Normal)
 {
     Quantity = quantity;
     Mode     = mode;
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CodeBuilder"/> class.
 /// </summary>
 /// <param name="indentMode">Mode to use for indenting</param>
 /// <param name="spaceIndentSize">When indenting with spaces this controls how many</param>
 /// <param name="newlineMode">Mode to use for ending lines</param>
 public CodeBuilder(IndentMode indentMode, int spaceIndentSize, NewlineMode newlineMode)
 {
     this.indent  = GetIndent(indentMode, spaceIndentSize);
     this.newline = GetNewline(newlineMode);
 }