Xeim Configuration Program Source code

Source: Internet
Author: User

#include "StdAfx.h"
#include "Xeim_users.h"
#include "XiemUsers.h"
#include "Xeim_config.h"
#include "XiemUsersDlg.h"
#include "INI.h"

Flying Pigeon Biography: http://www.freeeim.com

Xeim_config::xeim_config ()
{
Database configuration information
M_szserver = "localhost";
M_szdatabase = "Xeimdatabase"; Database information;
M_ntype = ms_access; The type of database used, where access is default;
M_szusername = "Xeim"; database access name;
M_szpassword = "Xeim"; database access password;
szxusertable = "Xeim_user";//user Information table;
szxmessagetable = "Xeim_message";//message information table;
szxcontacttable = "xeim_contact";//contact information table;

/* Contact field */
Szxgroup = "GroupID";//user group;
Szxcontact = "FieldID";//contact person of the user;
Data field Correspondence table
SZXID = "id";//used to hold a unique user ID value;
Szxlogin = "Xlogin";//save user login name;
Szxname = "XName";//Save the user's name;
Szxpassword = "Xpassword";//save user password;
Szxstatus = "xstatus";//Save the user's current state;
Szxclient = "xclient";//Save the user's current login software version number;
SZXIP = "XIP";//Save the user's current login IP address;

/* Message Save configuration */
Szxmsgtype = "Msgtype";//Message type
Szxmsgsend = "Sendid";//Message sender
SZXMSGRECV = "GetID";//Message Receiver
Szxmsgdata = "Msgdata";//Message data
Szxmsgdate = "Sendtime";//Send Date
Szxmsgread = "GetTime"; Receive Date

Readfieldinfo ();
}

Xeim_config::~xeim_config ()
{
}

void Xeim_config::readfieldinfo ()
{
Check the user settings file
Cinireader Inireader (Getconfigfilepath ());


//////////////////////////////////////////////////////////////////////////
Read user field information Databases_user
if (inireader.sectionexists (GROUP1))
{
Data field Correspondence table
Szxid = Inireader.getkeyvalue ("id", GROUP1);
Szxlogin = Inireader.getkeyvalue ("Xlogin", GROUP1);
Szxname = Inireader.getkeyvalue ("XName", GROUP1);
Szxpassword = Inireader.getkeyvalue ("Xpassword", GROUP1);
Szxstatus = Inireader.getkeyvalue ("Xstatus", GROUP1);
Szxclient = Inireader.getkeyvalue ("xclient", GROUP1);
SZXIP = Inireader.getkeyvalue ("Xip", GROUP1);
}
else//does not exist create a new
{
Data field Correspondence table
Inireader.setkey (Szxid.c_str (), "id", GROUP1);
Inireader.setkey (Szxlogin.c_str (), "Xlogin", GROUP1);
Inireader.setkey (Szxname.c_str (), "XName", GROUP1);
Inireader.setkey (Szxpassword.c_str (), "Xpassword", GROUP1);
Inireader.setkey (Szxstatus.c_str (), "Xstatus", GROUP1);
Inireader.setkey (Szxclient.c_str (), "xclient", GROUP1);
Inireader.setkey (Szxip.c_str (), "XIP", GROUP1);
}



//////////////////////////////////////////////////////////////////////////
Read Database configuration information databases_config
if (inireader.sectionexists (GROUP2))
{
Data field Correspondence table
m_sztable = inireader.getkeyvalue ("table", GROUP2);
szxusertable = Inireader.getkeyvalue ("Tab_user", GROUP2);
szxmessagetable = Inireader.getkeyvalue ("Tab_message", GROUP2);
szxcontacttable = Inireader.getkeyvalue ("Tab_contact", GROUP2);
M_szserver = Inireader.getkeyvalue ("server", GROUP2);
M_szdatabase = Inireader.getkeyvalue ("database", GROUP2);
M_szusername = Inireader.getkeyvalue ("id", GROUP2);
M_szpassword = Inireader.getkeyvalue ("password", GROUP2);
}
else//does not exist create a new
{
Data field Correspondence table
Inireader.setkey (M_sztable.c_str (), "table", GROUP2);
Inireader.setkey (Szxcontacttable.c_str (), "Tab_contact", GROUP2);
Inireader.setkey (Szxmessagetable.c_str (), "Tab_message", GROUP2);
Inireader.setkey (Szxusertable.c_str (), "Tab_user", GROUP2);
Inireader.setkey (M_szserver.c_str (), "Server", GROUP2);
Inireader.setkey (M_szdatabase.c_str (), "database", GROUP2);
Inireader.setkey (M_szusername.c_str (), "id", GROUP2);
Inireader.setkey (M_szpassword.c_str (), "password", GROUP2);
}

//////////////////////////////////////////////////////////////////////////
Configuration information
if (inireader.sectionexists ("Settings"))
// {
Szdirectory = Inireader.getkeyvalue ("directory", "Settings");
// }
else//does not exist create a new
// {
Inireader.setkey (Szdirectory.c_str (), "directory", "Settings");
// }
}


CString Xeim_config::getconfigfilepath ()
{
Check the user settings file
Char Szfilename[_max_path];
Cxiemusersapp::getprogramdirectory (szFileName);
CString strpath = szFileName;
strpath + = Config_file_name;
return strpath;
}

void Xeim_config::savefieldinfo ()
{
Check the user settings file
Cinireader Inireader (Getconfigfilepath ());


//////////////////////////////////////////////////////////////////////////
Save User Field Information Databases_user

Data field Correspondence table
Inireader.setkey (Szxid.c_str (), "id", GROUP1);
Inireader.setkey (Szxlogin.c_str (), "Xlogin", GROUP1);
Inireader.setkey (Szxname.c_str (), "XName", GROUP1);
Inireader.setkey (Szxpassword.c_str (), "Xpassword", GROUP1);
Inireader.setkey (Szxstatus.c_str (), "Xstatus", GROUP1);
Inireader.setkey (Szxclient.c_str (), "xclient", GROUP1);
Inireader.setkey (Szxip.c_str (), "XIP", GROUP1);

//////////////////////////////////////////////////////////////////////////
Save Database configuration Information Databases_config
Data field Correspondence table

 inireader.setkey (Szxcontacttable.c_str (), "Tab_contact", GROUP2);
 inireader.setkey (Szxmessagetable.c_str (), "Tab_message", GROUP2);
 inireader.setkey (Szxusertable.c_str (), "Tab_user", GROUP2);
 inireader.setkey (M_szserver.c_str (), "Server", GROUP2);
 inireader.setkey (M_szdatabase.c_str (), "database", GROUP2);
 inireader.setkey (M_szusername.c_str (), "id", GROUP2);
 inireader.setkey (M_szpassword.c_str (), "password", GROUP2);
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.