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

📄 filter.cpp

📁 匿名通信代码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
	{
        MessageBox("请选择操作类型");
		return;
	}

	if(fnew)//保存文件对话框
	{
        CFileDialog cfdlg(false, 0, 0, OFN_HIDEREADONLY | OFN_EXPLORER | OFN_OVERWRITEPROMPT,lpszFilter, 0); ///TRUE为OPEN对话框,FALSE为SAVE AS对话框  
		if(cfdlg.DoModal() == IDOK)
		{
			CStdioFile newfile;
			if((newfile.Open(cfdlg.GetPathName(),CFile::modeCreate | CFile::modeWrite | CFile::typeText)) == NULL)
			{
				AfxMessageBox("ERROR OF OPENING");
				return;
			}
			else
			{
				newfile.SeekToBegin();
			    newfile.WriteString(str);
			}
			newfile.Close();

			AfxMessageBox("添加新规则成功!");
			return ;
			
		}
	}
	
	if(fold)  //打开文件对话框
	{
		CFileDialog cfdlg(true, 0, 0, OFN_HIDEREADONLY | OFN_EXPLORER | OFN_OVERWRITEPROMPT,lpszFilter, 0); ///TRUE为OPEN对话框,FALSE为SAVE AS对话框
		
		if(cfdlg.DoModal() == IDOK)
		{
			CStdioFile oldfile;
			if((oldfile.Open(cfdlg.GetPathName(),CFile::modeReadWrite | CFile::typeText)) == NULL)
			{
				AfxMessageBox("ERROR OF OPENING");
				return;
			}
			else
			{
				oldfile.SeekToEnd();
				oldfile.WriteString("\n" + str);
			}
			oldfile.Close();

			AfxMessageBox("添加新规则成功!");
			return ;
			
		}
	}  
	
	//	CDialog::OnOK();	
}

void Filter::OnStart() 
{
	// TODO: Add your control notification handler code here

	if(m_start == false)
	{
		m_start = true;
		m_timeStart.EnableWindow(true);
		m_dateStart.EnableWindow(true);                                                                                                                                                                                                                                                                                                                                       
	}
	else
	{
		m_start = false;
	    m_timeStart.EnableWindow(false);
		m_dateStart.EnableWindow(false);
	}
	
}

void Filter::OnEnd() 
{
	// TODO: Add your control notification handler code here
	if(m_end == false)
	{
		m_end = true;
		m_timeEnd.EnableWindow(true);
		m_dateEnd.EnableWindow(true);                                                                                                                                                                                                                                                                                                                                       
	}
	else
	{
		m_end = false;
	    m_timeEnd.EnableWindow(false);
		m_dateEnd.EnableWindow(false);
	}
	
}

void Filter::On_proto_check() 
{
	// TODO: Add your control notification handler code here
    if(m_proto == false)
	{
		m_proto = true;
		m_protocol.EnableWindow(true); 
		this->m_protocol.SetCurSel(0);
	}
	else
	{
		m_proto = false;
	    m_protocol.EnableWindow(false);
	}
	
}

void Filter::On_len_check() 
{
	// TODO: Add your control notification handler code here
	if(m_len == false)
	{
		m_len = true;
		m_size.EnableWindow(true); 
	}
	else
	{
		m_len = false;
	    m_size.EnableWindow(false);
	}
	
	
}
void Filter::On_sip_check() 
{
	// TODO: Add your control notification handler code here
	if(m_b_srcip)
	{
		m_b_srcip = false;
		m_sip.EnableWindow(false);
		m_srcipl.EnableWindow(false);
		m_srciph.EnableWindow(false);
		m_c_srcipl.EnableWindow(false);
		m_c_srciph.EnableWindow(false);
		m_v_srcip.EnableWindow(false);

	}
	else
	{
		m_b_srcipl = false;
		m_b_srciph = false;
		m_b_srcip = true;
		UpdateData(false);
		m_sip.EnableWindow(true);
		this->m_sip.SetCurSel(0);
		m_c_srcipl.EnableWindow(true);
		m_c_srciph.EnableWindow(true);
	}
	
}

void Filter::OnSelchangeCombo1_sip() 
{
	// TODO: Add your control notification handler code here
	if(m_sip.GetCurSel() == 1)
	{
        m_srcipl.EnableWindow(false);
		m_srciph.EnableWindow(false);
		m_c_srcipl.EnableWindow(false);
		m_c_srciph.EnableWindow(false);
		m_v_srcip.EnableWindow(true);
	}
	else
	{
		m_b_srcipl = false;
		m_b_srciph = false;
		UpdateData(false);
		m_c_srcipl.EnableWindow(true);
		m_c_srciph.EnableWindow(true);
		m_v_srcip.EnableWindow(false);
	}
	
}

void Filter::On_dip_check() 
{
	// TODO: Add your control notification handler code here
	if(m_b_dstip)
	{
		m_b_dstip = false;
		m_dip.EnableWindow(false);
		m_dstipl.EnableWindow(false);
		m_dstiph.EnableWindow(false);
		m_c_dstipl.EnableWindow(false);
		m_c_dstiph.EnableWindow(false);
		m_v_dstip.EnableWindow(false);

	}
	else
	{
		m_b_dstipl = false;
		m_b_dstiph = false;
		m_b_dstip = true;
		UpdateData(false);
		m_dip.EnableWindow(true);
		this->m_dip.SetCurSel(0);
		m_c_dstipl.EnableWindow(true);
		m_c_dstiph.EnableWindow(true);
	}
}

void Filter::OnSelchangeCombo2_dip() 
{
	// TODO: Add your control notification handler code here
	if(m_dip.GetCurSel() == 1)
	{
        m_dstipl.EnableWindow(false);
		m_dstiph.EnableWindow(false);
		m_c_dstipl.EnableWindow(false);
		m_c_dstiph.EnableWindow(false);
		m_v_dstip.EnableWindow(true);
	}
	else
	{
        m_b_dstipl = false;
		m_b_dstiph = false;
		UpdateData(false);
        m_c_dstipl.EnableWindow(true);
		m_c_dstiph.EnableWindow(true);
		m_v_dstip.EnableWindow(false);
	}
}

void Filter::On_srcport_check() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);

	if(m_b_srcport)
	{
		//m_b_srcportl = false;
		//m_b_srcporth = false;
		//m_b_srcport = true;
		m_sport.EnableWindow(true);
		this->m_sport.SetCurSel(0);
		m_c_srcportl.EnableWindow(true);
		m_c_srcporth.EnableWindow(true);
	}
	else
	{
		m_b_srcport = false;
		m_sport.EnableWindow(false);
		m_e_srcportl.EnableWindow(false);   
		m_e_srcporth.EnableWindow(false);
		m_c_srcportl.EnableWindow(false);
		m_c_srcporth.EnableWindow(false);
		m_e_srcport.EnableWindow(false);
	}

	UpdateData(false);
}

void Filter::OnSelchangeCombo3_sport() 
{
	// TODO: Add your control notification handler code here
	if(m_sport.GetCurSel() == 1)
	{
        m_e_srcportl.EnableWindow(false);
		m_e_srcporth.EnableWindow(false);
		m_c_srcportl.EnableWindow(false);
		m_c_srcporth.EnableWindow(false);
		m_e_srcport.EnableWindow(true);
	}
	else
	{
		m_b_srcportl = false;
		m_b_srcporth = false;
		UpdateData(false);
		m_c_srcportl.EnableWindow(true);
		m_c_srcporth.EnableWindow(true);
		m_e_srcport.EnableWindow(false);
	}
}

void Filter::On_dstport_check() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);
    if(m_b_dstport)
	{
		//m_b_dstportl = false;
		//m_b_dstporth = false;
		//m_b_dstport = true;
		//UpdateData(false);
		m_dport.EnableWindow(true);
		this->m_dport.SetCurSel(0);
		m_c_dstportl.EnableWindow(true);
		m_c_dstporth.EnableWindow(true);

	}
	else
	{
		//m_b_dstport = false;
		m_dport.EnableWindow(false);
		m_e_dstportl.EnableWindow(false);
		m_e_dstporth.EnableWindow(false);
		m_c_dstportl.EnableWindow(false);
		m_c_dstporth.EnableWindow(false);
		m_e_dstport.EnableWindow(false);
	}
	UpdateData(false);
	
}

void Filter::OnSelchangeCombo4_dport() 
{
	// TODO: Add your control notification handler code here
	if(m_dport.GetCurSel() == 1)
	{
        m_e_dstportl.EnableWindow(false);
		m_e_dstporth.EnableWindow(false);
		m_c_dstportl.EnableWindow(false);
		m_c_dstporth.EnableWindow(false);
		m_e_dstport.EnableWindow(true);
	}
	else
	{
		m_b_dstportl = false;
		m_b_dstporth = false;
		UpdateData(false);
		m_c_dstportl.EnableWindow(true);
		m_c_dstporth.EnableWindow(true);
		m_e_dstport.EnableWindow(false);
	}
}

void Filter::On_srcipl_check() 
{
	// TODO: Add your control notification handler code here
	if(m_b_srcipl)
	{
		m_b_srcipl = false;
		m_srcipl.EnableWindow(false);
	}
	else
	{
		m_b_srcipl = true;
		m_srcipl.EnableWindow(true);
	}
}

void Filter::On_srciph_check() 
{
	// TODO: Add your control notification handler code here
    if(m_b_srciph)
	{
		m_b_srciph = false;
		m_srciph.EnableWindow(false);
	}
	else
	{
		m_b_srciph = true;
		m_srciph.EnableWindow(true);
	}
	
}

void Filter::On_dstipl_check() 
{
	// TODO: Add your control notification handler code here
	if(m_b_dstipl)
	{
		m_b_dstipl = false;
		m_dstipl.EnableWindow(false);
	}
	else
	{
		m_b_dstipl = true;
		m_dstipl.EnableWindow(true);
	}
	
}

void Filter::On_dstiph_check() 
{
	// TODO: Add your control notification handler code here
	if(m_b_dstiph)
	{
		m_b_dstiph = false;
		m_dstiph.EnableWindow(false);
	}
	else
	{
		m_b_dstiph = true;
		m_dstiph.EnableWindow(true);
	}
	
}

void Filter::On_srcportl_check() 
{
	// TODO: Add your control notification handler code here
    UpdateData(true);

	if(m_b_srcportl)
	{
		//m_b_srcportl = false;
		m_e_srcportl.EnableWindow(true);
	}
	else
	{
		//m_b_srcportl = true;
		m_e_srcportl.EnableWindow(false);
	}

	UpdateData(false);
}

void Filter::On_srcporth_check() 
{
	// TODO: Add your control notification handler code here
    UpdateData(true);
	if(m_b_srcporth)
	{
		//m_b_srcporth = false;
		m_e_srcporth.EnableWindow(true);
	}
	else
	{
		//m_b_srcporth = true;
		m_e_srcporth.EnableWindow(false);
	}
	UpdateData(false);
}

void Filter::On_dstportl_check() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);

    if(m_b_dstportl)
	{
		//m_b_dstportl = false;
		m_e_dstportl.EnableWindow(true);
	}
	else
	{
		m_e_dstportl.EnableWindow(false);
		//m_b_dstportl = true;
	}

	UpdateData(false);
	
}

void Filter::On_dstporth_check() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);

	if(m_b_dstporth)
	{
		//m_b_dstporth = false;
		m_e_dstporth.EnableWindow(true);
	}
	else
	{
		//m_b_dstporth = true;
		m_e_dstporth.EnableWindow(false);
		
	}
	UpdateData(false);

}

⌨️ 快捷键说明

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