Example #1
0
        /// <summary>
        /// ���±����ļ�
        /// </summary>
        /// <param name="url">Զ�̻���Ŀ¼</param>
        /// <param name="systemType">���� 0 Fedoreϵͳ 1 Redhatϵͳ</param>
        /// <param name="currVersion">��ǰ�汾</param>
        /// <param name="saveDic">������ļ�Ŀ¼</param>
        /// <returns>
        /// true �ɹ� ; 
        /// false ʧ��
        /// </returns>
        public static string UpdateFile(int systemType, int currVersion)
        {
            string version = GetVersion(systemType);

            if (version == null)
                return null;

            if (Convert.ToInt32(version) <= currVersion)
                return null;

            string temp = string.Empty;
            string dic = SAVEDIC;

            if (systemType == 0)
            {
                temp = URL + FEDORE + "/update.tgz";
                dic = dic + FEDORE;
            }
            else if (systemType == 1)
            {
                temp = URL + REDHAT + "/update.tgz";
                dic = dic + REDHAT;
            }
            else if (systemType == 2)
            {
                temp = URL + WINDOWS + "/MainProc.exe";
                dic = dic + WINDOWS;
            }

            RemoteFile rf = new RemoteFile();
            rf.SaveDic = dic;

            if (rf.SaveRemoteFile(temp))
                return rf.DownPath;

            return null;
        }