コード例 #1
0
        public void CheckUpdate()
        {
            if (isChecking == true)
            {
                return;
            }

            isChecking = true;


            ConfigFile updateCfg = new ConfigFile(workPath + "/" + updateConfigName);

            localVersion = updateCfg.ReadValue("AppInfo", "AppVersion");
            WebClient dlClient = new WebClient();

            dlClient.DownloadFileCompleted += new AsyncCompletedEventHandler(OnCheckUpdateEnd);

            try
            {
                dlClient.DownloadFileAsync(new Uri(serverConfigFileUrl), tmpFileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            return;
        }
コード例 #2
0
        public void OnCheckUpdateEnd(object sender, AsyncCompletedEventArgs e)
        {
            ConfigFile serverCfg = new ConfigFile(workPath + "/" + tmpFileName);

            serverVersion = serverCfg.ReadValue("AppInfo", "AppVersion");
            if (localVersion == serverVersion)
            {
                isChecking = false;
                if (File.Exists(tmpFileName))
                {
                    File.Delete(tmpFileName);
                }
                MessageBox.Show("Your App is the latest version");
                return;
            }

            WebClient dlClient = new WebClient();

            string patchUrl = serverCfg.ReadValue("PatchName", "Url");

            dlClient.DownloadFileCompleted   += new AsyncCompletedEventHandler(OnDownloadEnd);
            dlClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(OnDownloadChanged);

            if (File.Exists(patchFileName))
            {
                File.Delete(patchFileName);
            }

            try
            {
                dlClient.DownloadFileAsync(new Uri(patchUrl), patchFileName);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            if (File.Exists(tmpFileName))
            {
                File.Delete(tmpFileName);
            }

            updWin.Show();
        }
コード例 #3
0
        public Update()
        {
            ConfigFile updateCfg = new ConfigFile(workPath + "/" + updateConfigName);

            serverConfigFileUrl = updateCfg.ReadValue("ServerInfo", "ConfigFileUrl");

            if (File.Exists("old_"))
            {
                File.Delete("old_");
            }
        }
コード例 #4
0
ファイル: MyApp.cs プロジェクト: kuanye345/JX3Assist
        public string ReadWindowTitle()
        {
            ConfigFile cfg = new ConfigFile(configFileName);

            return(cfg.ReadValue("Key", "WindowTitle"));
        }
コード例 #5
0
ファイル: MyApp.cs プロジェクト: kuanye345/JX3Assist
        public string ReadMacroKey()
        {
            ConfigFile cfg = new ConfigFile(configFileName);

            return(cfg.ReadValue("Key", "MacroKey"));
        }