public void Visit(TomlBool b) => data[currentPath] = b.Value.ToString(CultureInfo.InvariantCulture);
Ejemplo n.º 2
0
 void ITomlObjectVisitor.Visit(TomlBool b) =>
     sb.Append("{").Append("\"type\":\"bool\", \"value\":\"").Append(b.Value ? "true" : "false").Append("\"}");
Ejemplo n.º 3
0
 void ITomlObjectVisitor.Visit(TomlBool b) =>
 sb.Append("{").Append("\"type\":\"bool\", \"value\":\"").Append(b.Value ? "true" : "false").Append("\"}");
Ejemplo n.º 4
0
 void ITomlObjectVisitor.Visit(TomlBool b) => this.table[this.currentKey] = b.Value;
Ejemplo n.º 5
0
 public void Visit(TomlBool b) => this.Item = b.Value;
Ejemplo n.º 6
0
        /// <summary>
        /// Saves the current configuration out to the config file.
        /// </summary>
        public void Save()
        {
            // Physical Paramters
            TomlTable physicalParameters = Toml.Create();

            // Passes
            TomlInt passes = physicalParameters.Add("Passes", Passes).Added;

            passes.AddComment(" The number of times to run the complete etching path", CommentLocation.Append);

            // PixelSize
            TomlFloat pixelSize = physicalParameters.Add("PixelSize", PixelSize).Added;

            pixelSize.AddComment(" The size of each pixel (mm per pixel)", CommentLocation.Append);

            // OriginX
            TomlFloat originX = physicalParameters.Add("OriginX", OriginX).Added;

            originX.AddComment(" The X coordinate of the top-left corner, in mm", CommentLocation.Append);

            // OriginY
            TomlFloat originY = physicalParameters.Add("OriginY", OriginY).Added;

            originY.AddComment(" The Y coordinate of the top-left corner, in mm", CommentLocation.Append);

            // ZHeight
            TomlFloat zHeight = physicalParameters.Add("ZHeight", ZHeight).Added;

            zHeight.AddComment(" The Z height to set the laser cutter during etching, in mm", CommentLocation.Append);

            // TravelSpeed
            TomlFloat travelSpeed = physicalParameters.Add("TravelSpeed", TravelSpeed).Added;

            travelSpeed.AddComment(" The speed to move the head between etching operations (when the laser is off), in mm per minute", CommentLocation.Append);

            // EtchSpeed
            TomlFloat etchSpeed = physicalParameters.Add("EtchSpeed", EtchSpeed).Added;

            etchSpeed.AddComment(" The speed to move the head during etching operations (when the laser is on), in mm per minute", CommentLocation.Append);

            // G-code Commands
            TomlTable gCodeCommands = Toml.Create();

            // LaserOffCommand
            TomlString laserOffCommand = gCodeCommands.Add("LaserOffCommand", LaserOffCommand).Added;

            laserOffCommand.AddComment(" The G-code command to turn the laser off", CommentLocation.Append);

            // LaserLowCommand
            TomlString laserLowCommand = gCodeCommands.Add("LaserLowCommand", LaserLowCommand).Added;

            laserLowCommand.AddComment(" The G-code command to turn the laser on, but at a low power level (used for the pre-etch trace preview)", CommentLocation.Append);

            // LaserHighCommand
            TomlString laserHighCommand = gCodeCommands.Add("LaserHighCommand", LaserHighCommand).Added;

            laserHighCommand.AddComment(" The G-code command to turn the laser on full power during etching", CommentLocation.Append);

            // MoveCommand
            TomlString moveCommand = gCodeCommands.Add("MoveCommand", MoveCommand).Added;

            moveCommand.AddComment(" The G-code command to use during moves", CommentLocation.Append);

            // CommentMode
            TomlString commentMode = gCodeCommands.Add("CommentMode", CommentMode.ToString()).Added;

            commentMode.AddComment(" The G-code comment format to use (Semicolon or Parentheses)", CommentLocation.Append);

            // HomeXY
            TomlBool homeXY = gCodeCommands.Add("HomeXY", HomeXY).Added;

            homeXY.AddComment(" True to home the X and Y axes at the start, false to leave them where they were and assume that they are already homed", CommentLocation.Append);

            // Pre-Etch Trace Preview
            TomlTable preEtchTracePreview = Toml.Create();

            // IsBoundaryPreviewEnabled
            TomlBool isBoundaryPreviewEnabled = preEtchTracePreview.Add("IsBoundaryPreviewEnabled", IsBoundaryPreviewEnabled).Added;

            isBoundaryPreviewEnabled.AddComment(" True to perform the pre-etch boundary trace preview, false to disable it and get right to etching", CommentLocation.Append);

            // PreviewDelay
            TomlInt previewDelay = preEtchTracePreview.Add("PreviewDelay", PreviewDelay).Added;

            previewDelay.AddComment(" The delay, in milliseconds, to wait at the start and end of the pre-etch trace preview", CommentLocation.Append);

            TomlTable settingsTable = Toml.Create();

            settingsTable.Add("Physical-Parameters", physicalParameters);
            settingsTable.Add("G-Code-Commands", gCodeCommands);
            settingsTable.Add("Pre-Etch-Trace-Preview", preEtchTracePreview);

            Toml.WriteFile(settingsTable, ConfigFileName);
        }