Beispiel #1
0
        public void ShortUrlTest()
        {
            string[] s = GenerateUrl.ShortUrl("http://www.baidu.com");

            string ddd = GenerateUrl.Short(123243343);
            long   a   = GenerateUrl.UnShort("8l7dR");//123243343

            ///Trace.WriteLine(s);
            Assert.AreEqual(1, 1);
        }
Beispiel #2
0
        public InjectOptions()
        {
            var appSettings = new ConfigurationBuilder()
                              .AddJsonFile("appsettings.json", true, true)
                              .Build();

            Authentication      = new Authentication(appSettings["AppSettings:Username"], appSettings["AppSettings:Password"]);
            GenerateQueryString = new GenerateQueryString();
            GenerateUrl         = new GenerateUrl(appSettings["AppSettings:SmsGateway"]);

            SmsRequest = new SmsRequest(appSettings["AppSettings:ReponseType"], appSettings["AppSettings:MockMode"])
            {
                GenerateUrl    = GenerateUrl,
                Authentication = Authentication
            };

            SmsLogger = new SmsLogger();
        }
Beispiel #3
0
        private AddressComponent GetGeocoderForPositionByBaidu(double latitude, double longitude)
        {
            //Console.WriteLine("Latitude: {0}, Longitude {1}", latitude, longitude);
            //********http://api.map.baidu.com/geocoder?location=24.363,109.402&output=json&key=elxrPCAh6eQyyBwqk62NGpKMxhTh1az1

            string staticAddress = "http://api.map.baidu.com/geocoder?";
            string location      = string.Format("{0},{1}", latitude, longitude);

            string url = string.Format("{0}location={1}&output=json&key={2}", staticAddress, location, _ak);

            try
            {
                string           result  = GenerateUrl.Get(url);
                AddressComponent address = AnalyticalData.AnalyticalData_obj(result);
                return(address);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"获取具体地址失败,请稍后右键任务栏小图标点击刷新!", "提示");
                return(null);
            }
        }