⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 settingsform.cs

📁 利用VS C#实现的网络爬虫功能
💻 CS
📖 第 1 页 / 共 4 页
字号:
			// tabPageAdvanced
			// 
			this.tabPageAdvanced.Controls.Add(this.groupBox2);
			this.tabPageAdvanced.Controls.Add(this.groupBox1);
			this.tabPageAdvanced.Location = new System.Drawing.Point(4, 22);
			this.tabPageAdvanced.Name = "tabPageAdvanced";
			this.tabPageAdvanced.Size = new System.Drawing.Size(458, 248);
			this.tabPageAdvanced.TabIndex = 1;
			this.tabPageAdvanced.Text = "Advanced";
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.textBoxExcludePages);
			this.groupBox2.Controls.Add(this.label17);
			this.groupBox2.Controls.Add(this.textBoxExcludeFiles);
			this.groupBox2.Controls.Add(this.label18);
			this.groupBox2.Controls.Add(this.textBoxExcludeURLs);
			this.groupBox2.Controls.Add(this.label19);
			this.groupBox2.Location = new System.Drawing.Point(16, 88);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(424, 152);
			this.groupBox2.TabIndex = 5;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "Exclusions";
			// 
			// textBoxExcludePages
			// 
			this.textBoxExcludePages.BackColor = System.Drawing.Color.WhiteSmoke;
			this.textBoxExcludePages.Location = new System.Drawing.Point(8, 40);
			this.textBoxExcludePages.Name = "textBoxExcludePages";
			this.textBoxExcludePages.Size = new System.Drawing.Size(408, 20);
			this.textBoxExcludePages.TabIndex = 0;
			this.textBoxExcludePages.Tag = "Exclude words";
			this.textBoxExcludePages.Text = "";
			// 
			// label17
			// 
			this.label17.Location = new System.Drawing.Point(8, 24);
			this.label17.Name = "label17";
			this.label17.Size = new System.Drawing.Size(408, 16);
			this.label17.TabIndex = 5;
			this.label17.Text = "Exclude pages contain these words: (use semicolon separator)";
			// 
			// textBoxExcludeFiles
			// 
			this.textBoxExcludeFiles.BackColor = System.Drawing.Color.WhiteSmoke;
			this.textBoxExcludeFiles.Location = new System.Drawing.Point(8, 120);
			this.textBoxExcludeFiles.Name = "textBoxExcludeFiles";
			this.textBoxExcludeFiles.Size = new System.Drawing.Size(408, 20);
			this.textBoxExcludeFiles.TabIndex = 2;
			this.textBoxExcludeFiles.Tag = "Exclude files";
			this.textBoxExcludeFiles.Text = "";
			// 
			// label18
			// 
			this.label18.Location = new System.Drawing.Point(8, 104);
			this.label18.Name = "label18";
			this.label18.Size = new System.Drawing.Size(408, 16);
			this.label18.TabIndex = 5;
			this.label18.Text = "Exclude files with these extensions from parsing: (use semicolon separator)";
			// 
			// textBoxExcludeURLs
			// 
			this.textBoxExcludeURLs.BackColor = System.Drawing.Color.WhiteSmoke;
			this.textBoxExcludeURLs.Location = new System.Drawing.Point(8, 80);
			this.textBoxExcludeURLs.Name = "textBoxExcludeURLs";
			this.textBoxExcludeURLs.Size = new System.Drawing.Size(408, 20);
			this.textBoxExcludeURLs.TabIndex = 1;
			this.textBoxExcludeURLs.Tag = "Exclude Hosts";
			this.textBoxExcludeURLs.Text = ".org; .gov;";
			// 
			// label19
			// 
			this.label19.Location = new System.Drawing.Point(8, 64);
			this.label19.Name = "label19";
			this.label19.Size = new System.Drawing.Size(408, 16);
			this.label19.TabIndex = 5;
			this.label19.Text = "Exclude Hosts contain these patterns: (ex: .org; .gov; .net)";
			// 
			// groupBox1
			// 
			this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.groupBox1.Controls.Add(this.checkBoxSettingsUseWindowsDefaultCodePage);
			this.groupBox1.Controls.Add(this.comboBoxSettingsCodePage);
			this.groupBox1.Location = new System.Drawing.Point(16, 8);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(426, 72);
			this.groupBox1.TabIndex = 4;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Code page";
			// 
			// checkBoxSettingsUseWindowsDefaultCodePage
			// 
			this.checkBoxSettingsUseWindowsDefaultCodePage.Checked = true;
			this.checkBoxSettingsUseWindowsDefaultCodePage.CheckState = System.Windows.Forms.CheckState.Checked;
			this.checkBoxSettingsUseWindowsDefaultCodePage.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
			this.checkBoxSettingsUseWindowsDefaultCodePage.Location = new System.Drawing.Point(16, 48);
			this.checkBoxSettingsUseWindowsDefaultCodePage.Name = "checkBoxSettingsUseWindowsDefaultCodePage";
			this.checkBoxSettingsUseWindowsDefaultCodePage.Size = new System.Drawing.Size(144, 16);
			this.checkBoxSettingsUseWindowsDefaultCodePage.TabIndex = 3;
			this.checkBoxSettingsUseWindowsDefaultCodePage.Tag = "Use windows default code page";
			this.checkBoxSettingsUseWindowsDefaultCodePage.Text = "Use windows default";
			this.checkBoxSettingsUseWindowsDefaultCodePage.CheckedChanged += new System.EventHandler(this.checkBoxSettingsUseWindowsDefaultCodePage_CheckedChanged);
			// 
			// comboBoxSettingsCodePage
			// 
			this.comboBoxSettingsCodePage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.comboBoxSettingsCodePage.BackColor = System.Drawing.Color.WhiteSmoke;
			this.comboBoxSettingsCodePage.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
			this.comboBoxSettingsCodePage.Items.AddRange(new object[] {
																		  "Arabic (1256)",
																		  "Baltic (1257)",
																		  "Chinese (Taiwan, Hong Kong) (950)",
																		  "Cyrillic (1251)",
																		  "Greek (1253)",
																		  "Hebrew (1255)",
																		  "Japanese (932)",
																		  "Korean Extended Wansung (949)",
																		  "Latin 1 (1252)",
																		  "Latin 2 (1250)",
																		  "Latin 5 (1254)",
																		  "PRC GBK (XGB) (936)",
																		  "Thai (874)",
																		  "Viet Nam (1258)"});
			this.comboBoxSettingsCodePage.Location = new System.Drawing.Point(16, 24);
			this.comboBoxSettingsCodePage.MaxDropDownItems = 20;
			this.comboBoxSettingsCodePage.Name = "comboBoxSettingsCodePage";
			this.comboBoxSettingsCodePage.Size = new System.Drawing.Size(394, 21);
			this.comboBoxSettingsCodePage.Sorted = true;
			this.comboBoxSettingsCodePage.TabIndex = 0;
			this.comboBoxSettingsCodePage.Tag = "Settings";
			// 
			// buttonSettingsOK
			// 
			this.buttonSettingsOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.buttonSettingsOK.DialogResult = System.Windows.Forms.DialogResult.OK;
			this.buttonSettingsOK.Location = new System.Drawing.Point(290, 282);
			this.buttonSettingsOK.Name = "buttonSettingsOK";
			this.buttonSettingsOK.TabIndex = 1;
			this.buttonSettingsOK.Text = "OK";
			this.buttonSettingsOK.Click += new System.EventHandler(this.buttonSettingsOK_Click);
			// 
			// buttonSettingsCancel
			// 
			this.buttonSettingsCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.buttonSettingsCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
			this.buttonSettingsCancel.Location = new System.Drawing.Point(370, 282);
			this.buttonSettingsCancel.Name = "buttonSettingsCancel";
			this.buttonSettingsCancel.TabIndex = 1;
			this.buttonSettingsCancel.Text = "Cancel";
			// 
			// columnHeaderMatchText
			// 
			this.columnHeaderMatchText.Text = "Description";
			this.columnHeaderMatchText.Width = 300;
			// 
			// columnHeaderMatchName
			// 
			this.columnHeaderMatchName.Text = "Match";
			this.columnHeaderMatchName.Width = 90;
			// 
			// SettingsForm
			// 
			this.AcceptButton = this.buttonSettingsOK;
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.CancelButton = this.buttonSettingsCancel;
			this.ClientSize = new System.Drawing.Size(466, 311);
			this.Controls.Add(this.buttonSettingsOK);
			this.Controls.Add(this.tabControlSettings);
			this.Controls.Add(this.buttonSettingsCancel);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
			this.MaximizeBox = false;
			this.MinimizeBox = false;
			this.Name = "SettingsForm";
			this.ShowInTaskbar = false;
			this.Text = "Settings";
			this.Load += new System.EventHandler(this.SettingsForm_Load);
			this.tabControlSettings.ResumeLayout(false);
			this.tabPageFileMatches.ResumeLayout(false);
			this.tabPageOutput.ResumeLayout(false);
			this.groupBox3.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownRequests)).EndInit();
			this.tabPageConnections.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownRunThreadsCount)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownSleepTime)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDownWebDepth)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
			this.tabPageAdvanced.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox1.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		private void SettingsForm_Load(object sender, System.EventArgs e)
		{
			Settings.GetValue(this);
			this.comboBoxSettingsCodePage.Enabled = this.checkBoxSettingsUseWindowsDefaultCodePage.Checked == false;

			if(this.textBoxDownloadFolder.Text == "")
				this.textBoxDownloadFolder.Text = System.Environment.CurrentDirectory;

			if(SelectedIndex != -1)
				this.tabControlSettings.SelectedIndex = SelectedIndex;
		}

		private void buttonSettingsOK_Click(object sender, System.EventArgs e)
		{
			Settings.SetValue(this);
		}

		private void checkBoxSettingsUseWindowsDefaultCodePage_CheckedChanged(object sender, System.EventArgs e)
		{
			this.comboBoxSettingsCodePage.Enabled = this.checkBoxSettingsUseWindowsDefaultCodePage.Checked == false;
		}

		private void buttonAddExt_Click(object sender, System.EventArgs e)
		{
			FileTypeForm form = new FileTypeForm();
			if(form.ShowDialog() == DialogResult.OK)
			{
				ListViewItem item = this.listViewFileMatches.Items.Add(form.textBoxTypeDescription.Text);
				item.SubItems.Add(form.numericUpDownMinSize.Value.ToString());
				item.SubItems.Add(form.numericUpDownMaxSize.Value.ToString());
			}
		}

		private void buttonEditExt_Click(object sender, System.EventArgs e)
		{
			if(this.listViewFileMatches.SelectedItems.Count == 0)
				return;
			ListViewItem item = this.listViewFileMatches.SelectedItems[0];
			FileTypeForm form = new FileTypeForm();
			form.textBoxTypeDescription.Text = item.Text;
			if(item.SubItems.Count <= 1)
				item.SubItems.Add("0");
			form.numericUpDownMinSize.Value = int.Parse(item.SubItems[1].Text);
			if(item.SubItems.Count <= 2)
				item.SubItems.Add("0");
			form.numericUpDownMaxSize.Value = int.Parse(item.SubItems[2].Text);

			if(form.ShowDialog() == DialogResult.OK)
			{
				item.Text = form.textBoxTypeDescription.Text;
				item.SubItems[1].Text = form.numericUpDownMinSize.Value.ToString();
				item.SubItems[2].Text = form.numericUpDownMaxSize.Value.ToString();
			}
		}

		private void buttonDeleteExt_Click(object sender, System.EventArgs e)
		{
			if(this.listViewFileMatches.SelectedItems.Count == 0)
				return;
			ListViewItem item = this.listViewFileMatches.SelectedItems[0];
			item.Remove();
		}

		private void buttonDownloadFolderBrowse_Click(object sender, System.EventArgs e)
		{
			BrowseForFolderClass form = new BrowseForFolderClass();
			form.Title = "Select folder to save crawled files";
			if(form.ShowDialog() == DialogResult.OK)
				this.textBoxDownloadFolder.Text = form.DirectoryPath;
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -