Beispiel #1
0
        public string RefshNowProblem()
        {
            string url = "https://www.lintcode.com/api/problems/?page=";
            var    a   = JsonConvert.DeserializeObject <ProblemList>(HttpUitls.Get(url + "1"));

            flag : var pageCount = new Random().Next(0, a.maximum_page);
            var            b = JsonConvert.DeserializeObject <ProblemList>(HttpUitls.Get(url + pageCount.ToString()));
            List <Problem> l = new List <Problem>();

            foreach (var p in b.problems)
            {
                if (p.status == 1)
                {
                    l.Add(p);
                }
            }
            if (l.Count == 0)
            {
                goto flag;
            }

            var problemCount = new Random().Next(0, l.Count());
            var problem      = b.problems[problemCount];

            string url2 = "https://www.lintcode.com/api/problems/detail/?unique_name_or_alias=" + problem.unique_name + "&_format=detail";
            var    d    = JsonConvert.DeserializeObject <ProblemDetial>(HttpUitls.Get(url2));

            ConfigManager.Instance().problem = d;
            ConfigManager.Instance().refshProblemDateTime = DateTime.Now;
            ConfigManager.Instance().pushProblemCount     = 0;

            return(d.description + "\n" + d.example);
        }
Beispiel #2
0
        public string GetRundomRoblemToTag(string key)
        {
            var reStr = HttpUitls.Get(api + "/" + key);
            var model = JsonConvert.DeserializeObject <QuestionModel>(reStr);

            return("[提问]" + model.Title + "\n" + "[说明]" + model.Detail);
        }
        public CoinmarketcapTicker[] GetTickerList()
        {
            var reStr  = HttpUitls.Get(api);
            var models = JsonConvert.DeserializeObject <CoinmarketcapTicker[]>(reStr);

            return(models);
        }
Beispiel #4
0
        /// <summary>
        /// 执行验证登陆流程
        /// </summary>
        private void runtrustLogin()
        {
            Log.AddLog("N2", "开始验证登录……");
            DateTime startRun = DateTime.Now;

            try
            {
                // 执行验证登陆(随便请求个需要验证的 API)
                string rooms = HttpUitls.Get(apiURL + "/api/user/rooms", "DEFAULT", "Cookie",
                                             "Authorization=" + Features.Reg.GetRegKey(Registry.CurrentUser, @"SOFTWARE\SSTeam\SS-Tool-Box", "N2Token"));
                if (rooms != null && JObject.Parse(rooms)["status"].ToString() == "0")
                {
                    Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
                    {
                        // 验证登录成功,切换到登录状态
                        isLogined                 = true;
                        panLogin.Visibility       = Visibility.Collapsed;
                        panLoginInouts.Visibility = Visibility.Collapsed;

                        Login.Visibility     = Visibility.Collapsed;
                        LoginOut.Visibility  = Visibility.Collapsed;
                        LoginWait.Visibility = Visibility.Visible;

                        LoginButton.IsEnabled = true;

                        panLogin.Margin    = new Thickness(0, 0, 0, 15);
                        panLoginTitle.Text = "N2 Station 账户";
                        // 显示房间卡片
                        panRoom.Visibility  = Visibility.Visible;
                        panLogin.Visibility = Visibility.Visible;
                    });
                    UI.ToastHelper.Add("验证登录成功!");
                    Log.AddLog("N2", "验证登录完成,耗时:" + DateTime.Now.Subtract(startRun).TotalSeconds + "秒");
                    // 获取后续数据
                    getingStart();
                }
                else
                {
                    UI.ToastHelper.Add("验证登录失败!");
                    Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
                    {
                        panLogin.Visibility = Visibility.Visible;
                    });
                }
            }
            catch (Exception e)
            {
                UI.ToastHelper.Add("验证登录失败:" + e.Message);
                Log.AddErr("N2", "验证登录失败:" + e.Message);
            }
        }
Beispiel #5
0
 public void 一言API()
 {
     try
     {
         String saysuri = "https://v1.hitokoto.cn/";
         string GetJson = HttpUitls.Get(saysuri);
         if (GetJson.IndexOf("hitokoto") == -1)
         {
             Assert.Fail("发现错误(MAN - 001):获取一言内容为空。");
         }
     }
     catch (Exception ex)
     {
         Assert.Fail("" + ex);
     }
 }
Beispiel #6
0
        private void GetSukColors()
        {
            try
            {
                string url     = "https://srv.sukazyo.cc/api/color?version=1";
                string GetJson = HttpUitls.Get(url, "DEFALT");

                JObject             obj    = JObject.Parse(GetJson);
                JArray              jList  = JArray.Parse(obj["colors"].ToString());
                List <colorInfoVer> colors = new List <colorInfoVer>();

                for (int i = 0; i < jList.Count; ++i)
                {
                    JObject colorInfo = JObject.Parse(jList[i].ToString());
                    colors.Add(new colorInfoVer(colorInfo["name"].ToString(), colorInfo["color"].ToString()));
                }

                Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
                {
                    foreach (colorInfoVer colorInfo in colors)
                    {
                        ColorView view = new ColorView(colorInfo.name, "#" + colorInfo.color)
                        {
                            Margin = new Thickness(5, 15, 10, 0)
                        };
                        sukColors.Children.Add(view);
                    }

                    sukLoading.Visibility  = Visibility.Collapsed;
                    sukColorsEx.IsExpanded = false;
                });
            }
            catch (Exception e)
            {
                Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
                {
                    sukColorsEx.IsExpanded = true;
                    sukError.Visibility    = Visibility.Visible;
                    sukLoading.Visibility  = Visibility.Collapsed;
                    sukErrorText.Text      = e.Message;
                    Log.AddErr("ColorCard", e.ToString());
                });
            }
        }
Beispiel #7
0
        /// <summary>
        /// 执行登出流程
        /// </summary>
        private void runLoginOut()
        {
            Log.AddLog("N2", "开始登出……");
            DateTime startRun = DateTime.Now;
            string   rooms    = HttpUitls.Get(apiURL + "/api/auth/destroyToken", "DEFAULT", "Cookie",
                                              "Authorization=" + Features.Reg.GetRegKey(Registry.CurrentUser, @"SOFTWARE\SSTeam\SS-Tool-Box", "N2Token"));

            Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
            {
                panRoomCard.Children.Clear();
                panRoomLoading.Visibility = Visibility.Collapsed;
                panRomeError.Visibility   = Visibility.Collapsed;
                panLoginInouts.Visibility = Visibility.Visible;
                Login.Visibility          = Visibility.Visible;
                LoginOut.Visibility       = Visibility.Collapsed;
                LoginWait.Visibility      = Visibility.Collapsed;
            });
            Features.Reg.DelRegKey(Registry.CurrentUser, @"SOFTWARE\SSTeam\SS-Tool-Box", "N2Token");
            isLogined = false;
            Log.AddLog("N2", "登出完成,耗时:" + DateTime.Now.Subtract(startRun).TotalSeconds + "秒");
        }
Beispiel #8
0
        public NewsResult[] RequestBiQuanApi()
        {
            NewsResult[] reStr;

            try
            {
                reStr = new NewsResult[4];

                NewsResult jinseLatestNewsFlash = _jinseService.GetLatestNewsFlash().Result;
                if (jinseLatestNewsFlash != null)
                {
                    reStr[0] = jinseLatestNewsFlash;
                }

                NewsResult bishijieLatestNewsFlash = _bishijieService.GetLatestNewsFlash().Result;
                if (bishijieLatestNewsFlash != null)
                {
                    reStr[1] = bishijieLatestNewsFlash;
                }

                CoinNewsModel bitcoinLatestNewsFlash = JsonConvert.DeserializeObject <CoinNewsResultModel <CoinNewsModel> >(HttpUitls.Get(ConfigManager.pushNewsConfig.NewsServerURL + "/News/GetBitcoinLatestNewsFlash")).Data;
                if (bitcoinLatestNewsFlash != null)
                {
                    var model = new NewsResult
                    {
                        Success   = true,
                        From      = "【bitcoin】",
                        Content   = bitcoinLatestNewsFlash.Content,
                        NewsLevel = NewsLevel.Importent
                    };
                    reStr[2] = model;
                }

                CoinNewsModel OkexNotice = JsonConvert.DeserializeObject <CoinNewsResultModel <CoinNewsModel> >(HttpUitls.Get(ConfigManager.pushNewsConfig.NewsServerURL + "/News/GetOkexLatestNotice")).Data;
                if (OkexNotice != null)
                {
                    var model = new NewsResult
                    {
                        Success   = true,
                        From      = "【Okex】",
                        Content   = OkexNotice.Title + " " + OkexNotice.FromUrl,
                        NewsLevel = NewsLevel.Importent
                    };
                    reStr[3] = model;
                }
            }

            catch (Exception e)
            {
                reStr = new NewsResult[] {
                    new NewsResult
                    {
                        Success = false,
                        Content = e.ToString() + "\n席马达!程序BUG了,快召唤老铁来维修!"
                    }
                };
            }

            return(reStr);
        }
Beispiel #9
0
        /// <summary>
        /// 获取我的房间
        /// </summary>
        private void runGetRooms()
        {
            Log.AddLog("N2", "开始获取房间信息……");
            DateTime startRun = DateTime.Now;

            try
            {
                string rooms = HttpUitls.Get(apiURL + "/api/user/rooms", "DEFAULT", "Cookie",
                                             "Authorization=" + Features.Reg.GetRegKey(Registry.CurrentUser, @"SOFTWARE\SSTeam\SS-Tool-Box", "N2Token"));
                JObject obj = JObject.Parse(rooms);
                if (obj["status"].ToString() != "0")
                {
                    panRomeError.Visibility = Visibility.Visible;
                    panRoomErrorText.Text   = obj["status"].ToString();
                    return;
                }
                foreach (var item in obj["data"])
                {
                    string        json    = item.ToString().Substring(item.ToString().IndexOf("{"));
                    JObject       itemobj = JObject.Parse(json);
                    List <string> info    = new List <string>()
                    {
                        itemobj["_id"].ToString(),
                        itemobj["title"].ToString(),
                        itemobj["desc"].ToString(),
                    };
                    JArray        tagArray = JArray.Parse(itemobj["tag"].ToString());
                    List <string> tags     = new List <string>();
                    for (int i = 0; i < tagArray.Count; i++)
                    {
                        tags.Add(tagArray[i].ToString());
                    }
                    if (itemobj["status"].ToString() == "open")
                    {
                        hasOpendRoom = true;
                        openRoomID   = itemobj["_id"].ToString();
                    }
                    Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
                    {
                        panLogin.Margin = new Thickness(0, 0, 0, 0);
                        N2RoomCard card = new N2RoomCard(info, tags,
                                                         Features.Reg.GetRegKey(Registry.CurrentUser, @"SOFTWARE\SSTeam\SS-Tool-Box", "N2Token"),
                                                         itemobj["status"].ToString() == "open" ? true : false);
                        card.Margin = new Thickness(0, 15, 0, 0);
                        panRoomCard.Children.Add(card);
                        panRoomLoading.Visibility = Visibility.Collapsed;

                        LoginOut.Visibility  = Visibility.Visible;
                        LoginWait.Visibility = Visibility.Collapsed;

                        LoginButton.IsEnabled = true;
                    });
                }
                Log.AddLog("N2", "获取完成,耗时:" + DateTime.Now.Subtract(startRun).TotalSeconds + "秒");
            }
            catch (Exception e)
            {
                UI.ToastHelper.Add("获取失败:" + e.Message);
                Log.AddErr("N2", "获取失败:" + e.Message);
            }
        }
Beispiel #10
0
        public PageMain()
        {
            InitializeComponent();
            //title文本
            String stTitle;
            String UserName = Environment.UserName;

            loadingtime = DateTime.Now;
            if (DateTime.Now.ToString("MM").Equals("01") && int.Parse(DateTime.Now.ToString("dd")) < 8)
            {
                stTitle = DateTime.Now.ToString("yyyy") + "年快乐," + UserName + "。";
            }
            else
            {
                stTitle = "你好," + UserName + "。";
            }

            /*
             * try
             * {
             *  string wnlurl = "https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?query=" + DateTime.Now.ToString("yyyy") + "年" + DateTime.Now.ToString("MM") + "月&resource_id=6018&format=json";
             *  string GetJsonwnl = HttpUitls.Get(wnlurl, "DEFALT");
             *
             *  GetJsonwnl = HttpUtility.UrlEncode(GetJsonwnl, Encoding.UTF8);
             *  GetJsonwnl = HttpUtility.UrlDecode(GetJsonwnl);
             *  MessageBox.Show(GetJsonwnl);
             * }
             * catch(Exception ex)
             * {
             *  MessageBox.Show("" + ex);
             * }
             */

            //一言
            Action action = new Action(() => {
                error.logWriter("开始获取一言", false);
                try
                {
                    String saysuri = "https://v1.hitokoto.cn/";
                    string GetJson = HttpUitls.Get(saysuri, "DEFALT");
                    if (GetJson.IndexOf("hitokoto") != -1)
                    {
                        JObject obj = JObject.Parse(GetJson);
                        yyid        = obj["id"].ToString();
                        stSays      = "     " + obj["hitokoto"].ToString() + " —— " + obj["from"].ToString();
                        error.logWriter("获取一言成功,耗时:" + (DateTime.Now - loadingtime).ToString(), false);
                    }
                    else
                    {
                        error.logWriter("发现错误(MAN - 001):获取一言内容为空,耗时:" + (DateTime.Now - loadingtime).ToString(), false);
                        stSays = "你好丫,欢迎使用林槐工具箱!Hummm它就只是个工具箱而已。";
                    }
                }
                catch (Exception ex)
                {
                    error.logWriter("发现错误(MAN - 002):获取一言失败,错误内容为:" + ex + ",耗时:" + (DateTime.Now - loadingtime).ToString(), false);
                    stSays = "你好丫,欢迎使用林槐工具箱!Hummm它就只是个工具箱而已。";
                }

                this.Dispatcher.BeginInvoke(new Action(() =>
                {
                    Says.Text = stSays;
                }), DispatcherPriority.SystemIdle, null);
            });

            action.BeginInvoke(null, null);

            this.Says.Foreground = baseColora.Fg;
            this.Says.FontFamily = baseColora.Fonts;
            this.Says.FontSize   = 14;
            Says.Text            = stSays;
            String stTips = "      1.这个程序还在开发哦\n      2.第一次使用一定要去“设置 > Q&A”去看看使用建议啦";

            this.Tips.Foreground = baseColora.Fg;
            this.Tips.FontFamily = baseColora.Fonts;
            this.Tips.FontSize   = 14;
            Tips.Text            = stTips;

            this.Title.Foreground = baseColora.Fg;
            this.Title.FontFamily = baseColora.Fonts;
            this.Title.FontSize   = 17;
            Title.Text            = stTitle;

            this.MT1.Foreground = baseColora.Fg;
            this.MT1.FontFamily = baseColora.Fonts;
            this.MT1.FontSize   = 15;
            this.MT2.Foreground = baseColora.Fg;
            this.MT2.FontFamily = baseColora.Fonts;
            this.MT2.FontSize   = 15;

            BaseColor baseColor = new BaseColor();

            CD1.Background = baseColora.Card;
            CD2.Background = baseColora.Card;
            CD3.Background = baseColora.Card;

            Title.Foreground = baseColora.Fg;
            MT1.Foreground   = baseColora.Fg;
            MT2.Foreground   = baseColora.Fg;
            Says.Foreground  = baseColora.Fg;
            Tips.Foreground  = baseColora.Fg;

            this.UpdateList.ItemLineBrush    = baseColora.Font;
            this.UpdateList.ItemToggleStroke = baseColora.Tran;
            this.UpdateList.ItemToggleFill   = baseColora.Main;
            this.U0.Foreground  = baseColora.Font;
            this.U1.Foreground  = baseColora.Font;
            this.U2.Foreground  = baseColora.Font;
            this.U3.Foreground  = baseColora.Font;
            this.U4.Foreground  = baseColora.Font;
            this.U5.Foreground  = baseColora.Font;
            this.U6.Foreground  = baseColora.Font;
            this.U7.Foreground  = baseColora.Font;
            this.U8.Foreground  = baseColora.Font;
            this.U9.Foreground  = baseColora.Font;
            this.U10.Foreground = baseColora.Font;
            this.U11.Foreground = baseColora.Font;
            this.U12.Foreground = baseColora.Font;
            this.U13.Foreground = baseColora.Font;
            this.U14.Foreground = baseColora.Font;
            this.U15.Foreground = baseColora.Font;
            this.U16.Foreground = baseColora.Font;
            this.U17.Foreground = baseColora.Font;
            this.U18.Foreground = baseColora.Font;
            this.U19.Foreground = baseColora.Font;
            this.U20.Foreground = baseColora.Font;
            this.U21.Foreground = baseColora.Font;

            this.B1.Foreground = baseColora.Fg;

            this.Height = 477;

            //疫情查询板块
            this.CDY.Background     = baseColora.Card;
            this.MTY.Foreground     = baseColora.Fg;
            this.MTY.FontFamily     = baseColora.Fonts;
            this.MTY.FontSize       = 15;
            this.MTYES.Foreground   = baseColora.Fg;
            this.MTYES.FontFamily   = baseColora.Fonts;
            this.MTYES.FontSize     = 15;
            this.NYES.Foreground    = baseColora.Fg;
            this.NYES.FontFamily    = baseColora.Fonts;
            this.NYES.FontSize      = 20;
            this.MTMAY.Foreground   = baseColora.Fg;
            this.MTMAY.FontFamily   = baseColora.Fonts;
            this.MTMAY.FontSize     = 15;
            this.NMAY.Foreground    = baseColora.Fg;
            this.NMAY.FontFamily    = baseColora.Fonts;
            this.NMAY.FontSize      = 20;
            this.MTMAYD.Foreground  = baseColora.Fg;
            this.MTMAYD.FontFamily  = baseColora.Fonts;
            this.MTMAYD.FontSize    = 15;
            this.NMAYD.Foreground   = baseColora.Fg;
            this.NMAYD.FontFamily   = baseColora.Fonts;
            this.NMAYD.FontSize     = 20;
            this.MTDIE.Foreground   = baseColora.Fg;
            this.MTDIE.FontFamily   = baseColora.Fonts;
            this.MTDIE.FontSize     = 15;
            this.NDIE.Foreground    = baseColora.Fg;
            this.NDIE.FontFamily    = baseColora.Fonts;
            this.NDIE.FontSize      = 20;
            this.MTALIVE.Foreground = baseColora.Fg;
            this.MTALIVE.FontFamily = baseColora.Fonts;
            this.MTALIVE.FontSize   = 15;
            this.NALIVE.Foreground  = baseColora.Fg;
            this.NALIVE.FontFamily  = baseColora.Fonts;
            this.NALIVE.FontSize    = 20;

            this.NC.Background = baseColora.Bg;
            this.NC.Foreground = baseColora.Fg;

            Action actionyq = new Action(() => {
                try
                {
                    error.logWriter("尝试下载丁香园界面……", false);
                    string url            = "https://ncov.dxy.cn/ncovh5/view/pneumonia?scene=2&clicktime=1579582238&enterid=1579582238&from=timeline&isappinstalled=0";
                    string filepath       = "SSTB/Files/Ncov.txt";
                    WebClient mywebclient = new WebClient();
                    mywebclient.DownloadFile(url, filepath);
                }
                catch (Exception ex)
                {
                    error.logWriter("下载丁香园界面失败," + ex, false);
                    errN = true;
                    return;
                }
                try
                {
                    string content = File.ReadAllText("SSTB/Files/Ncov.txt");
                    int i          = content.IndexOf("getStatisticsService");
                    content        = content.Substring(i + "getStatisticsService".Length);
                    i          = content.IndexOf("confirmedCount");
                    content    = content.Substring(i + "confirmedCount".Length + 2);
                    i          = content.IndexOf(",");
                    string inl = content;
                    int inp    = i;
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        NYES.Text = inl.Substring(0, inp);
                    }), DispatcherPriority.SystemIdle, null);
                    i           = content.IndexOf(":");
                    content     = content.Substring(i + 1);
                    i           = content.IndexOf(",");
                    string inl1 = content;
                    int inp1    = i;
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        NMAY.Text = inl1.Substring(0, inp1);
                    }), DispatcherPriority.SystemIdle, null);
                    i           = content.IndexOf(":");
                    content     = content.Substring(i + 1);
                    i           = content.IndexOf(",");
                    string inl2 = content;
                    int inp2    = i;
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        NALIVE.Text = inl2.Substring(0, inp2);
                    }), DispatcherPriority.SystemIdle, null);
                    i           = content.IndexOf(":");
                    content     = content.Substring(i + 1);
                    i           = content.IndexOf(",");
                    string inl3 = content;
                    int inp3    = i;
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        NDIE.Text = inl3.Substring(0, inp3);
                    }), DispatcherPriority.SystemIdle, null);
                    i           = content.IndexOf(":");
                    content     = content.Substring(i + 1);
                    i           = content.IndexOf(",");
                    string inl4 = content;
                    int inp4    = i;
                    this.Dispatcher.BeginInvoke(new Action(() =>
                    {
                        NMAYD.Text = inl4.Substring(0, inp4);
                    }), DispatcherPriority.SystemIdle, null);
                }
                catch (Exception ex)
                {
                    error.logWriter("处理丁香园界面失败," + ex, false);
                    return;
                }
            });

            actionyq.BeginInvoke(null, null);
        }
Beispiel #11
0
 private void UpdateRight()         //检查更新
 {
     #if DEBUG
     return;
     #endif
     if (File.Exists("UpdateBash.bat"))
     {
         File.Delete("UpdateBash.bat");
         if (File.Exists("run.vbs"))
         {
             File.Delete("run.vbs");
         }
         this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
         {
             SSMessageHelper.noNo = true;
             ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
             SSMessageHelper.Title    = "更新完成";
             SSMessageHelper.Says     = "我们成功更新了 SSTB !开始体验全新的功能吧!";
             SSMessageBox MB          = new SSMessageBox();
             this.IsMaskVisible       = true;
             MB.WindowStartupLocation = WindowStartupLocation.CenterOwner;
             MB.Owner = this;
             MB.ShowDialog();
             this.IsMaskVisible = false;
         });
     }
     error.logWriter("检查更新……", false);
     string GetJson;
     String saysuri = "https://stapxs.neocities.org/SSTB-NowVersion.txt";
     try
     {
         ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
         GetJson = HttpUitls.Get(saysuri, "DEFALT");
     }
     catch (Exception ex)
     {
         error.logWriter("检查更新错误 :" + ex, false);
         return;
     }
     if (String.IsNullOrWhiteSpace(GetJson))
     {
         return;
     }
     JObject obj = JObject.Parse(GetJson);
     if (int.Parse(obj["Version"].ToString()) != nUpdateVersion)
     {
         this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
         {
             SSMessageHelper.noNo = true;
             ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
             SSMessageHelper.Title    = "发现更新";
             SSMessageHelper.Says     = "我们检查到了版本更新,但是由于更新文件版本不符,我们无法确认更新的可用性,请手动确认版本更新。\n(当前软件内更新文件标记版本为 " + nUpdateVersion + " ,获取到的更新文件标记版本为 " + obj["Version"].ToString() + " )";
             SSMessageBox MB          = new SSMessageBox();
             this.IsMaskVisible       = true;
             MB.WindowStartupLocation = WindowStartupLocation.CenterOwner;
             MB.Owner = this;
             MB.ShowDialog();
             this.IsMaskVisible = false;
         });
     }
     else
     {
         if (!obj["MainVersion"].ToString().Equals(stVersion))
         {
             this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart) delegate()
             {
                 SSMessageHelper.noNo = false;
                 ButtonHelper.SetIcon(SSMessageHelper.Icon, "");
                 SSMessageHelper.bOKtext  = "在线更新";
                 SSMessageHelper.bNOtext  = "知道了";
                 SSMessageHelper.Title    = "发现更新";
                 SSMessageHelper.Says     = "我们检查到了版本更新,最新版本为:" + obj["MainVersion"].ToString() + ",更新时间:" + obj["Time"].ToString() + ",选择在线更新将从GitHub在线下载。\n( GitHub 有约1小时的CDN缓存延时,建议在更新时间一小时后更新 )\n更新日志如下:\n" + obj["Logs"].ToString();
                 SSMessageBox MB          = new SSMessageBox();
                 this.IsMaskVisible       = true;
                 MB.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                 MB.Owner = this;
                 MB.ShowDialog();
                 this.IsMaskVisible      = false;
                 SSMessageHelper.bOKtext = "好的";
                 if (SSMessageHelper.buttonOK)
                 {
                     Updater UP               = new Updater();
                     UP.ParentWindow          = this;
                     UP.url                   = obj["Url"].ToString();
                     this.IsMaskVisible       = true;
                     UP.WindowStartupLocation = WindowStartupLocation.CenterOwner;
                     UP.Owner                 = this;
                     UP.ShowDialog();
                     this.IsMaskVisible = false;
                     if (UpdateFin == true)
                     {
                         string where = Directory.GetCurrentDirectory();
                         where        = where + @"\run.vbs";
                         System.Diagnostics.Process process;
                         process = System.Diagnostics.Process.Start(@where);
                         Application.Current.Shutdown();
                     }
                 }
             });
         }
     }
     error.logWriter("检查更新完成。", false);
 }
Beispiel #12
0
        public string[] RequestBiQuanApi()
        {
            string[] reStr;

            try
            {
                var jinseLatestNewsFlash    = JsonConvert.DeserializeObject <CoinNewsResultModel <CoinNewsModel> >(HttpUitls.Get(ConfigManager.pushNewsConfig.NewsServerURL + "/News/GetJinseLatestNewsFlash"));
                var bishijieLatestNewsFlash = JsonConvert.DeserializeObject <CoinNewsResultModel <CoinNewsModel> >(HttpUitls.Get(ConfigManager.pushNewsConfig.NewsServerURL + "/News/GetBishijieLatestNewsFlash"));
                var bitcoinLatestNewsFlash  = JsonConvert.DeserializeObject <CoinNewsResultModel <CoinNewsModel> >(HttpUitls.Get(ConfigManager.pushNewsConfig.NewsServerURL + "/News/GetBitcoinLatestNewsFlash"));
                var OkexNotice = JsonConvert.DeserializeObject <CoinNewsResultModel <CoinNewsModel> >(HttpUitls.Get(ConfigManager.pushNewsConfig.NewsServerURL + "/News/GetOkexLatestNotice"));

                reStr = new string[] { "【金色财经】" + jinseLatestNewsFlash.Data.Content, "【币世界】" + bishijieLatestNewsFlash.Data.Content, "【Bitcoin】" + bitcoinLatestNewsFlash.Data.Content, "【OKEX公告】" + OkexNotice.Data.Title + " " + OkexNotice.Data.FromUrl };
            }
            catch (Exception e)
            {
                reStr = new string[] { e.ToString() + "\n席马达!程序BUG了,快召唤老铁来维修!" };
            }

            return(reStr);
        }