/// <summary> /// Copies the elements of the specified <see cref="FTPConfigInfo">FTPConfigInfo</see> array to the end of the collection. /// </summary> /// <param name="value">An array of type <see cref="FTPConfigInfo">FTPConfigInfo</see> containing the Components to add to the collection.</param> public void AddRange(FTPConfigInfo[] value) { for (int i = 0; (i < value.Length); i = (i + 1)) { this.Add(value[i]); } }
/// <summary> /// 设置FTP对象信息 /// </summary> private static void SetFtpConfigInfo() { FTPConfigInfoCollection ftpconfiginfocollection = (FTPConfigInfoCollection)SerializationHelper.Load(typeof(FTPConfigInfoCollection), m_configfilepath); FTPConfigInfoCollection.FTPConfigInfoCollectionEnumerator fcice = ftpconfiginfocollection.GetEnumerator(); //遍历集合并设置相应的FTP信息(静态)对象 while (fcice.MoveNext()) { if (fcice.Current.Name == "ForumAttach") { m_forumattach = fcice.Current; continue; } if (fcice.Current.Name == "SpaceAttach") { m_spaceattach = fcice.Current; continue; } if (fcice.Current.Name == "AlbumAttach") { m_albumattach = fcice.Current; continue; } if (fcice.Current.Name == "MallAttach") { m_mallattach = fcice.Current; continue; } if (fcice.Current.Name == "ForumAvatar") { m_forumavatar = fcice.Current; continue; } } }
/// <summary> /// 设置FTP对象信息 /// </summary> private static void SetFtpConfigInfo() { FTPConfigInfoCollection ftpconfiginfocollection = (FTPConfigInfoCollection) SerializationHelper.Load(typeof(FTPConfigInfoCollection), m_configfilepath); FTPConfigInfoCollection.FTPConfigInfoCollectionEnumerator fcice = ftpconfiginfocollection.GetEnumerator(); //遍历集合并设置相应的FTP信息(静态)对象 while (fcice.MoveNext()) { if (fcice.Current.Name == "ForumAttach") { m_forumattach = fcice.Current; continue; } if (fcice.Current.Name == "SpaceAttach") { m_spaceattach = fcice.Current; continue; } if (fcice.Current.Name == "AlbumAttach") { m_albumattach = fcice.Current; continue; } if (fcice.Current.Name == "MallAttach") { m_mallattach = fcice.Current; continue; } if (fcice.Current.Name == "ForumAvatar") { m_forumavatar = fcice.Current; continue; } } }
/// <summary> /// 设置FTP对象信息 /// </summary> private static void SetFtpConfigInfo() { FTPConfigInfoCollection ftpconfiginfocollection = (FTPConfigInfoCollection)SerializationHelper.Load(typeof(FTPConfigInfoCollection), m_configfilepath); FTPConfigInfoCollection.FTPConfigInfoCollectionEnumerator fcice = ftpconfiginfocollection.GetEnumerator(); //遍历集合并设置相应的FTP信息(静态)对象 while (fcice.MoveNext()) { if (fcice.Current.Name == "ForumAttach") { m_forumattach = fcice.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> /// Copies the collection Components to a one-dimensional <see cref="T:System.Array">Array</see> instance beginning at the specified index. /// </summary> /// <param name="array">The one-dimensional <see cref="T:System.Array">Array</see> that is the destination of the values copied from the collection.</param> /// <param name="index">The index of the array at which to begin inserting.</param> public void CopyTo(FTPConfigInfo[] array, int index) { this.List.CopyTo(array, index); }
/// <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); }
/// <summary> /// Initializes a new instance of the <see cref="FTPConfigInfoCollection">FTPConfigInfoCollection</see> class containing the specified array of <see cref="FTPConfigInfo">FTPConfigInfo</see> Components. /// </summary> /// <param name="value">An array of <see cref="FTPConfigInfo">FTPConfigInfo</see> Components with which to initialize the collection. </param> public FTPConfigInfoCollection(FTPConfigInfo[] value) { this.AddRange(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)); }
protected void SaveFtpInfo_Click(object sender, EventArgs e) { string ftpType = GetParam(DNTRequest.GetString("ftptype")); if (Serveraddress.Text.Trim() == "" || Serverport.Text.Trim() == "" || Username.Text.Trim() == "" || Password.Text.Trim() == "" || Uploadpath.Text.Trim() == "" || Timeout.Text.Trim() == "" || Remoteurl.Text.Trim() == "") { base.RegisterStartupScript("", "<script>alert('远程附件设置各项不允许为空');window.location.href='global_ftpsetting.aspx?ftptype=" + ftpType + "';</script>"); return; } if (Uploadpath.Text.EndsWith("/")) { base.RegisterStartupScript("", "<script>alert('附件保存路径不允许以“/”结尾');window.location.href='global_ftpsetting.aspx?ftptype=" + ftpType + "';</script>"); return; } if (Remoteurl.Text.EndsWith("/")) { base.RegisterStartupScript("", "<script>alert('远程访问 URL 不允许以“/”结尾');window.location.href='global_ftpsetting.aspx?ftptype=" + ftpType + "';</script>"); return; } if (!Utils.IsNumeric(Serverport.Text) || int.Parse(Serverport.Text) < 1) { base.RegisterStartupScript("", "<script>alert('远程访问端口必须为数字并且大于1');window.location.href='global_ftpsetting.aspx?ftptype=" + ftpType + "';</script>"); return; } if (!Utils.IsNumeric(Timeout.Text) || int.Parse(Timeout.Text) < 0) { base.RegisterStartupScript("", "<script>alert('超时时间必须为数字并且大于1');window.location.href='global_ftpsetting.aspx?ftptype=" + ftpType + "';</script>"); return; } FTPConfigInfoCollection ftpConfigInfoCollection = (FTPConfigInfoCollection)SerializationHelper.Load(typeof(FTPConfigInfoCollection), Server.MapPath("../../config/ftp.config")); bool isEdit = false; foreach (FTPConfigInfo fci in ftpConfigInfoCollection) { if (fci.Name == ftpType) { fci.Serveraddress = Serveraddress.Text; fci.Serverport = int.Parse(Serverport.Text); fci.Username = Username.Text; fci.Password = Password.Text; fci.Mode = int.Parse(Mode.SelectedValue); fci.Uploadpath = Uploadpath.Text; fci.Timeout = int.Parse(Timeout.Text); fci.Allowupload = int.Parse(Allowupload.SelectedValue); fci.Remoteurl = Remoteurl.Text; fci.Reservelocalattach = int.Parse(Reservelocalattach.SelectedValue); isEdit = true; break; } } if (!isEdit) { FTPConfigInfo fci = new FTPConfigInfo(); fci.Name = ftpType; fci.Serveraddress = Serveraddress.Text; fci.Serverport = int.Parse(Serverport.Text); fci.Username = Username.Text; fci.Password = Password.Text; fci.Mode = int.Parse(Mode.SelectedValue); fci.Uploadpath = ftpType.ToLower(); fci.Timeout = int.Parse(Timeout.Text); fci.Allowupload = int.Parse(Allowupload.SelectedValue); fci.Remoteurl = Remoteurl.Text; fci.Reservelocalattach = int.Parse(Reservelocalattach.SelectedValue); ftpConfigInfoCollection.Add(fci); } SerializationHelper.Save(ftpConfigInfoCollection, Server.MapPath("../../config/ftp.config")); Response.Redirect("global_ftpsetting.aspx?ftptype=" + ftpType); }
/// <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); }