Exemple #1
0
        /*
         * 检查是否需要进行firefox升级的函数
         * version:当前版本
         * result:机构化的是否升级返回,里面包括是否返回指示及升级URL
         */
        public static bool ffUpdateCheck(string version, out FFCheckResult result)
        {
            String request = backendAddress + clientrequest;

            request += "?method=checkFirefoxUpdate";
            request += "&sessionId=";
            request += sessionId;
            request += "&shopId=";
            request += shopId;
            request += "&userNo=";
            request += userNo;
            request += "&localVersion=";
            request += version;
            request += "&apiVersion=";
            request += apiVersion;

            String response = getBackendData(request, "Get");

            return parseFFCheckResult(response, out result);
        }
Exemple #2
0
        public static void FFUpdate()
        {
            if (!ffUpdateNotify) return;

            string version = "";
            string ffpath = "";
            bool bFFResult = FFDetect.detect(out version, out ffpath);

            FFCheckResult ffcheckresult = new FFCheckResult();
            DataProcessUtil.ffUpdateCheck(version, out ffcheckresult);

            if (ffcheckresult != null && ffcheckresult.needUpdate)
            {
                //最小化主窗口
                getMainInstance().HideMain();
                //没有安装火狐,提示安装
                UpdateFFNotify notifywindow = new UpdateFFNotify(null, ffcheckresult.updateUrl, bFFResult);
                notifywindow.TopLevel = true;
                notifywindow.ShowDialog(); //显示为模式对话框
            }
        }
Exemple #3
0
        /*
         * 火狐是否升级应答的解析函数
         */
        private static bool parseFFCheckResult(string response, out FFCheckResult rtnresult)
        {
            JsonTextReader jsonReader = new JsonTextReader(new StringReader(response));

            rtnresult = new FFCheckResult();

            bool bResult = false;
            while (jsonReader.Read())
            {
                if (jsonReader.TokenType == JsonToken.PropertyName)
                {
                    if ((string)(jsonReader.Value) == "shopId")
                    {
                        if (jsonReader.Read())
                        {
                            object result = jsonReader.Value;
                            rtnresult.shopId = Convert.ToString(result);
                        }
                    }

                    else if ((string)(jsonReader.Value) == "userNo")
                    {
                        if (jsonReader.Read())
                        {
                            object result = jsonReader.Value;
                            rtnresult.userNo = Convert.ToString(result);
                        }
                    }
                    else if ((string)(jsonReader.Value) == "localVersion")
                    {
                        if (jsonReader.Read())
                        {
                            object result = jsonReader.Value;
                            rtnresult.localversion = Convert.ToString(result);
                        }
                    }
                    else if ((string)(jsonReader.Value) == "recentVersion")
                    {
                        if (jsonReader.Read())
                        {
                            object result = jsonReader.Value;
                            rtnresult.recentVersion = Convert.ToString(result);
                        }
                    }
                    else if ((string)(jsonReader.Value) == "needUpdate")
                    {
                        if (jsonReader.Read())
                        {
                            object result = jsonReader.Value;
                            rtnresult.needUpdate = Convert.ToBoolean(result);
                        }
                    }
                    else if ((string)(jsonReader.Value) == "updateUrl")
                    {
                        if (jsonReader.Read())
                        {
                            object result = jsonReader.Value;
                            rtnresult.updateUrl = Convert.ToString(result);
                        }
                    }
                }
            }

            return bResult;
        }