示例#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);
     }
 }