public bool Save(XmlHelper xh, XmlNode parent) { XmlNode xnode = xh.AddSection(parent, "PowderConfig"); xh.SetParameter(xnode, "Name", name); xh.SetParameter(xnode, "PriceL", price); return(true); }
public bool Save(XmlHelper xh, XmlNode parent) { XmlNode xnode = xh.AddSection(parent, "InkConfig"); xh.SetParameter(xnode, "Name", Name); xh.SetParameter(xnode, "SliceHeight", ZThick); xh.SetParameter(xnode, "LayerTime", layertime_ms); xh.SetParameter(xnode, "FirstLayerTime", firstlayertime_ms); xh.SetParameter(xnode, "NumberofBottomLayers", numfirstlayers); xh.SetParameter(xnode, "ResinPriceL", resinprice); return true; }
public bool Save(XmlHelper xh, XmlNode parent) { XmlNode xnode = xh.AddSection(parent, "InkConfig"); xh.SetParameter(xnode, "Name", Name); xh.SetParameter(xnode, "SliceHeight", ZThick); xh.SetParameter(xnode, "LayerTime", layertime_ms); xh.SetParameter(xnode, "FirstLayerTime", firstlayertime_ms); xh.SetParameter(xnode, "NumberofBottomLayers", numfirstlayers); xh.SetParameter(xnode, "ResinPriceL", resinprice); return(true); }
// save to xml file -SHS public bool Save(String filename) { XmlHelper xh = new XmlHelper(); xh.StartNew(filename, "ProjectorCmdList"); foreach (ProjectorCommand pc in m_commands) { XmlNode nd = xh.AddSection(null, "Command"); xh.SetParameter(nd, "Name", pc.name); xh.SetParameter(nd, "IsHex", pc.hex); xh.SetParameter(nd, "Cmd", pc.command); } return xh.Save(FILE_VERSION); }
public bool Save(XmlHelper xh, XmlNode parent) // use new xml system -SHS { // XmlNode mdc = xh.FindSection(parent, "MonitorDriverConfig"); XmlNode mdc = xh.AddSection(parent, "MonitorDriverConfig"); xh.SetParameter(mdc, "DLP_X_Res", m_XDLPRes); // gotta make this auto.. xh.SetParameter(mdc, "DLP_Y_Res", m_YDLPRes); xh.SetParameter(mdc, "MonitorID", m_monitorid); xh.SetParameter(mdc, "DisplayCommEnabled", m_displayconnectionenabled); m_displayconnection.Save(xh, mdc); xh.SetParameter(mdc, "MonitorTop", m_monitorrect.top); xh.SetParameter(mdc, "MonitorLeft", m_monitorrect.left); xh.SetParameter(mdc, "MonitorRight", m_monitorrect.right); xh.SetParameter(mdc, "MonitorBottom", m_monitorrect.bottom); return true; }
public bool Save(XmlHelper xh, XmlNode parent) // use new xml system -SHS { // XmlNode mdc = xh.FindSection(parent, "MonitorDriverConfig"); XmlNode mdc = xh.AddSection(parent, "MonitorDriverConfig"); xh.SetParameter(mdc, "DLP_X_Res", m_XDLPRes); // gotta make this auto.. xh.SetParameter(mdc, "DLP_Y_Res", m_YDLPRes); xh.SetParameter(mdc, "MonitorID", m_monitorid); xh.SetParameter(mdc, "DisplayCommEnabled", m_displayconnectionenabled); m_displayconnection.Save(xh, mdc); xh.SetParameter(mdc, "MonitorTop", m_monitorrect.top); xh.SetParameter(mdc, "MonitorLeft", m_monitorrect.left); xh.SetParameter(mdc, "MonitorRight", m_monitorrect.right); xh.SetParameter(mdc, "MonitorBottom", m_monitorrect.bottom); return(true); }
/// <summary> /// Save the entire scene into a zip file with a manifest /// This file will later be re-used to store png slicee, gcode & svg /// </summary> /// <param name="scenename"></param> /// <returns></returns> public bool SaveOld(string scenefilename) { try { UVDLPApp.Instance().SceneFileName = scenefilename; // open a zip file with the scenename // iterate through all objects in engine string xmlname = "manifest.xml"; XmlHelper manifest = new XmlHelper(); //start the doc with no filename, becasue we're saving to a memory stream manifest.StartNew("", "manifest"); //start a new stream to store the manifest file MemoryStream manifeststream = new MemoryStream(); //create a new zip file ZipFile zip = new ZipFile(); //get the top-level node in the manifest //XmlNode mc = manifest.m_toplevel; // Add in a section for GCode if present XmlNode gcn = manifest.AddSection(manifest.m_toplevel, "GCode"); if (UVDLPApp.Instance().m_gcode != null) { //create the name of the gcode file String GCodeFileName = Path.GetFileNameWithoutExtension(scenefilename) + ".gcode"; manifest.SetParameter(gcn, "filename", GCodeFileName); Stream gcs = new MemoryStream(); //save to memory stream UVDLPApp.Instance().m_gcode.Save(gcs); //rewind gcs.Seek(0, SeekOrigin.Begin); //create new zip entry zip.AddEntry(GCodeFileName, gcs); } XmlNode mc = manifest.AddSection(manifest.m_toplevel, "Models"); //we need to make sure that only unique names are put in the zipentry // cloned objects yield the same name List<string> m_uniquenames = new List<string>(); // we can adda 4-5 digit code to the end here to make sure names are unique int id = 0; string idstr; foreach (Object3d obj in UVDLPApp.Instance().m_engine3d.m_objects) { //create a unique id to post-fix item names id++; idstr = string.Format("{0:0000}", id); idstr = "_" + idstr; //create a new memory stream MemoryStream ms = new MemoryStream(); //save the object to the memory stream obj.SaveSTL_Binary(ref ms); //rewind the stream to the beginning ms.Seek(0, SeekOrigin.Begin); //get the file name with no extension string objname = Path.GetFileNameWithoutExtension(obj.Name); //spaces cause this to blow up too objname = objname.Replace(' ', '_'); // add a value to the end of the string to make sure it's a unique name objname = objname + idstr; string objnameNE = objname; objname += ".stl"; // stl file zip.AddEntry(objname, ms); //create an entry for this object, using the object name with no extension //save anything special about it //XmlNode objnode = manifest.AddSection(mc, objnameNE); XmlNode objnode = manifest.AddSection(mc, "model"); manifest.SetParameter(objnode, "name", objnameNE); manifest.SetParameter(objnode, "tag", obj.tag); if (obj.tag != Object3d.OBJ_NORMAL && obj.m_parrent != null) { // note it's parent name in the entry manifest.SetParameter(objnode, "parent", Path.GetFileNameWithoutExtension(obj.m_parrent.Name)); } } //save the gcode //save the XML document to memorystream manifest.Save(1, ref manifeststream); manifeststream.Seek(0, SeekOrigin.Begin); //manifeststream. //save the memorystream for the xml metadata manifest into the zip file zip.AddEntry(xmlname, manifeststream); //save the zip file zip.Save(scenefilename); return true; } catch (Exception ex) { DebugLogger.Instance().LogError(ex); } return false; }