public void PushData(string code) { code = code.Replace('\r', '\n'); string[] lines = code.Split('\n'); foreach (string line in lines) { if (line.Length == 0) { continue; } GCode gcode = new GCode(); gcode.Parse(line); if (!gcode.comment) { jobList.AddLast(new GCodeCompressed(gcode)); totalLines++; } } }
public void PushGCodeShortArray(List <GCodeShort> codes) { foreach (GCodeShort line in codes) { if (line.Length == 0) { continue; } ana.analyzeShort(line); GCode gcode = new GCode(); gcode.Parse(line.text); if (!gcode.comment) { jobList.AddLast(new GCodeCompressed(gcode)); totalLines++; } if (line.hasLayer) { maxLayer = line.layer; } } computedPrintingTime = ana.printingTime; }
public void PushGCodeShortArray(List<GCodeShort> codes) { foreach (GCodeShort line in codes) { if (line.Length == 0) continue; ana.analyzeShort(line); GCode gcode = new GCode(); gcode.Parse(line.text); if (!gcode.comment) { jobList.AddLast(new GCodeCompressed(gcode)); totalLines++; } if (line.hasLayer) maxLayer = line.layer; } computedPrintingTime = ana.printingTime; }
public void PushData(string code) { code = code.Replace('\r', '\n'); string[] lines = code.Split('\n'); foreach (string line in lines) { if (line.Length == 0) continue; GCode gcode = new GCode(); gcode.Parse(line); if (!gcode.comment) { jobList.AddLast(new GCodeCompressed(gcode)); totalLines++; } } }
public void ParseText(string text, bool clear) { GCode gc = new GCode(); if (clear) Clear(); foreach (string s in text.Split('\n')) { gc.Parse(s); AddGCode(gc); } }
private void writeString(BinaryWriter file, string code, bool binary) { GCode gc = new GCode(); gc.Parse(code); if (gc.hostCommand) return; if (binary) { if (gc.hasCode) { byte[] data = gc.getBinary(1); file.Write(data); } } else { System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); string cmd = gc.getAscii(false, false); if (cmd.Length > 0) file.Write(enc.GetBytes(cmd + "\n")); } }
private void writeArray(BinaryWriter file, List<GCodeShort> list, bool binary) { foreach (GCodeShort code in list) { GCode gc = new GCode(); gc.Parse(code.text); if (gc.hostCommand) continue; if (binary) { if (gc.hasCode) { byte[] data = gc.getBinary(1); file.Write(data); } } else { System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); string cmd = gc.getAscii(false, false); if (cmd.Length > 0) file.Write(enc.GetBytes(cmd + "\n")); } } }