comparison src/auth.cpp @ 6:9a8b581c1993

improve performance.
author pyon@macmini
date Tue, 23 Oct 2018 19:15:22 +0900
parents e3b10fb860b3
children 82f9af6aa7e4
comparison
equal deleted inserted replaced
5:e3b10fb860b3 6:9a8b581c1993
1 // Filename : auth.cpp 1 // Filename : auth.cpp
2 // Last Change: 2018-10-22 月 16:11:52. 2 // Last Change: 2018-10-23 火 09:05:53.
3 // 3 //
4 4
5 #include "id.h" 5 #include "id.h"
6 #include "auth.h" 6 #include "auth.h"
7 7
108 gSizer->Add( m_buttonLogin, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); 108 gSizer->Add( m_buttonLogin, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
109 109
110 m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 ); 110 m_buttonCancel = new wxButton( this, wxID_CANCEL, wxT( "Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
111 gSizer->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); 111 gSizer->Add( m_buttonCancel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
112 112
113
114 this->SetSizer( gSizer ); 113 this->SetSizer( gSizer );
115 this->Layout(); 114 this->Layout();
116 gSizer->Fit( this ); 115 gSizer->Fit( this );
117 116
118 this->Centre( wxBOTH ); 117 this->Centre( wxBOTH );
119 m_textCtrlId->SetFocus(); 118 m_textCtrlId->SetFocus();
120 } 119 }
121 120
122 bool AuthDialog::LoadDB( void ) 121 bool AuthDialog::GetDB( void )
123 { 122 { // http get ( auth.db, hhs.db, index.db )
124 // http get ( auth.db, hhs.db, index.db )
125 wxArrayString args; 123 wxArrayString args;
126 args.Add( wxT( "client.exe" ) ); 124 args.Add( wxT( "client.exe" ) );
127 args.Add( wxT( "-u" ) ); 125 args.Add( wxT( "-u" ) );
128 args.Add( m_server ); 126 args.Add( m_server );
127 wxExecute( wxJoin( args, ' ', '\\' ), wxEXEC_SYNC|wxEXEC_HIDE_CONSOLE );
128 }
129 129
130 wxExecute( wxJoin( args, ' ', '\\' ), wxEXEC_SYNC|wxEXEC_HIDE_CONSOLE ); 130 bool AuthDialog::LoadDB( void )
131 131 {
132 // load db
133 wxTextFile file; 132 wxTextFile file;
134 if ( !file.Open( wxT( "auth.db" ) ) ) return false; 133 if ( !file.Open( wxT( "auth.db" ) ) ) return false;
135 for ( int i = 0; i < file.GetLineCount(); i++ ) { 134 for ( int i = 0; i < file.GetLineCount(); i++ ) {
136 wxArrayString line = wxSplit( file.GetLine( i ), ' ', '\\' ); 135 wxArrayString line = wxSplit( file.GetLine( i ), ' ', '\\' );
137 m_users.Add( line[ 0 ] ); 136 m_users.Add( line[ 0 ] );