示例#1
0
 private static void WriteSingleLineTextConstant(TextConstant textConstant, CSideWriter writer)
 {
     DoWrite(
         textConstant.Name,
         textConstant.ID,
         textConstant.TypeName,
         "",
         writer);
 }
示例#2
0
 private static void WriteTextConstant(TextConstant textConstant, CSideWriter writer)
 {
     if (IsMultiLineTextConstant(textConstant))
     {
         WriteMultiLineTextConstant(textConstant, writer);
     }
     else
     {
         WriteSingleLineTextConstant(textConstant, writer);
     }
 }
示例#3
0
 private static void WriteSingleLineTextConstant(TextConstant textConstant, CSideWriter writer)
 {
     DoWrite(
         textConstant.Name,
         textConstant.ID,
         string.Format(
             "TextConst '{0}'",
             string.Join(
                 ";",
                 textConstant.Values.OrderBy(t => t.LanguageID.GetLCIDFromLanguageCode()).Select(v => string.Format("{0}={1}", v.LanguageID, v.Value.TextConstantValue(v.LanguageID == "@@@", textConstant.Values.Count()))))),
         "", writer);
 }
 private static void WriteTextConstant(TextConstant textConstant, CSideWriter writer)
 {
     if (writer.CodeStyle.NewLineBeforeTextConst)
     {
         writer.InnerWriter.WriteLine();
     }
     if (IsMultiLineTextConstant(textConstant) || writer.CodeStyle.TextConstIsAlwaysMultiLine)
     {
         WriteMultiLineTextConstant(textConstant, writer);
     }
     else
     {
         WriteSingleLineTextConstant(textConstant, writer);
     }
 }
示例#5
0
        private static void WriteMultiLineTextConstant(TextConstant textConstant, CSideWriter writer)
        {
            var sortedValues = textConstant.Values.OrderBy(v => v.LanguageID.GetLCIDFromLanguageCode());

#if !NAV2017
            writer.InnerWriter.WriteLine();
#endif
            writer.WriteLine("{0}@{1} : TextConst", textConstant.Name, textConstant.ID);
            writer.Indent();

            foreach (var value in sortedValues)
            {
                var isLastValue = (value.LanguageID == sortedValues.Last().LanguageID);
                writer.WriteLine("'{0}={1}'{2}", value.LanguageID, value.QuotedValue, isLastValue ? ";" : ",");
            }

            writer.Unindent();
        }
示例#6
0
 private static bool IsMultiLineTextConstant(TextConstant textConstant)
 {
     return(textConstant.Values.Sum(v => v.QuotedValue.Length) >= 1002);
 }