Example #1
0
        private void Ready()
        {
            Step.CURRENT_STEP = Step.State._ProcessState_CallClient;

            Label_Ver.Content = strServerVer;
            IniManager.SetINIValue(m_verPath, "Client", "ver", strServerVer);
            if (progressBar_Total.Value != 100)
            {
                progressBar_Total.Value = 100;
            }

            label_File_Info_String.Content = "更新完成";

            label_Speed.Content = "";
            //MessageBox.Show("更新成功!");

            try
            {
#if DEBUG
                MessageBox.Show("成功启动应用 ");
#else
                CallClientEXE();
#endif
            }
            catch (Exception ex)
            {
                MessageBox.Show("应用启动失败: " + ex.Message);
            }
        }
Example #2
0
        /// <summary>
        /// 再次检查补丁文件的版本号
        /// </summary>
        private void CheckClientVer()
        {
            strServerVer = IniManager.GetINIValue(m_localServerVerPath, "Client", "ver");
            string CurrentVer = Label_Ver.Content.ToString();

            //版本号不同则更新版本
            if (!strServerVer.Equals(CurrentVer))
            {
                Step.CURRENT_STEP = Step.State.__DownLoadServerMD5List;
            }
            else
            {
                Step.CURRENT_STEP = Step.State._ProcessState_Ready;
            }
        }
Example #3
0
        public void CheckMD5()
        {
            //label_Total_Info_string.Content = "检查当前启动器版本中";
            Step.CURRENT_STEP = Step.State.___waittt;
            //读取serverVer.ini的启动器版本号
            launcherMd5 = IniManager.GetINIValue(m_localServerVerPath, "LauncherMd5", "md5");

            if (File.Exists(m_luancherPath))   //存在启动器则检查
            {
                string computeMd5Hash = FileMatchUp.ComputeMD5Hash(m_luancherPath);
                //Todo 启动器md5相同的话就启动版本号检测是否要更新客户端
                //不相同的话就更新启动器
                if (computeMd5Hash == launcherMd5)
                {
                    Step.CURRENT_STEP = Step.State._ProcessState_CheckVer;
                    return;
                }
            }
            //  启动器下载
            Step.CURRENT_STEP = Step.State.__DownLoadLauncher;
        }
Example #4
0
        /// <summary>
        /// 初始化窗口设置
        /// </summary>
        private void Init()
        {
            m_currentPath = Application.ExecutablePath.Replace('\\', '/');
            int len = m_currentPath.LastIndexOf(@"/");

            m_curDirectory = m_currentPath.Substring(0, len + 1);

            m_luncherOld  = m_curDirectory + App.m_lancherName + m_luncherOld;
            m_ftpThread   = new FTPThread();
            m_ftpProtocol = new FtpProtocol(FTPHost, FTPID, FTPPassword, this);

            m_downloadPath       = m_curDirectory + m_downloadPath;
            m_localServerVerPath = m_curDirectory + m_serverVerName;
            m_verPath            = m_curDirectory + m_clientVerName;

            m_luancherPath = m_curDirectory + App.m_lancherName + ".exe";
            string localMd5 = m_curDirectory + m_clientmd5Txt;

            m_clientServerDirectory = m_ftpPath + m_clientServerDirectory;
            //服务端文件、md5文件、旧启动器都要删除
            string[] deleteFiles = { m_localServerVerPath, m_luncherOld, localMd5 };
            foreach (string Path in deleteFiles)
            {
                if (File.Exists(Path))
                {
                    File.Delete(Path);
                }
            }
            if (Directory.Exists(m_downloadPath))
            {
                Directory.Delete(m_downloadPath, true);
            }
            CheckFIPSRegistValue();

            Label_Ver.Content = IniManager.GetINIValue(m_verPath, "Client", "ver");
        }