コード例 #1
0
 /// <summary>
 ///
 /// </summary>
 private void Connet()
 {
     try
     {
         var manifestData = _bundle.GetBundleManifestData();
         var serverIp     = string.Empty;
         var serverPort   = int.MinValue;
         foreach (XmlNode childNode in manifestData.ChildNodes)
         {
             if (childNode.Name == "ServerIP")
             {
                 if (childNode.Attributes != null)
                 {
                     serverIp = childNode.Attributes["Value"].Value;
                 }
             }
             if (childNode.Name == "ServerPort")
             {
                 if (childNode.Attributes != null)
                 {
                     serverPort = int.Parse(childNode.Attributes["Value"].Value);
                 }
             }
         }
         this.Connect(serverIp, serverPort);
     }
     catch (Exception)
     {
         this.Disconnect();
     }
 }
コード例 #2
0
ファイル: ConfigHelper.cs プロジェクト: yuan228410/OSGi.NET
        /// <summary>
        ///
        /// </summary>
        /// <param name="nodeName"></param>
        /// <returns></returns>
        public string GetManifestConfigValue(string nodeName)
        {
            var manifestData = _bundle.GetBundleManifestData();
            var rValue       = string.Empty;

            foreach (XmlNode childNode in manifestData.ChildNodes)
            {
                if (childNode.Name == nodeName)
                {
                    if (childNode.Attributes != null)
                    {
                        rValue = childNode.Attributes["Value"].Value;
                    }
                }
            }
            return(rValue.Trim());
        }