private bool Fresh(ref _GoodsFreshStr goodInfo, GoodsFresh objFresh,bool bSynFlag)
        {
            //http://m.pconline.com.cn/member/product/products_onsell.htm?&pageSize=60&pageNo=1
            goodInfo.strModifyStatus = "";
            goodInfo.bModify = false;
            string strError = "";

            bool bRet = false;

            int iCurPage = 0;
            int iRet = -1;
            int iFreshCount;
            int iGoodCount;
            bool bBreak = false;

            if (bSynFlag)
            {
                goodInfo.strFreshStatus = "正在同步...";
            }
            else
            {
                goodInfo.strFreshStatus = "正在刷新...";
            }
            ShowInfo(goodInfo);

            Hashtable hWaitTable = new Hashtable();
            Hashtable hFailTable = new Hashtable(); //修改失败的价格列表
            Hashtable hSynTable = new Hashtable(); //同步列表
            Hashtable hSynDuplicateTable = new Hashtable(); //同步列表
            int iNetErrorCount = 0;
            string strContent = "";// "为了方便在太平洋商城的店主们  批量  更新商品信息,      \r\n我们特别为店主们量身定做了一款批量刷新、    \r\n同步商品信息,       \r\n批量修改商品价格信息的软件.        \r\n 以达到商家的商品一直排前, 提高客户关注度.            \r\n在商品价格需要修改时, 只需要导入一个Excel 文件,  即可实现批量修改价格.       让商家从繁复的操作中解脱出来, 从战略的角度考虑商品销售.        \r\n另可定制各种商城的同类刷新修改软件:             \r\n如: 中关村在线,  pcpop,  天极等商城.";
            //strContent = strContent + "          \r\n 详情请联系QQ: 1194410385 请注明[太平洋刷新] ";

            strContent = m_strMsgSend;
            //strContent = "test info111";
            goodInfo.iFreshNumCount = 0;
            while (m_bFresh && !bBreak)
            {
                if (bSynFlag)
                {
                    iRet = objFresh.SynchronizeSeller(out strError, out iFreshCount, out iGoodCount, out bBreak, iCurPage + 1, ref iNetErrorCount, ref hSynTable, ref hSynDuplicateTable,goodInfo.strAcc);
                }
                else{
                    bBreak = true;
                    goodInfo.strFreshStatus = "正在获取验证码...";
                    ShowInfo(goodInfo);
                    //获取验证码
                    string strDirect = System.AppDomain.CurrentDomain.BaseDirectory + "pic";
                    if (!Directory.Exists(strDirect))
                    {
                        Directory.CreateDirectory(strDirect);
                    }
                    m_strCheckCode = "SDFKD";
                    string strName = goodInfo.strAcc;
                    strName = strName.Replace(":", "");
                    strName = strName.Replace(".", "");
                    strName = strName.Replace("\\", "");
                    strName = strName.Replace("/", "");
                    string strFile = string.Format("{0}\\{1}.bmp", strDirect, strName);
                    string strMemo = "";
                    string strTarget = "";
                    if (m_strCheckCode == "")
                    {
                        bRet = objFresh.GetImage(goodInfo.strAcc, strFile, out strError, out strMemo, out strTarget);
                        if (!bRet)
                        {
                            goodInfo.strFreshStatus = "获取验证码失败";
                            ShowInfo(goodInfo);
                            return false;
                        }
                        lock (m_hLockTable)
                        {
                            GetCodeHandler _myInvoke = new GetCodeHandler(GetCode);
                            m_strCheckCode = (string)this.Invoke(_myInvoke, new object[] { strFile });
                            if (m_strCheckCode.Length < 1)
                            {
                                goodInfo.strFreshStatus = "验证码错误";
                                ShowInfo(goodInfo);
                                return false;
                            }
                        }
                    }

                    iRet = objFresh.AddNotie(goodInfo.strAcc, strContent, m_strCheckCode, strMemo, strTarget,out strError);
                    iGoodCount = 0;
                    iFreshCount = 0;
                }

                //成功
                if (iRet == 0)
                {
                    goodInfo.iFreshNumCount += iGoodCount;
                    if (bSynFlag)
                    {
                        goodInfo.iFreshSucNumCount = hSynTable.Count;
                        goodInfo.iSynchronizeCount = hSynTable.Count;
                    }
                    else
                        goodInfo.iFreshSucNumCount += iFreshCount;

                    if (bSynFlag)
                    {
                        goodInfo.strFreshStatus = string.Format("正在同步:{0}", goodInfo.iFreshSucNumCount);
                    }
                    else
                    {
                        goodInfo.strFreshStatus = "发送成功";
                    }
                    if (bBreak)
                    {
                        if (bSynFlag)
                        {
                          //  goodInfo.strFreshStatus = "同步完成";
                            goodInfo.strFreshStatus = string.Format("同步完成:{0},需要重启", goodInfo.iFreshSucNumCount);
                        }
                        else
                        {
                            goodInfo.strFreshStatus = "发广告成功";
                            //将发送成功的URL地址写入新的配置文件
                            IniUtility.FilePath = System.AppDomain.CurrentDomain.BaseDirectory + "\\setEx.ini";
                            IniUtility.WriteIniKey("setex", goodInfo.strAcc, "1");
                            goodInfo.iSynchronizeCount = 1;
                        }
                    }
                }
                else if (iRet == -1)
                {
                    goodInfo.strFreshStatus = strError;
                    goodInfo.strSynStatus = strError;
                    goodInfo.strModifyStatus = strError;
                    bRet = false;
                    ShowLogString(string.Format("{0} {1}", iCurPage, strError));
                    break;
                }
                else
                {
                    goodInfo.strFreshStatus = strError;
                    ShowLogString(string.Format("{0} {1}",iCurPage,strError));
                }
                ShowInfo(goodInfo);
                if (iRet != -3)
                {
                    iCurPage++;
                }
                if (bBreak)
                {
                    if (bSynFlag)
                    {
                        //保存到文件
                        StringBuilder strBuilder = new StringBuilder();
                        _GoodsModifyStr objStru = new _GoodsModifyStr();

                        string[] keyArray = new string[hSynTable.Count];
                        string[] valueArray = new string[hSynTable.Count];
                        hSynTable.Keys.CopyTo(keyArray, 0);
                        int i=0;
                        foreach (string skey in keyArray)
                        {
                            objStru = (_GoodsModifyStr)hSynTable[skey];
                            valueArray[i] = objStru.strNoEx;
                            i++;
                        }
                        Array.Sort(valueArray, keyArray);
                        foreach (string skey in keyArray)
                        {
                            objStru = (_GoodsModifyStr)hSynTable[skey];
                            strBuilder.Append(string.Format("{0},{1},{2},{3},{4},{5},\r\n", objStru.strNo, objStru.strNoEx, objStru.fPrice, objStru.fLowPrice, objStru.fHighPrice, objStru.strName));
                        }
                        string strDirectory = System.AppDomain.CurrentDomain.BaseDirectory + "synfile";
                        string strDirectoryXls = System.AppDomain.CurrentDomain.BaseDirectory + "xlsfile";

                        WriteInfo(strDirectory, strBuilder, goodInfo.strAcc);
                        SaveToExcel(strDirectoryXls, hSynTable, goodInfo.strAcc);

                        if (hSynDuplicateTable.Count > 0)
                        {
                            StringBuilder strBuilderEx = new StringBuilder();

                            string[] keyArrayDup = new string[hSynDuplicateTable.Count];
                            string[] valueArrayDup = new string[hSynDuplicateTable.Count];
                            hSynTable.Keys.CopyTo(keyArrayDup, 0);
                            int ii = 0;
                            foreach (string skey in keyArrayDup)
                            {
                                objStru = (_GoodsModifyStr)hSynDuplicateTable[skey];
                                valueArrayDup[ii] = objStru.strNoEx;
                                ii++;
                            }
                            Array.Sort(valueArrayDup, keyArrayDup);
                            foreach (string skey in keyArrayDup)
                            {
                                objStru = (_GoodsModifyStr)hSynDuplicateTable[skey];
                                strBuilder.Append(string.Format("{0},{1},{2},{3},{4},{5},\r\n", objStru.strNo, objStru.strNoEx, objStru.fPrice, objStru.fLowPrice, objStru.fHighPrice, objStru.strName));
                            }

                            WriteInfo(strDirectory, strBuilderEx, goodInfo.strAcc + "_duplicate");
                            SaveToExcel(strDirectoryXls, hSynDuplicateTable, goodInfo.strAcc + "_duplicate");
                        }
                    }
                    break;
                }
                Thread.Sleep(500);
            }
            return true;
        }