/// <summary> /// 设置FTP对象信息 /// </summary> private static void SetFtpConfigInfo() { ftpList = (FTPConfigInfoCollection)Serializer.Load(typeof(FTPConfigInfoCollection), m_configfilepath); FTPConfigInfoCollection.FTPConfigInfoCollectionEnumerator ftps = ftpList.GetEnumerator(); //遍历集合并设置相应的FTP信息(静态)对象 while (ftps.MoveNext()) { if (ftps.Current.Default == 1 && ftps.Current.Enable == 1) { currentFtp = ftps.Current; break; } } }
/// <summary> /// 根据FTP唯一标识获取FTP配置信息 /// </summary> public static FTPConfigInfo GetFTP(int ident) { if (ident == 0) { return(CurrentFTP); } else { FtpFileMonitor(); FTPConfigInfoCollection.FTPConfigInfoCollectionEnumerator ftps = ftpList.GetEnumerator(); while (ftps.MoveNext()) { if (ftps.Current.Enable == 1 && ftps.Current.Ident == ident) { return(ftps.Current); } } } throw ExceptionManager.MessageException("对不起,存储系统唯一标识【" + ident.ToString() + "】不存在或未启用,请检查!"); }