/// <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> /// Gets a value indicating whether the collection contains the specified <see cref="FTPConfigInfoCollection">FTPConfigInfoCollection</see>. /// </summary> /// <param name="value">The <see cref="FTPConfigInfoCollection">FTPConfigInfoCollection</see> to search for in the collection.</param> /// <returns><b>true</b> if the collection contains the specified object; otherwise, <b>false</b>.</returns> public bool Contains(FTPConfigInfo value) { return(this.List.Contains(value)); }
public int Add(FTPConfigInfo value) { return(this.List.Add(value)); }
public void Remove(FTPConfigInfo value) { List.Remove(value); }
public void Insert(int index, FTPConfigInfo value) { List.Insert(index, value); }
/// <summary> /// Gets the index in the collection of the specified <see cref="FTPConfigInfoCollection">FTPConfigInfoCollection</see>, if it exists in the collection. /// </summary> /// <param name="value">The <see cref="FTPConfigInfoCollection">FTPConfigInfoCollection</see> to locate in the collection.</param> /// <returns>The index in the collection of the specified object, if found; otherwise, -1.</returns> public int IndexOf(FTPConfigInfo value) { return(this.List.IndexOf(value)); }
///// <summary> ///// 获取配置类实例 ///// </summary> ///// <returns></returns> //public static FTPConfigInfo GetConfig() //{ // return FTPConfigFileManager.LoadConfig(); //} /// <summary> /// 保存配置类实例 /// </summary> /// <param name="emailconfiginfo"></param> /// <returns></returns> public static bool SaveConfig(FTPConfigInfo ftpconfiginfo) { Serializer.Save(ftpconfiginfo, m_configfilepath); return(true); }
/// <summary> /// 初始化文件修改时间和对象实例 /// </summary> static FTPConfigFileManager() { m_fileoldchange = System.IO.File.GetLastWriteTime(ConfigFilePath); m_configinfo = (FTPConfigInfo)DefaultConfigFileManager.DeserializeInfo(ConfigFilePath, typeof(FTPConfigInfo)); }