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

📄 param.cpp

📁 一个操作系统资源监测器的需求、设计与实现
💻 CPP
📖 第 1 页 / 共 5 页
字号:

	//采集周期,默认值为1
	//标签:<ColCyc></ColCyc>
	//数据类型为整型
	int fv=param->getIntegerValue("ColCyc");
	if(fv==-1)
	{
		m_period=1;
	}
	else
	{
		m_period=fv;
	}

	//采集对象
	//CPU,默认状态为选中
	//标签:<CPU></CPU>
	//数值为Sel:选中;为UnSel:未选中
	fstr=param->getCStringValue("CPU");
	if(fstr!="UnSel")
	{
		m_cpu=true;
	}
	else
	{
		m_cpu=false;
	}
	//内存,默认状态为选中
	//标签:<Memory></Memory>
	//数值为Sel:选中;为UnSel:未选中
	fstr=param->getCStringValue("Memory");
	if(fstr!="UnSel")
	{
		m_memory=true;
	}
	else
	{
		m_memory=false;
	}
	//网络流入量,默认状态为选中
	//标签:<NetIN></NetIN>
	//数值为Sel:选中;为UnSel:未选中
	fstr=param->getCStringValue("NetIN");
	if(fstr!="UnSel")
	{
		m_netin=true;
	}
	else
	{
		m_netin=false;
	}
	//网络流出量,默认状态为选中
	//标签:<NetOUT></NetOUT>
	//数值为Sel:选中;为UnSel:未选中
	fstr=param->getCStringValue("NetOUT");
	if(fstr!="UnSel")
	{
		m_netout=true;
	}
	else
	{
		m_netout=false;
	}
	//进程,默认状态为选中
	//标签:<PROCESS></PROCESS>
	//数值为Sel:选中;为UnSel:未选中
	fstr=param->getCStringValue("PROCESS");
	if(fstr!="UnSel")
	{
		m_process=true;
	}
	else
	{
		m_process=false;
	}

	//预警机制
	//设定框一
	//标签:<FRAME1></FRAME1>
	fstr=param->getCStringValue("FRAME1");
	if(fstr=="")  //没有设定参数,默认状态
	{
		m_pre11=true;
		m_pre12=true;
		m_pre13=true;
		m_pre14=true;

		m_min11=m_max12=90;
		m_min12=m_max13=80;
		m_min13=m_max14=50;
		m_min14=m_max15=10;

		m_cvalue11=255;
		m_cvalue12=16744703;
		m_cvalue13=16744576;
		m_cvalue14=65280;
		m_cvalue15=12632256;

		crColor11=255;
		crColor12=16744703;
		crColor13=16744576;
		crColor14=65280;
		crColor15=12632256;

		m_cplat11.SetFocus();
		m_cplat12.SetFocus();
		m_cplat13.SetFocus();
		m_cplat14.SetFocus();
		m_cplat15.SetFocus();
	}
	else
	{
		//级别:严重
		//标签:<Level1></Level1>
		int start=fstr.Find("Level1",0);
		start+=7;
		int pos=fstr.Find("<",start);
		CString mstr=fstr.Mid(start,pos-start);
		int mid=mstr.Find(" ",0);
		CString sel=mstr.Left(mid);
		if(sel=="UnSel")
		{
			m_pre11=false;
			crColor11=16777215;
			m_cplat11.SetFocus();
			m_cctrl11.EnableWindow(FALSE);
			m_cplat11.EnableWindow(FALSE);
			m_heavily1.EnableWindow(FALSE);
		}
		else
		{
			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			int value=atoi(sel);
			m_cvalue11=value;
			crColor11=value;

			sel=mstr.Right(mstr.GetLength()-mid-1);
			value=atoi(sel);
			m_min11=value;

			m_pre11=true;
			
			m_cplat11.SetFocus();
		}
		//级别:紧张
		//标签:<Level2></Leve12>
		start=fstr.Find("Level2",pos);
		start+=7;
		pos=fstr.Find("<",start);
		mstr=fstr.Mid(start,pos-start);
		mid=mstr.Find(" ",0);
		sel=mstr.Left(mid);
		if(sel=="UnSel")
		{
			m_pre12=false;
			crColor12=16777215;
			m_cplat12.SetFocus();
			m_up12.EnableWindow(FALSE);
			m_cctrl12.EnableWindow(FALSE);
			m_cplat12.EnableWindow(FALSE);
			m_heavily2.EnableWindow(FALSE);
		}
		else
		{
			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			int value=atoi(sel);
			m_cvalue12=value;
			crColor12=value;

			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			value=atoi(sel);
			m_max12=value;

			sel=mstr.Right(mstr.GetLength()-mid-1);
			value=atoi(sel);
			m_min12=value;

			m_pre12=true;
			
			m_cplat12.SetFocus();
		}
		//级别:略微
		//标签:<Level3></Leve13>
		start=fstr.Find("Level3",pos);
		start+=7;
		pos=fstr.Find("<",start);
		mstr=fstr.Mid(start,pos-start);
		mid=mstr.Find(" ",0);
		sel=mstr.Left(mid);
		if(sel=="UnSel")
		{
			m_pre13=false;
			crColor13=16777215;
			m_cplat13.SetFocus();
			m_up13.EnableWindow(FALSE);
			m_cctrl13.EnableWindow(FALSE);
			m_cplat13.EnableWindow(FALSE);
			m_heavily3.EnableWindow(FALSE);
		}
		else
		{
			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			int value=atoi(sel);
			m_cvalue13=value;
			crColor13=value;

			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			value=atoi(sel);
			m_max13=value;

			sel=mstr.Right(mstr.GetLength()-mid-1);
			value=atoi(sel);
			m_min13=value;

			m_pre13=true;
			
			m_cplat13.SetFocus();
		}
		//级别:正常
		//标签:<Level4></Leve14>
		start=fstr.Find("Level4",pos);
		start+=7;
		pos=fstr.Find("<",start);
		mstr=fstr.Mid(start,pos-start);
		mid=mstr.Find(" ",0);
		sel=mstr.Left(mid);
		if(sel=="UnSel")
		{
			m_pre14=false;
			m_pre14=false;
			crColor14=16777215;
			m_up14.EnableWindow(FALSE);
			m_cctrl14.EnableWindow(FALSE);
			m_cplat14.EnableWindow(FALSE);
			m_heavily4.EnableWindow(FALSE);
		}
		else
		{
			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			int value=atoi(sel);
			m_cvalue14=value;
			crColor14=value;

			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			value=atoi(sel);
			m_max14=value;

			sel=mstr.Right(mstr.GetLength()-mid-1);
			value=atoi(sel);
			m_min14=value;

			m_pre14=true;
			
			m_cplat14.SetFocus();
		}
		//级别:富余
		//标签:<Level5></Leve15>
		start=fstr.Find("Level5",pos);
		start+=7;
		pos=fstr.Find("<",start);
		mstr=fstr.Mid(start,pos-start);
		
		mid=mstr.Find(" ",0);
		sel=mstr.Left(mid);
		int value=atoi(sel);
		m_cvalue15=value;
		crColor15=value;
		
		sel=mstr.Right(mstr.GetLength()-mid-1);
		value=atoi(sel);
		m_max15=value;

		m_cplat15.SetFocus();
		
	}
	//设定框二
	//标签:<FRAME2></FRAME2>
	fstr=param->getCStringValue("FRAME2");
	if(fstr=="")  //没有设定参数,默认状态
	{
		m_pre21=true;
		m_pre22=true;
		m_pre23=true;
		m_pre24=true;

		m_min21=m_max22=90;
		m_min22=m_max23=80;
		m_min23=m_max24=50;
		m_min24=m_max25=10;

		m_cvalue21=255;
		m_cvalue22=16744703;
		m_cvalue23=16744576;
		m_cvalue24=65280;
		m_cvalue25=12632256;

		crColor21=255;
		crColor22=16744703;
		crColor23=16744576;
		crColor24=65280;
		crColor25=12632256;

		m_cplat21.SetFocus();
		m_cplat22.SetFocus();
		m_cplat23.SetFocus();
		m_cplat24.SetFocus();
		m_cplat25.SetFocus();
	}
	else
	{
		//级别:严重
		//标签:<Level1></Level1>
		int start=fstr.Find("Level1",0);
		start+=7;
		int pos=fstr.Find("<",start);
		CString mstr=fstr.Mid(start,pos-start);
		int mid=mstr.Find(" ",0);
		CString sel=mstr.Left(mid);
		if(sel=="UnSel")
		{
			m_pre21=false;
			m_pre21=false;
			crColor21=16777215;
			m_cctrl21.EnableWindow(FALSE);
			m_cplat21.EnableWindow(FALSE);
			m_tense1.EnableWindow(FALSE);
		}
		else
		{
			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			int value=atoi(sel);
			m_cvalue21=value;
			crColor21=value;

			sel=mstr.Right(mstr.GetLength()-mid-1);
			value=atoi(sel);
			m_min21=value;

			m_pre21=true;
			
			m_cplat21.SetFocus();
		}
		//级别:紧张
		//标签:<Level2></Leve12>
		start=fstr.Find("Level2",pos);
		start+=7;
		pos=fstr.Find("<",start);
		mstr=fstr.Mid(start,pos-start);
		mid=mstr.Find(" ",0);
		sel=mstr.Left(mid);
		if(sel=="UnSel")
		{
			m_pre22=false;
			m_pre22=false;
			crColor22=16777215;
			m_up22.EnableWindow(FALSE);
			m_cctrl22.EnableWindow(FALSE);
			m_cplat22.EnableWindow(FALSE);
			m_tense2.EnableWindow(FALSE);
		}
		else
		{
			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			int value=atoi(sel);
			m_cvalue22=value;
			crColor22=value;

			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			value=atoi(sel);
			m_max22=value;

			sel=mstr.Right(mstr.GetLength()-mid-1);
			value=atoi(sel);
			m_min22=value;

			m_pre22=true;
			
			m_cplat22.SetFocus();
		}
		//级别:略微
		//标签:<Level3></Leve13>
		start=fstr.Find("Level3",pos);
		start+=7;
		pos=fstr.Find("<",start);
		mstr=fstr.Mid(start,pos-start);
		mid=mstr.Find(" ",0);
		sel=mstr.Left(mid);
		if(sel=="UnSel")
		{
			m_pre23=false;
			m_pre23=false;
			crColor23=16777215;
			m_up23.EnableWindow(FALSE);
			m_cctrl23.EnableWindow(FALSE);
			m_cplat23.EnableWindow(FALSE);
			m_tense3.EnableWindow(FALSE);
		}
		else
		{
			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			int value=atoi(sel);
			m_cvalue23=value;
			crColor23=value;

			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			value=atoi(sel);
			m_max23=value;

			sel=mstr.Right(mstr.GetLength()-mid-1);
			value=atoi(sel);
			m_min23=value;

			m_pre23=true;
			
			m_cplat23.SetFocus();
		}
		//级别:正常
		//标签:<Level4></Leve14>
		start=fstr.Find("Level4",pos);
		start+=7;
		pos=fstr.Find("<",start);
		mstr=fstr.Mid(start,pos-start);
		mid=mstr.Find(" ",0);
		sel=mstr.Left(mid);
		if(sel=="UnSel")
		{
			m_pre24=false;
			m_pre24=false;
			crColor24=16777215;
			m_up24.EnableWindow(FALSE);
			m_cctrl24.EnableWindow(FALSE);
			m_cplat24.EnableWindow(FALSE);
			m_tense4.EnableWindow(FALSE);
		}
		else
		{
			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			int value=atoi(sel);
			m_cvalue24=value;
			crColor24=value;

			mstr=mstr.Right(mstr.GetLength()-mid-1);
			mid=mstr.Find(" ",0);

			sel=mstr.Left(mid);
			value=atoi(sel);
			m_max24=value;

			sel=mstr.Right(mstr.GetLength()-mid-1);
			value=atoi(sel);
			m_min24=value;

			m_pre24=true;
			
			m_cplat24.SetFocus();
		}
		//级别:富余
		//标签:<Level5></Leve15>
		start=fstr.Find("Level5",pos);
		start+=7;
		pos=fstr.Find("<",start);
		mstr=fstr.Mid(start,pos-start);
		
		mid=mstr.Find(" ",0);
		sel=mstr.Left(mid);
		int value=atoi(sel);
		m_cvalue25=value;
		crColor25=value;
		
		sel=mstr.Right(mstr.GetLength()-mid-1);
		value=atoi(sel);
		m_max25=value;

⌨️ 快捷键说明

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