// ===================================================================== void insmm::DisplayNewTypeList(void) // ===================================================================== // Format of .INF-files: 00000001.WAV,name & surname,fido address // old: 00000001.WAV,deutsch description,englisch description { int i,n,ret; FILE *fp; char buf[300]; char tmp[300]; char name[300]; char addr[300]; CString help1; CString help2; CStrList inffiles; CStrList mmfiles; UpdateData(1); make_path(tmp,gc.MultimedPath,"*.inf"); infolist.RemoveAll(); inffiles.FillWithFiles(tmp); for (i=0;i<inffiles.GetCount();i++) { make_path(tmp,gc.MultimedPath,inffiles.GetString(i)); fp=fopen(tmp,"rt"); if (fp) { while (fgets(buf,299,fp)) { if (strchr(" ;/",buf[0]) || strlen(buf)<4) continue; infolist.AddTail(buf); } fclose(fp); } } make_path(tmp,gc.MultimedPath,m_mmtype==0 ? "*.bmp":"*.wav"); mmstuff.RemoveAll(); mmfiles.FillWithFiles(tmp); for (i=0;i<mmfiles.GetCount();i++) { help1=mmfiles.GetString(i); for (n=0;n<infolist.GetCount();n++) { help2=infolist.GetString(n); if (!strnicmp(help1,help2,help1.GetLength())) { name[0]=addr[0]=0; ret=sscanf(help2,"%[^,]%[, ]%[^,]%[ ,]%[^\n,]",tmp,tmp,name,tmp,addr); if (ret!=5) break; sprintf(buf,"%s\t%s\t%s",help1,name,addr); mmstuff.AddTail(buf); break; } } } UPDATE_LB(mmstuff,IDC_LIST); }
// =========================================================== // searches the time-period by the specified zone, returns string "UNIT CHARGESTRING" void get_period_by_zone(const char *zone,CString &period) // =========================================================== { CString str,tmp; struct tm *loctime; time_t tim; period.Empty(); for (int t=0;t<costbaselist.GetCount();t++) { str=costbaselist.GetString(t); get_token(str,BASEZONE,tmp); if (!tmp.CompareNoCase(zone)) { time(&tim); /* Get time as long integer. */ loctime = localtime(&tim); /* Convert to local time. */ if (loctime->tm_wday == 0 || loctime->tm_wday == 6) get_token(str,BASEWEND,period); // weekend else get_token(str,BASEWDAY,period); // workdays get_token(str,BASECURR,tmp); // currency strcpy(currency,tmp); get_token(str,BASEPERU,tmp); // charging per unit period = tmp+" "+period; return; } } }
// =========================================================== // searches for valid charging-period, if not found, the default-string is returned void get_current_zone(char *timeperiods) // =========================================================== { CString str; CString tmp; size_t matchlen=0; *timeperiods=0; for (int t=0;t<costuserlist.GetCount();t++) { str=costuserlist.GetString(t); get_token(str,USERPHON,tmp); if (!timeperiods[0] && (!stricmp(tmp,"default") || !stricmp(tmp,"по умолчанию"))) { get_token(str,USERZONE,tmp); strcpy(chargzone,tmp); get_period_by_zone(chargzone,tmp); strcpy(timeperiods,tmp); // defaultvalue found } else if (!strncmp(curphone,tmp,strlen(tmp)) && strlen(tmp)>matchlen) // search maximum similarity to curphone in costuser { matchlen = strlen(tmp); get_token(str,USERZONE,tmp); strcpy(chargzone,tmp); get_period_by_zone(chargzone,tmp); strcpy(timeperiods,tmp); } } }
// =========================================================================== BOOL receiver::OnInitDialog() // =========================================================================== { CString str; int tabs[]={60,170}; int tabs2[]={100}; int lng[]={ IDC_ADD1, IDC_ADD2, IDC_CHANGE1, IDC_CHANGE2, IDC_DELETE1, IDC_DELETE2, IDC_STATIC1, IDC_STATIC2, IDC_STATIC4, IDC_STATIC3, IDC_STATIC5, IDC_IMPORT, }; CDialog::OnInitDialog(); set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int)); TAB_LIST(m_groups,tabs2); TAB_LIST(m_members,tabs); for (int i=0;i<Agroups.GetCount();i++) { str=Agroups.GetString(i); str.Trim(); m_groups.AddString(str); } SET_SEL(m_groups,0); OnLbnSelchangeGroups(); return TRUE; }
// =========================================================================== void receiver::populate_lists() // =========================================================================== { CString help,group; int i; m_groups.ResetContent(); m_members.ResetContent(); for (i=0;i<Agroups.GetCount();i++) { help=Agroups.GetString(i); get_token(help,0,group); m_groups.AddString(group); } }
// ================================================================= BOOL cfgexfr::OnInitDialog() // ================================================================= { int lng[]={ IDC_STATIC2, IDC_CHECK_16BIT, IDCANCEL, IDOK }; CDialog::OnInitDialog(); set_dlg_language(this,DlgName,lng,sizeof(lng)/sizeof(int)); if (exfrcfg.GetCount()>1) { m_edit_path.SetWindowText(exfrcfg.GetString(0)); m_check_16bit.SetCheck(exfrcfg.GetString(1)=="1" ? 1 : 0); } return TRUE; }