예제 #1
0
        }                                  //obtained from OKAPI with method services/users/by_username

        public virtual void LoadSettings()
        {
            try
            {
                string doc;
                using (StreamReader textStreamReader = new StreamReader(Assembly.GetExecutingAssembly().GetManifestResourceStream("GlobalcachingApplication.Plugins.OKAPI.ConsumerKeys.xml")))
                {
                    doc = textStreamReader.ReadToEnd();
                }
                XmlDocument xdoc = new XmlDocument();
                xdoc.LoadXml(doc);
                XmlNode n = xdoc.SelectSingleNode(string.Format("/keys/{0}", GeocodePrefix));
                if (n != null)
                {
                    ConsumerKey    = n.SelectSingleNode("ConsumerKey").InnerText;
                    ConsumerSecret = n.SelectSingleNode("ConsumerSecret").InnerText;
                }

                if (ConsumerKey == null || ConsumerKey.IndexOf(' ') > 0)
                {
                    ConsumerKey = "";
                }
                if (ConsumerSecret == null || ConsumerSecret.IndexOf(' ') > 0)
                {
                    ConsumerSecret = "";
                }
            }
            catch
            {
            }
        }
예제 #2
0
        public virtual void LoadSettings()
        {
            try
            {
                string      doc  = Utils.ResourceHelper.GetEmbeddedTextFile("/OKAPI/ConsumerKeys.xml");
                XmlDocument xdoc = new XmlDocument();
                xdoc.LoadXml(doc);
                XmlNode n = xdoc.SelectSingleNode(string.Format("/keys/{0}", GeocodePrefix));
                if (n != null)
                {
                    ConsumerKey    = n.SelectSingleNode("ConsumerKey").InnerText;
                    ConsumerSecret = n.SelectSingleNode("ConsumerSecret").InnerText;
                }

                if (ConsumerKey == null || ConsumerKey.IndexOf(' ') > 0)
                {
                    ConsumerKey = "";
                }
                if (ConsumerSecret == null || ConsumerSecret.IndexOf(' ') > 0)
                {
                    ConsumerSecret = "";
                }
            }
            catch
            {
            }
        }