Exemplo n.º 1
0
        /// <summary>
        /// 判断是否连线成功
        /// </summary>
        /// <param name="path">路径</param>
        /// <param name="username">用户名</param>
        /// <param name="passwork">密码</param>
        /// <returns></returns>
        private bool ConnectState(string ftpIp, string path, string username, string password)
        {
            bool Flag = false;

            //use sharedtool class connect ftp server
            ShareTool tool = new ShareTool(username, password, ftpIp);

            if (tool.isExists == true)
            {
                Flag = true;
            }
            return(Flag);
        }
Exemplo n.º 2
0
        public IsUpdateEnable()
        {
            try
            {
                config = Config.LoadConfig(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Version.xml"));

                if (!config.Enabled)
                {
                    return;
                }

                /*
                 * if (ConnectRomot.connectState(config.ServerUrl, config.User, config.Password))
                 *  return;
                 */
                ShareTool tool = new ShareTool(config.User, config.Password, config.ServerUrl);
                if (!tool.isExists)
                {
                    MessageBox.Show("Can't connect to autoupdate server!");
                    return;
                }
                RemoteFile rf = ParseRemoteXml(Path.Combine(config.ServerUrl, "Version.xml"));

                Version v1 = new Version(rf.LastVer);
                Version v2 = new Version(config.UpdateFileList[0].LastVer);
                if (v1 > v2)
                {
                    bFlag = true;
                    return;
                }
            }
            catch
            {
                bFlag = false;
            }
        }