예제 #1
0
파일: Instance.cs 프로젝트: ytchhh/scada
        /// <summary>
        /// Loads the instance configuration from the XML node.
        /// </summary>
        public void LoadFromXml(XmlNode xmlNode)
        {
            if (xmlNode == null)
            {
                throw new ArgumentNullException("xmlNode");
            }

            Name = xmlNode.GetChildAsString("Name");

            if (xmlNode.SelectSingleNode("ServerApp") is XmlElement serverAppElem)
            {
                ServerApp.LoadFromXml(serverAppElem);
            }

            if (xmlNode.SelectSingleNode("CommApp") is XmlElement commAppElem)
            {
                CommApp.LoadFromXml(commAppElem);
            }

            if (xmlNode.SelectSingleNode("WebApp") is XmlElement webAppElem)
            {
                WebApp.LoadFromXml(webAppElem);
            }

            DeploymentProfile = xmlNode.GetChildAsString("DeploymentProfile");
        }
예제 #2
0
파일: Instance.cs 프로젝트: ytchhh/scada
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 public Instance()
 {
     Name              = "";
     ServerApp         = new ServerApp();
     CommApp           = new CommApp();
     WebApp            = new WebApp();
     DeploymentProfile = "";
     InstanceDir       = "";
     AppSettingsLoaded = false;
 }
예제 #3
0
        private string instanceDir; // the instance directory inside the project


        /// <summary>
        /// Initializes a new instance of the class.
        /// </summary>
        public ProjectInstance()
        {
            ID                = 0;
            Name              = "";
            ServerApp         = new ServerApp();
            CommApp           = new CommApp();
            WebApp            = new WebApp();
            AllApps           = new ProjectApp[] { ServerApp, CommApp, WebApp };
            DeploymentProfile = "";
            InstanceDir       = "";
        }
예제 #4
0
파일: Instance.cs 프로젝트: ytchhh/scada
        /// <summary>
        /// Saves the instance configuration into the XML node.
        /// </summary>
        public void SaveToXml(XmlElement xmlElem)
        {
            if (xmlElem == null)
            {
                throw new ArgumentNullException("xmlElem");
            }

            xmlElem.AppendElem("Name", Name);
            ServerApp.SaveToXml(xmlElem.AppendElem("ServerApp"));
            CommApp.SaveToXml(xmlElem.AppendElem("CommApp"));
            WebApp.SaveToXml(xmlElem.AppendElem("WebApp"));
            xmlElem.AppendElem("DeploymentProfile", DeploymentProfile);
        }
예제 #5
0
파일: Instance.cs 프로젝트: ytchhh/scada
 /// <summary>
 /// Loads the application settings if needed.
 /// </summary>
 public bool LoadAppSettings(out string errMsg)
 {
     if (AppSettingsLoaded)
     {
         errMsg = "";
         return(true);
     }
     else if ((!ServerApp.Enabled || ServerApp.LoadSettings(out errMsg)) &&
              (!CommApp.Enabled || CommApp.LoadSettings(out errMsg)))
     {
         AppSettingsLoaded = true;
         errMsg            = "";
         return(true);
     }
     else
     {
         return(false);
     }
 }