Ejemplo n.º 1
0
 public static void Write(this Dataports dataports, CSideWriter writer)
 {
     foreach (var dataport in dataports.OrderBy(f => f.ID))
     {
         dataport.Write(writer);
     }
 }
Ejemplo n.º 2
0
        public static CSideWriter EndSection(this CSideWriter writer)
        {
            writer.Unindent();
            writer.WriteLine("}");

            return(writer);
        }
Ejemplo n.º 3
0
 public static void Write(this Forms forms, CSideWriter writer)
 {
     foreach (var form in forms.OrderBy(f => f.ID))
     {
         form.Write(writer);
     }
 }
Ejemplo n.º 4
0
 public static void Write(this MenuSuites menuSuites, CSideWriter writer)
 {
     foreach (var menuSuite in menuSuites.OrderBy(m => m.ID))
     {
         menuSuite.Write(writer);
     }
 }
 public static void WriteLineIf(this CSideWriter writer, bool condition, string format, params object[] args)
 {
     if (condition)
     {
         writer.WriteLine(format, args);
     }
 }
Ejemplo n.º 6
0
 public static void Write(this Queries queries, CSideWriter writer)
 {
     foreach (var query in queries.OrderBy(q => q.ID))
     {
         query.Write(writer);
     }
 }
Ejemplo n.º 7
0
 public static void Write(this Reports reports, CSideWriter writer)
 {
     foreach (var report in reports.OrderBy(r => r.ID))
     {
         report.Write(writer);
     }
 }
Ejemplo n.º 8
0
 public static void Write(this Codeunits codeunits, CSideWriter writer)
 {
     foreach (var codeunit in codeunits.OrderBy(c => c.ID))
     {
         codeunit.Write(writer);
     }
 }
Ejemplo n.º 9
0
 public static void Write(this Pages pages, CSideWriter writer)
 {
     foreach (var page in pages.OrderBy(p => p.ID))
     {
         page.Write(writer);
     }
 }
Ejemplo n.º 10
0
 public static void Write(this Tables tables, CSideWriter writer)
 {
     foreach (var table in tables.OrderBy(t => t.ID))
     {
         table.Write(writer);
     }
 }
        public static void Write(this Parameter parameter, CSideWriter writer)
        {
            string typeName = parameter.TypeName;

            if (writer.CodeStyle.PrintObjectReferenceAsName)
            {
                ObjectType?objType = RefParameterTypeToObjectType(parameter.Type);
                if (objType != null)
                {
                    var subType = (parameter as IHasSubType).SubType;
                    var objName = writer.CodeStyle.ResolveObjectName(objType.Value, subType);
                    if (objName != null)
                    {
                        typeName = $"{parameter.Type} {objName.QuotedTableName(writer.CodeStyle)}";
                    }
                }
            }

            switch (parameter)
            {
            case RecordParameter recordParameter: DoWrite(recordParameter.Var, recordParameter.Name, recordParameter.ID, recordParameter.Temporary.GetValueOrDefault(false), typeName, recordParameter.Dimensions, recordParameter.InDataSet, writer); break;

            default: DoWrite(parameter.Var, parameter.Name, parameter.ID, false, typeName, parameter.Dimensions, parameter.InDataSet, writer); break;
            }
        }
        public static void Write(this PageAction action, CSideWriter writer)
        {
            var idLength         = Math.Max(action.ID.ToString().Length, 8);
            var id               = action.ID.ToString().PadRight(idLength);
            var idAndIndentation = string.Format("{0};{1}", id, action.IndentationLevel.ToString());

            writer.Write("{{ {0};", idAndIndentation.PadRight(13));
            writer.Indent(writer.Column);
            writer.WriteLine("Action    ;");
            action.Properties.Write(PropertiesStyle.Field, writer);

            var relevantProperties = action.Properties.Where(p => p.HasValue);
            var lastProperty       = relevantProperties.LastOrDefault();

            if (lastProperty != null)
            {
                if (lastProperty is TriggerProperty)
                {
                    writer.Write(new string(' ', 10));
                }
            }

            writer.WriteLine("}");
            writer.Unindent();
        }
Ejemplo n.º 13
0
 public static void Write(this XmlPorts xmlPorts, CSideWriter writer)
 {
     foreach (var xmlPort in xmlPorts.OrderBy(x => x.ID))
     {
         xmlPort.Write(writer);
     }
 }
        public static void Write(this PageActionSeparator action, CSideWriter writer)
        {
            var idLength         = Math.Max(action.ID.ToString().Length, 8);
            var id               = action.ID.ToString().PadRight(idLength);
            var idAndIndentation = string.Format("{0};{1}", id, action.IndentationLevel.ToString());

            writer.Write("{{ {0};", idAndIndentation.PadRight(13));
            writer.Indent(writer.Column);
            writer.Write("Separator ");

            var relevantProperties = action.Properties.Where(p => p.HasValue);

            if (relevantProperties.Any())
            {
                writer.WriteLine(";");
                action.Properties.Write(PropertiesStyle.Field, writer);
            }
            else
            {
                writer.Write(" ");
            }

            writer.WriteLine("}");
            writer.Unindent();
        }
 public static void WriteIf(this CSideWriter writer, bool condition, string text)
 {
     if (condition)
     {
         writer.Write(text);
     }
 }
Ejemplo n.º 16
0
        public static void Write(this TableFieldGroup fieldGroup, CSideWriter writer)
        {
            var fields      = string.Join(",", fieldGroup.Fields);
            var fieldsWidth = Math.Max(fields.Length, 40);

            writer.Write("{ ");
            writer.Write(fieldGroup.ID.ToString().PadRight(4));
            writer.Write(";");
            writer.Write(fieldGroup.Name.PadRight(20));
            writer.Write(";");
            writer.Write(fields.PadRight(fieldsWidth));

            if (fieldGroup.Properties.Any(p => p.HasValue))
            {
                writer.Write(";");
                writer.Indent(writer.Column);
                fieldGroup.Properties.Write(PropertiesStyle.Field, writer);
                writer.Unindent();
            }
            else
            {
                writer.Write(" ");
            }

            writer.WriteLine("}");
        }
        public static void Write(this MenuSuiteNode node, CSideWriter writer)
        {
            writer.Write("{ ");
            writer.Write(node.NodeTypeAsString());
            writer.Write(";");
            writer.Write("[{0}] ", node.ID.ToString("B").ToUpper());
            writer.Write(";");

            writer.Indent(writer.Column);

            IEnumerable <Property> properties = null;

            TypeSwitch.Do(
                node,
                TypeSwitch.Case <RootNode>(n => properties  = n.Properties),
                TypeSwitch.Case <MenuNode>(n => properties  = n.Properties),
                TypeSwitch.Case <GroupNode>(n => properties = n.Properties),
                TypeSwitch.Case <ItemNode>(n => properties  = n.Properties),
                TypeSwitch.Case <DeltaNode>(n => properties = n.Properties)
                );

            var relevantProperties = properties.Where(p => p.HasValue);

            relevantProperties.Write(PropertiesStyle.Field, writer);

            writer.Unindent();
            writer.WriteLine("}");
        }
        public static void Write(this Function function, CSideWriter writer)
        {
            writer.InnerWriter.WriteLine();
#if NAV2016
            writer.WriteLineIf(function.TryFunction.GetValueOrDefault(false), "[TryFunction]");
            WriteEventingAttributes(function, writer);
#endif
#if NAV2015
            writer.WriteLineIf(function.UpgradeFunctionType.HasValue, "[{0}]", function.UpgradeFunctionType);
#endif
            writer.WriteLineIf(function.TestFunctionType.HasValue, "[{0}]", function.TestFunctionType);
            writer.WriteLineIf(function.HandlerFunctions != null, "[HandlerFunctions({0})]", function.HandlerFunctions);
            writer.WriteLineIf(function.TransactionModel.HasValue, "[TransactionModel({0})]", function.TransactionModel);
#if NAV2017
            writer.WriteLineIf(function.TestPermissions.HasValue, "[TestPermissions({0})]", function.TestPermissions);
#endif

            writer.Write("{2}PROCEDURE {0}@{1}(", function.Name, function.ID, function.Local ? "LOCAL " : "");
            function.Parameters.Write(writer);
            writer.Write(")");
            function.ReturnValue.Write(writer);
            writer.WriteLine(";");
            function.Variables.Write(writer);
            writer.WriteLine("BEGIN");
            writer.Indent();
            function.CodeLines.Write(writer);
            writer.Unindent();
            writer.WriteLine("END;");
        }
Ejemplo n.º 19
0
 public static void Write(this Events events, CSideWriter writer)
 {
     foreach (var @event in events)
     {
         @event.Write(writer);
     }
 }
 public static void Write(this Functions functions, CSideWriter writer)
 {
     foreach (Function function in functions)
     {
         function.Write(writer);
     }
 }
 private static int?GetLineStartForWrite(Function function, CSideWriter writer)
 {
     if (writer.CodeStyle.ExportToNewSyntax)
     {
         return(function.LineStart + 38);
     }
     return(function.LineStart);
 }
 public static void Write(this FilterQueryElement element, CSideWriter writer)
 {
     WriteDeclaration(element.ID, element.IndentationLevel, "Filter", element.Name, writer);
     element.Properties.Where(p => p.HasValue).Write(PropertiesStyle.Field, writer);
     writer.WriteLine("}");
     writer.Unindent();
     writer.InnerWriter.WriteLine();
 }
Ejemplo n.º 23
0
        public static CSideWriter BeginSection(this CSideWriter writer, string sectionName)
        {
            writer.WriteLine(sectionName);
            writer.WriteLine("{");
            writer.Indent();

            return(writer);
        }
Ejemplo n.º 24
0
 public static void Write(this MenuSuite menuSuite, CSideWriter writer)
 {
     writer.BeginSection(menuSuite.GetObjectSignature());
     menuSuite.ObjectProperties.Write(writer);
     menuSuite.Properties.Write(writer);
     menuSuite.Nodes.Write(writer);
     writer.EndSection();
 }
Ejemplo n.º 25
0
 private static void WriteSingleLineTextConstant(TextConstant textConstant, CSideWriter writer)
 {
     DoWrite(
         textConstant.Name,
         textConstant.ID,
         textConstant.TypeName,
         "",
         writer);
 }
Ejemplo n.º 26
0
        public static void Write(this Parameter parameter, CSideWriter writer)
        {
            switch (parameter)
            {
            case RecordParameter recordParameter: DoWrite(recordParameter.Var, recordParameter.Name, recordParameter.ID, recordParameter.Temporary.GetValueOrDefault(false), recordParameter.TypeName, recordParameter.Dimensions, writer); break;

            default: DoWrite(parameter.Var, parameter.Name, parameter.ID, false, parameter.TypeName, parameter.Dimensions, writer); break;
            }
        }
 public static void Write(this PageControlBase pageControl, CSideWriter writer, int propertyIndentation)
 {
     TypeSwitch.Do(
         pageControl,
         TypeSwitch.Case <PageControlContainer>(c => c.Write(writer, propertyIndentation)),
         TypeSwitch.Case <PageControlGroup>(c => c.Write(writer, propertyIndentation)),
         TypeSwitch.Case <PageControlPart>(c => c.Write(writer, propertyIndentation)),
         TypeSwitch.Case <PageControl>(c => c.Write(writer, propertyIndentation)));
 }
Ejemplo n.º 28
0
 public static void Write(this Codeunit codeunit, CSideWriter writer)
 {
     writer.BeginSection(codeunit.GetObjectSignature());
     codeunit.ObjectProperties.Write(writer);
     codeunit.Properties.Write(writer);
     codeunit.Code.Write(writer);
     writer.EndSection();
     writer.InnerWriter.WriteLine();
 }
Ejemplo n.º 29
0
 public static void Write(this Code code, CSideWriter writer)
 {
     writer.BeginSection("CODE");
     code.Variables.Write(writer);
     code.Functions.Write(writer);
     code.Events.Write(writer);
     code.Documentation.Write(writer);
     writer.EndSection();
 }
Ejemplo n.º 30
0
 public static void Write(this ObjectProperties objectProperties, CSideWriter writer)
 {
     writer.BeginSection("OBJECT-PROPERTIES");
     writer.WriteLineIf(objectProperties.DateTime.HasValue, "Date={0};", objectProperties.DateTime.ToShortDateString());
     writer.WriteLineIf(objectProperties.DateTime.HasValue, "Time={0};", objectProperties.DateTime.ToShortTimeString());
     writer.WriteLineIf(objectProperties.Modified, "Modified=Yes;");
     writer.WriteLineIf(objectProperties.VersionList != null, "Version List={0};", objectProperties.VersionList);
     writer.EndSection();
 }