コード例 #1
0
        public override string ToString()
        {
            switch (Type)
            {
            case GCodeCommandPartType.Space:
                return(SpaceString.OfLength((int)Number));

            case GCodeCommandPartType.CharacterAndNumber:
                return(new StringBuilder(capacity: 6).Append(Character).Append(Number).ToString());

            case GCodeCommandPartType.Comment:
                return(';' + Text);

            case GCodeCommandPartType.Text:
                return(Text);

            default: throw new Exception("Internal error");
            }
        }
コード例 #2
0
        public void WriteTo(TextWriter writer)
        {
            switch (Type)
            {
            case GCodeCommandPartType.Space:
                writer.Write(SpaceString.OfLength((int)Number));
                break;

            case GCodeCommandPartType.CharacterAndNumber:
                writer.Write(Character);
                writer.Write(Number.ToString("##0.#####"));
                break;

            case GCodeCommandPartType.Comment:
                writer.Write(';');
                writer.Write(Text);
                break;

            default: throw new Exception("Internal error");
            }
        }