예제 #1
0
        private void ReadMsgType(string name, XmlNode parentNode)
        {
            var nameCode = "";
            foreach (var c in name)
            {
                if (c <= '9') nameCode = nameCode + c;
                else
                {
                    int num = c;
                    nameCode = nameCode + num;
                }
            }

            var urlStr = tbURLMsgType.Text.Replace("<tag>", name);
            urlStr = urlStr.Replace("<tagcode>", nameCode);

            var req = WebRequest.Create(urlStr);
            var stream = req.GetResponse().GetResponseStream();
            var sr = new StreamReader(stream);
            var data = sr.ReadToEnd();

            var tag = new FixTag(data, name, urlStr);
            tag.SaveInXML(parentNode);
        }
예제 #2
0
        private void ReadTagInfo(int num, XmlNode parentNode)
        {
            var urlStr = tbURL.Text.Replace("<num>", num.ToString());
            var req = WebRequest.Create(urlStr);
            //req.Proxy = WebProxy.GetDefaultProxy();

            var stream = req.GetResponse().GetResponseStream();
            var sr = new StreamReader(stream);
            var data = sr.ReadToEnd();

            var tag = new FixTag(data, num.ToString(), urlStr);
            tag.SaveInXML(parentNode);
        }
예제 #3
0
 public static Dictionary<string, FixTag> ReadTags(XmlNode parentNode)
 {
     var dic = new Dictionary<string, FixTag>();
     foreach (XmlElement node in parentNode.ChildNodes)
     {
         var tag = new FixTag();
         if (node.Attributes["Title"] != null)
             tag.Title = node.Attributes["Title"].Value;
         if (node.Attributes["Description"] != null)
             tag.Description = node.Attributes["Description"].Value;
         if (node.Attributes["URL"] != null)
             tag.URL = node.Attributes["URL"].Value;
         if (node.Attributes["Num"] != null)
             tag.Num = node.Attributes["Num"].Value;
         dic.Add(tag.Num, tag);
     }
     return dic;
 }