コード例 #1
0
 public bool Load(XmlHelper xh, XmlNode parent) // use new xml system -SHS
 {
     bool retval = false;
     XmlNode mdc = xh.FindSection(parent, "MotorsDriverConfig");
     m_drivertype = (eDriverType)xh.GetEnum(mdc, "DriverType", typeof(eDriverType), eDriverType.eGENERIC);
     if (m_connection.Load(xh, mdc))
     {
         retval = true;
     }
     return retval;
 }
コード例 #2
0
 public bool Save(XmlHelper xh, XmlNode parent) // use new xml system -SHS
 {
     XmlNode cps = xh.FindSection(parent, "ComPortSettings");
     xh.SetParameter(cps, "PortName", comname);
     xh.SetParameter(cps, "Speed", speed);
     xh.SetParameter(cps, "Databits", databits);
     xh.SetParameter(cps, "Parity", parity);
     xh.SetParameter(cps, "Stopbits", stopbits);
     xh.SetParameter(cps, "Handshake", handshake);
     return true;
 }
コード例 #3
0
        public bool Save(XmlHelper xh, XmlNode parent) // use new xml system -SHS
        {
            bool retval = false;
            XmlNode mdc = xh.FindSection(parent, "MotorsDriverConfig");
            xh.SetParameter(mdc, "DriverType", m_drivertype);
            if (m_connection.Save(xh, mdc))
            {
                retval = true;
            }

            return retval;
        }
コード例 #4
0
        public bool Load(XmlHelper xh, XmlNode parent) // use new xml system -SHS
        {
            bool    retval = false;
            XmlNode mdc    = xh.FindSection(parent, "MotorsDriverConfig");

            m_drivertype = (eDriverType)xh.GetEnum(mdc, "DriverType", typeof(eDriverType), eDriverType.eGENERIC);
            if (m_connection.Load(xh, mdc))
            {
                retval = true;
            }
            return(retval);
        }
コード例 #5
0
        public bool Load(XmlHelper xh, XmlNode parent)  // use new xml system -SHS
        {
            XmlNode cps = xh.FindSection(parent, "ComPortSettings");
            comname = xh.GetString(cps, "PortName", "Com1");
            speed = xh.GetInt(cps, "Speed", 115200);
            databits = xh.GetInt(cps, "Databits", 8);
            parity = (Parity)xh.GetEnum(cps, "Parity", typeof(Parity), Parity.None);
            stopbits = (StopBits)xh.GetEnum(cps, "Stopbits", typeof(StopBits), StopBits.One);
            handshake = (Handshake)xh.GetEnum(cps, "Handshake", typeof(Handshake), Handshake.None);
            return true;

        }
コード例 #6
0
        public bool Save(XmlHelper xh, XmlNode parent) // use new xml system -SHS
        {
            XmlNode cps = xh.FindSection(parent, "ComPortSettings");

            xh.SetParameter(cps, "PortName", comname);
            xh.SetParameter(cps, "Speed", speed);
            xh.SetParameter(cps, "Databits", databits);
            xh.SetParameter(cps, "Parity", parity);
            xh.SetParameter(cps, "Stopbits", stopbits);
            xh.SetParameter(cps, "Handshake", handshake);
            return(true);
        }
コード例 #7
0
        public bool Load(XmlHelper xh, XmlNode parent)  // use new xml system -SHS
        {
            XmlNode cps = xh.FindSection(parent, "ComPortSettings");

            comname   = xh.GetString(cps, "PortName", "Com1");
            speed     = xh.GetInt(cps, "Speed", 115200);
            databits  = xh.GetInt(cps, "Databits", 8);
            parity    = (Parity)xh.GetEnum(cps, "Parity", typeof(Parity), Parity.None);
            stopbits  = (StopBits)xh.GetEnum(cps, "Stopbits", typeof(StopBits), StopBits.One);
            handshake = (Handshake)xh.GetEnum(cps, "Handshake", typeof(Handshake), Handshake.None);
            return(true);
        }
コード例 #8
0
        public bool Save(XmlHelper xh, XmlNode parent) // use new xml system -SHS
        {
            bool    retval = false;
            XmlNode mdc    = xh.FindSection(parent, "MotorsDriverConfig");

            xh.SetParameter(mdc, "DriverType", m_drivertype);
            if (m_connection.Save(xh, mdc))
            {
                retval = true;
            }

            return(retval);
        }
コード例 #9
0
        public bool Save(XmlHelper xh, XmlNode parent) // use new xml system -SHS
        {
            XmlNode mdc = xh.FindSection(parent, "MonitorDriverConfig");

            xh.SetParameter(mdc, "DLP_X_Res", m_XDLPRes);
            xh.SetParameter(mdc, "DLP_Y_Res", m_YDLPRes);
            // m_Xpixpermm and m_Ypixpermm are calculated dinamically, no need to save/load
            //xh.SetParameter(mdc, "PixPermmX", m_Xpixpermm);
            //xh.SetParameter(mdc, "PixPermmY", m_Ypixpermm);
            xh.SetParameter(mdc, "MonitorID", m_monitorid);
            xh.SetParameter(mdc, "DisplayCommEnabled", m_displayconnectionenabled);
            m_displayconnection.Save(xh, mdc);
            return(true);
        }
コード例 #10
0
        public bool Load(XmlHelper xh, XmlNode parent)
        {
            XmlNode mdc = xh.FindSection(parent, "MonitorDriverConfig");

            m_XDLPRes = xh.GetDouble(mdc, "DLP_X_Res", 1024.0);
            m_YDLPRes = xh.GetDouble(mdc, "DLP_Y_Res", 768.0);
            // m_Xpixpermm and m_Ypixpermm are calculated dinamically, no need to save/load
            //m_Xpixpermm = xh.GetDouble(mdc, "PixPermmX", 10.0);
            //m_Ypixpermm = xh.GetDouble(mdc, "PixPermmY", 10.0);
            m_monitorid = xh.GetString(mdc, "MonitorID", "");
            m_displayconnectionenabled = xh.GetBool(mdc, "DisplayCommEnabled", false);
            m_displayconnection.Load(xh, mdc);
            return(true);
        }
コード例 #11
0
        public bool Load(string scenename)
        {
            try
            {
                ZipFile zip = ZipFile.Read(scenename);
                string xmlname = "manifest.xml";
                ZipEntry manifestentry = zip[xmlname];
                //create new manifest xml doc
                XmlHelper manifest = new XmlHelper();
                //get memory stream
                MemoryStream manistream = new MemoryStream();
                //extract the stream
                manifestentry.Extract(manistream);
                //read from stream
                manistream.Seek(0, SeekOrigin.Begin); // rewind the stream for reading
                manifest.LoadFromStream(manistream, "manifest");
                //examine manifest
                //find the node with models
                XmlNode topnode = manifest.m_toplevel;
                XmlNode models = manifest.FindSection(topnode, "Models");
                List<XmlNode> modelnodes = manifest.FindAllChildElement(models, "model");
                foreach (XmlNode nd in modelnodes)
                {
                    string name = manifest.GetString(nd, "name", "noname");
                    string modstlname = name + ".stl";
                    int tag = manifest.GetInt(nd, "tag", 0);
                    ZipEntry modelentry = zip[modstlname]; // the model name will have the _XXXX on the end with the stl extension
                    MemoryStream modstr = new MemoryStream();
                    modelentry.Extract(modstr);
                    //rewind to beginning
                    modstr.Seek(0, SeekOrigin.Begin);
                    //fix the name
                    name = name.Substring(0, name.Length - 5);// get rid of the _XXXX at the end
                    if (tag == Object3d.OBJ_SUPPORT)
                    {
                        Support s = new Support();
                        //load the model
                        s.LoadSTL_Binary(modstr, name);
                        //add to the 3d engine
                        UVDLPApp.Instance().m_engine3d.AddObject(s);
                        //set the tag
                        s.tag = tag;
                        string parent = manifest.GetString(nd, "parent", "noname");
                        s.SetColor(System.Drawing.Color.Yellow);
                        //find and set the parent
                        Object3d tmp = UVDLPApp.Instance().m_engine3d.Find(parent);
                        if (tmp != null)
                        {
                            tmp.AddSupport(s);
                        }
                    }
                    else
                    {
                        //load as normal object
                        Object3d obj = new Object3d();
                        //load the model
                        obj.LoadSTL_Binary((MemoryStream)modstr, name);
                        //add to the 3d engine
                        UVDLPApp.Instance().m_engine3d.AddObject(obj);
                        //set the tag
                        obj.tag = tag;
                    }
                }

                return true;
            }
            catch (Exception ex)
            {
                DebugLogger.Instance().LogError(ex);
                return false;
            }
        }
コード例 #12
0
 public bool Load(XmlHelper xh, XmlNode parent)
 {
     XmlNode mdc = xh.FindSection(parent, "MonitorDriverConfig");
     m_XDLPRes = xh.GetDouble(mdc, "DLP_X_Res", 1024.0);
     m_YDLPRes = xh.GetDouble(mdc, "DLP_Y_Res", 768.0);
     // m_Xpixpermm and m_Ypixpermm are calculated dinamically, no need to save/load
     //m_Xpixpermm = xh.GetDouble(mdc, "PixPermmX", 10.0);
     //m_Ypixpermm = xh.GetDouble(mdc, "PixPermmY", 10.0);
     m_monitorid = xh.GetString(mdc, "MonitorID", "");
     m_displayconnectionenabled = xh.GetBool(mdc, "DisplayCommEnabled", false);
     m_displayconnection.Load(xh, mdc);
     return true;
 }
コード例 #13
0
 // use new xml system -SHS
 public bool Save(XmlHelper xh, XmlNode parent)
 {
     XmlNode mdc = xh.FindSection(parent, "MonitorDriverConfig");
     xh.SetParameter(mdc, "DLP_X_Res", m_XDLPRes);
     xh.SetParameter(mdc, "DLP_Y_Res", m_YDLPRes);
     // m_Xpixpermm and m_Ypixpermm are calculated dinamically, no need to save/load
     //xh.SetParameter(mdc, "PixPermmX", m_Xpixpermm);
     //xh.SetParameter(mdc, "PixPermmY", m_Ypixpermm);
     xh.SetParameter(mdc, "MonitorID", m_monitorid);
     xh.SetParameter(mdc, "DisplayCommEnabled", m_displayconnectionenabled);
     m_displayconnection.Save(xh, mdc);
     return true;
 }