コード例 #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);
     }
 }