コード例 #1
0
        void updater_DoWork(object sender, DoWorkEventArgs e)
        {
            UpdateCheck check = new UpdateCheck();

            try
            {
                HttpControl http     = new HttpControl();
                string      response = http.Get("http:" + "//2pix-steganography.googlecode.com/svn/trunk/setup.iss");

                check.LatestVersion = Regex.Match(response, @"AppVersion\=(?<version>[0-9\.]*)").Groups["version"].Value.Trim();
                check.UpdateURL     = Regex.Match(response, @"AppUpdatesURL\=(?<url>.*)").Groups["url"].Value.Replace("\n", "").Replace("\n", "");
                check.MyVersion     = GetCurrentVersion().Trim();
                check.Success       = check.MyVersion != "" && check.LatestVersion != "";
            }
            catch
            {
                check.Success = false;
            }
            e.Result = check;
        }
コード例 #2
0
    void background_DoWork(object sender, DoWorkEventArgs e)
    {
        try
        {
            error = false;

            switch ((RequestOption)e.Argument)
            {
            case RequestOption.Get:
                response = http.Get(request.url, request.settings);
                break;

            case RequestOption.Post:
                response = http.Post(request.url, request.data, request.settings);
                break;
            }
        }
        catch (Exception ex)
        {
            error    = true;
            response = "Error getting HTTP request: " + ex.Message;
        }
    }