www.pudn.com > SafeClean.rar > Options.cpp


// Options.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "SafeClean.h" 
#include "Options.h" 
#include "Globals.h" 
#include "Stdio.h" 
#include "Rulez.h" 
 
  
 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// Options dialog 
FILE *Settings; 
int flag; 
 
int one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve; 
Options::Options(CWnd* pParent /*=NULL*/) 
	: CDialog(Options::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(Options) 
/*	m_MyChoice = FALSE; 
	m_Logtxt = FALSE; 
	m_Garbage = FALSE; 
	m_eFiles = FALSE;*/ 
	//}}AFX_DATA_INIT 
 
	 Settings=fopen("c:\\Temp\\Setting.ini","r"); 
	 if(Settings!=NULL) 
	 { 
   fscanf(Settings,"%d %d %d %d %d %d %d %d %d %d %d %d",&one,&two,&three,&four,&five,&six,&seven,&eight,&nine,&ten,&eleven,&twelve); 
   if(one==0){m_Temp = TRUE;} 
	else{m_Temp = FALSE;} 
	if(two==0){m_Back = TRUE;} 
	else{m_Back = FALSE;} 
	if(three==0){m_Setup= TRUE;} 
	else{m_Setup= FALSE;} 
	if(four==0){m_Help=TRUE;} 
	else{m_Help=FALSE;} 
	if(five==0){m_Sys = TRUE;} 
	else{m_Sys = FALSE;} 
	if(six==0){m_Me = TRUE; } 
	else{m_Me = FALSE; } 
	if(seven==0){m_Cpp = TRUE;} 
	else{m_Cpp = FALSE;} 
	if(eight==0){m_Vcpp = TRUE;} 
	else{m_Vcpp = FALSE;} 
 
	if(nine==0){m_Logtxt = TRUE;} 
	else{m_Logtxt = FALSE;} 
	if(ten==0){m_MyChoice = TRUE;} 
	else{m_MyChoice = FALSE;} 
 
	if(eleven==0){m_Garbage = TRUE;} 
	else{m_Garbage = FALSE;} 
 
	if(twelve==0){m_eFiles = TRUE;} 
	else{m_eFiles = FALSE;} 
	 
	 fcloseall(); 
	} 
	 else 
	 { 
		 AfxMessageBox("Setting.ini File missing or Path missing ?\n              ERROR! \n It seems that you have not installed this product on c drive.\n Install/ReInstall the product on C-Drive only as is.   \n    Else mail the author for other reason."); 
		 AfxMessageBox("Run The program from Start menu or Create Shortcut !"); 
	 } 
} 
 
 
void Options::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(Options) 
	DDX_Control(pDX, IDC_STATIC_FADER, m_strFader); 
	DDX_Control(pDX, IDC_SAFEANI, m_Safeani); 
	DDX_Control(pDX, ID_SELALL, m_Check); 
	DDX_Control(pDX, IDCANCEL, m_Cancel); 
	DDX_Check(pDX, IDC_CHECK1_TEMP, m_Temp); 
	DDX_Check(pDX, IDC_CHECK2_BACK, m_Back); 
	DDX_Check(pDX, IDC_CHECK3_SETUP, m_Setup); 
	DDX_Check(pDX, IDC_CHECK4_HELP, m_Help); 
	DDX_Check(pDX, IDC_CHECK5_SYS, m_Sys); 
	DDX_Check(pDX, IDC_CHECK6_ME, m_Me); 
	DDX_Check(pDX, IDC_CHECK7_CPP, m_Cpp); 
	DDX_Check(pDX, IDC_CHECK8_VCPP, m_Vcpp); 
	DDX_Check(pDX, IDC_CHECK10_MyCHOICE, m_MyChoice); 
	DDX_Check(pDX, IDC_CHECK9_LOGTXT, m_Logtxt); 
	DDX_Check(pDX, IDC_GARBAGE, m_Garbage); 
	DDX_Check(pDX, IDC_EMPTYFILES, m_eFiles); 
	//}}AFX_DATA_MAP 
 
  m_strFader.Display("Hover bitmap for actions.", "", 100); 
  m_Check.LoadBitmap(IDB_OKK); 
  CString text3=_T("Cancel."); 
  m_Check.SetToolTipText(&text3); 
   
    
  m_Cancel.LoadBitmap(IDB_CANCEL); 
  CString text2=_T("Lock your selections, else Default will be loaded........");   
  m_Cancel.SetToolTipText(&text2); 
     
     
  
  	m_Safeani.Open(IDR_SAFE); 
   m_Safeani.Play( 0, -1,-1 ); 
 //  
} 
 
 
BEGIN_MESSAGE_MAP(Options, CDialog) 
	//{{AFX_MSG_MAP(Options) 
	ON_BN_CLICKED(ID_SELALL, OnSelall) 
	ON_BN_CLICKED(IDC_CHECK1_TEMP, OnCheck1Temp) 
	ON_BN_CLICKED(IDC_CHECK2_BACK, OnCheck2Back) 
	ON_BN_CLICKED(IDC_CHECK3_SETUP, OnCheck3Setup) 
	ON_BN_CLICKED(IDC_CHECK4_HELP, OnCheck4Help) 
	ON_BN_CLICKED(IDC_CHECK5_SYS, OnCheck5Sys) 
	ON_BN_CLICKED(IDC_CHECK6_ME, OnCheck6Me) 
	ON_BN_CLICKED(IDC_CHECK7_CPP, OnCheck7Cpp) 
	ON_BN_CLICKED(IDC_CHECK8_VCPP, OnCheck8Vcpp) 
	ON_BN_CLICKED(IDC_CHECK9_LOGTXT, OnCheck9Logtxt) 
	ON_BN_CLICKED(IDC_CHECK10_MyCHOICE, OnCHECK10MyCHOICE) 
	ON_BN_CLICKED(IDC_GARBAGE, OnGarbage) 
	ON_BN_CLICKED(IDC_EMPTYFILES, OnEmptyfiles) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// Options message handlers 
 
   
 
  
 
  
 
void Options::OnCheck1Temp()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_Temp==TRUE){m_Temp=FALSE;one=1;} 
	else{m_Back=TRUE;one=0; 
     m_strFader.Display("Temp files : *.tmp,*.??$.", "", 100); 
	} 
} 
 
void Options::OnCheck2Back()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_Back==TRUE){ m_Back=FALSE;two=1;} 
	else{ m_Back=TRUE;two=0; 
	m_strFader.Display("Back files : *.bak,*.old.", "", 100); 
	} 
} 
 
void Options::OnCheck3Setup()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_Setup==TRUE){ m_Setup=FALSE;three=1;} 
	else{ m_Setup=TRUE;three=0; 
	m_strFader.Display("Setup temp files : *.dir,*.---.", "", 100); 
	} 
} 
 
void Options::OnCheck4Help()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_Help==TRUE){ m_Help=FALSE;four=1;} 
	else{ m_Help=TRUE;four=0; 
	m_strFader.Display("Help temp files : *.fts,*.gid,*.ftg", "", 100); 
	} 
} 
 
void Options::OnCheck5Sys()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_Sys==TRUE){ m_Sys=FALSE;five=1;} 
	else{ m_Sys=TRUE;five=0; 
	m_strFader.Display("log temp files : *log.dat,*.log,*log.prv.", "", 100); 
	} 
	 
} 
 
void Options::OnCheck6Me()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_Me==TRUE){ m_Me=FALSE;six=1;} 
	else{ m_Me=TRUE;six=0; 
	m_strFader.Display("WinMe : *.cpy", "", 100); 
	} 
} 
 
void Options::OnCheck7Cpp()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_Cpp==TRUE){ m_Cpp=FALSE;seven=1;} 
	else{ m_Cpp=TRUE;seven=0; 
	m_strFader.Display("C++ builder: *.ilc,*.ild,*.ilf,*.ils,*.tds", "", 100); 
	} 
} 
 
void Options::OnCheck8Vcpp()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_Vcpp==TRUE){ m_Vcpp=FALSE;eight=1;} 
	else{ m_Vcpp=TRUE;eight=0; 
	m_strFader.Display("VC++ temp files : *.bsc,*.ilk,*.res,*.pch", "", 100); 
	} 
} 
 
 
void Options::OnCheck9Logtxt()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_Logtxt==TRUE){ m_Logtxt=FALSE;nine=1;} 
	else{ m_Logtxt=TRUE;nine=0; 
	m_strFader.Initialise( RGB(100,100,150), RGB(200,200,0), RGB(0,220,0) ); 
	m_strFader.SetDrawShadow(); 
	m_strFader.SetAlignCentre(); 
	m_strFader.Display("Log text files: *log.txt", "", 100); 
	} 
} 
 
void Options::OnCHECK10MyCHOICE()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_MyChoice==TRUE){ m_MyChoice=FALSE;ten=1;} 
	else{ m_MyChoice=TRUE;ten=0; 
	m_strFader.SetBackgroundColour( RGB(6,60,60) ); 
	m_strFader.SetMainTextColour( RGB(200,200,250) ); 
	m_strFader.SetSubTextColour( RGB(200,200,250) ); 
	m_strFader.SetDrawShadow(false); 
	m_strFader.SetAlignCentre(); 
	m_strFader.Display("eNd uSeR rUlEz", "", 100); 
	 Rulez aRule; 
	 aRule.DoModal();  
	} 
} 
 
 
void Options::OnGarbage()  
{ 
	// TODO: Add your control notification handler code here 
	 
		if(m_Garbage==TRUE){ m_Garbage=FALSE;eleven=1;} 
	else{ m_Garbage=TRUE;eleven=0; 
	m_strFader.SetBackgroundColour( RGB(60,60,60) ); 
	m_strFader.SetMainTextColour( RGB(200,200,250) ); 
	m_strFader.SetSubTextColour( RGB(200,200,250) ); 
	m_strFader.SetDrawShadow(false); 
	m_strFader.SetAlignCentre(); 
	m_strFader.Display("Grabage : *.~*, *.-*,*.dos", "", 100); 
	  
	} 
} 
 
 
 
void Options::OnEmptyfiles()  
{ 
	// TODO: Add your control notification handler code here 
	if(m_eFiles==TRUE){ m_eFiles=FALSE;twelve=1;} 
	else{ m_eFiles=TRUE;twelve=0; 
	m_strFader.Display("Files lenght 0 bytes", "", 100); 
	} 
} 
void Options::OnSelall()  
{ 
	// TODO: Add your control notification handler code here 
 
	 m_Safeani.Stop(); 
	 m_Safeani.Close(); 
       
	 CDialog::OnCancel();  
	  
  
} 
 
void Options::OnCancel()  
{ 
	// TODO: Add extra cleanup here 
   Settings=fopen("c:\\Temp\\Setting.ini","w+"); 
   if(Settings==NULL) 
   { 
 
	   AfxMessageBox("Error writing to disk! \n disk write protect error.");exit(0); 
   } 
   fprintf(Settings,"%d %d %d %d %d %d %d %d %d %d %d %d",one,two,three,four,five,six,seven,eight,nine,ten,eleven,twelve); 
   fcloseall(); 
   m_Safeani.Stop(); 
	m_Safeani.Close(); 
	CDialog::OnCancel(); 
}