Exemplo n.º 1
0
        public override string ToString()
        {
            var builder = new StringBuilder();

            CfgNodeWriter.InitializeNode("PART", 1, builder);

            CfgNodeWriter.WriteValues(Fields.GetAll(), 1, builder);

            if (Events != null)
            {
                builder.AppendLine(CfgNodeWriter.WriteConfigNode(Events));
            }
            if (Actions != null)
            {
                builder.AppendLine(CfgNodeWriter.WriteConfigNode(Actions));
            }
            if (Effects != null)
            {
                builder.AppendLine(CfgNodeWriter.WriteConfigNode(Effects));
            }
            if (Partdata != null)
            {
                builder.AppendLine(CfgNodeWriter.WriteConfigNode(Partdata));
            }

            foreach (var module in Modules.GetAll())
            {
                builder.AppendLine(CfgNodeWriter.WriteConfigNode(module.Value));
            }

            foreach (var resource in Resources.GetAll())
            {
                builder.AppendLine(CfgNodeWriter.WriteConfigNode(resource.Value));
            }

            if (VesselNaming != null)
            {
                builder.AppendLine(CfgNodeWriter.WriteConfigNode(VesselNaming));
            }

            CfgNodeWriter.FinishNode(1, builder);

            return(builder.ToString());
        }
Exemplo n.º 2
0
        public override string ToString()
        {
            var builder = new StringBuilder();

            CfgNodeWriter.WriteValues(Fields.GetAll(), 0, builder);

            CfgNodeWriter.InitializeNode("ORBIT", 0, builder);
            CfgNodeWriter.WriteValues(Orbit.GetAll(), 1, builder);
            CfgNodeWriter.FinishNode(0, builder);
            builder.AppendLine();

            foreach (var part in Parts.GetAllValues())
            {
                builder.AppendLine(part.ToString());
            }

            CfgNodeWriter.InitializeNode("ACTIONGROUPS", 0, builder);
            CfgNodeWriter.WriteValues(ActionGroups.GetAll(), 1, builder);
            CfgNodeWriter.FinishNode(0, builder);
            builder.AppendLine();

            builder.AppendLine(CfgNodeWriter.WriteConfigNode(Discovery));
            builder.AppendLine(CfgNodeWriter.WriteConfigNode(FlightPlan));
            if (Target != null)
            {
                builder.AppendLine(CfgNodeWriter.WriteConfigNode(Target));
            }
            if (Waypoint != null)
            {
                builder.AppendLine(CfgNodeWriter.WriteConfigNode(Waypoint));
            }
            builder.AppendLine(CfgNodeWriter.WriteConfigNode(CtrlState));
            builder.AppendLine(CfgNodeWriter.WriteConfigNode(VesselModules));

            return(builder.ToString().TrimEnd());
        }