Beispiel #1
0
        private void LoadCache(string key, object val, CacheItemRemovedReason reason)
        {
roop:
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(XMLPath + URL_MAP);
                this.Cache.Add("MAP", XML2JSON.ToJSON(doc.DocumentElement), new CacheDependency(XMLPath + URL_MAP), DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, new CacheItemRemovedCallback(LoadCache));
                doc.Load(XMLPath + URL_CLS);
                this.Cache.Add("CLS", XML2JSON.ToJSON(doc.DocumentElement), new CacheDependency(XMLPath + URL_CLS), DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, new CacheItemRemovedCallback(LoadCache));
                doc.Load(XMLPath + URL_SVR);

                //load oracle config
                XmlNode nd       = doc.SelectSingleNode("SZCS/SERVER");
                string  service  = nd.SelectSingleNode("SERVICE").InnerText.Trim();
                string  user     = nd.SelectSingleNode("USERNAME").InnerText.Trim();
                string  password = nd.SelectSingleNode("PASSWORD").InnerText.Trim();
                string  str      = "Data Source=" + service + ";User Id=" + user + ";Password="******";";
                this.Cache.Add("ORASTR", str, new CacheDependency(XMLPath + URL_SVR), DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, new CacheItemRemovedCallback(LoadCache));
                OraHelper.str = str;

                nd = doc.SelectSingleNode("SZCS/DIRECTORYS");
                string Vphypath = nd.SelectSingleNode("VIDEO/PHYPATH").InnerText.Trim();
                string Vwebpath = nd.SelectSingleNode("VIDEO/WEBPATH").InnerText.Trim();

                string Iphypath = nd.SelectSingleNode("IMAGE/PHYPATH").InnerText.Trim();
                string Iwebpath = nd.SelectSingleNode("IMAGE/WEBPATH").InnerText.Trim();

                string Sphypath = nd.SelectSingleNode("SNAPCACHE/PHYPATH").InnerText.Trim();
                string Swebpath = nd.SelectSingleNode("SNAPCACHE/WEBPATH").InnerText.Trim();


                this.Cache.Add("VIDEOPATH", Vphypath, new CacheDependency(XMLPath + URL_SVR), DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, new CacheItemRemovedCallback(LoadCache));
                this.Cache.Add("VIDEOURL", Vwebpath, new CacheDependency(XMLPath + URL_SVR), DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, new CacheItemRemovedCallback(LoadCache));
                this.Cache.Add("IMAGEPATH", Iphypath, new CacheDependency(XMLPath + URL_SVR), DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, new CacheItemRemovedCallback(LoadCache));
                this.Cache.Add("IMAGEURL", Iwebpath, new CacheDependency(XMLPath + URL_SVR), DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, new CacheItemRemovedCallback(LoadCache));
                this.Cache.Add("CACHEPATH", Sphypath, new CacheDependency(XMLPath + URL_SVR), DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, new CacheItemRemovedCallback(LoadCache));
                this.Cache.Add("CACHEURL", Swebpath, new CacheDependency(XMLPath + URL_SVR), DateTime.MaxValue, TimeSpan.Zero, CacheItemPriority.Normal, new CacheItemRemovedCallback(LoadCache));
            }
            catch (Exception ex)
            {
                System.Windows.Forms.Application.DoEvents();
                goto roop;
            }
        }
Beispiel #2
0
        public async Task <string> getOutputAsync()
        {
            string res = await HTTPRequestCaller.sendRequestAsync(this.url, this.input);

            return(XML2JSON.convert(res));
        }