changeset 15:c262e17de9b1

db download skip-mode.
author pyon@macmini
date Sat, 08 Jun 2019 15:50:59 +0900
parents c1dc1fcee7fe
children b651aa41b9d4
files Makefile app.conf go/server.go include/id.h include/main.h include/net.h include/rsearcher.h src/main.cpp src/net.cpp src/rsearcher.cpp
diffstat 10 files changed, 178 insertions(+), 166 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile	Sun Dec 09 14:38:15 2018 +0900
+++ b/Makefile	Sat Jun 08 15:50:59 2019 +0900
@@ -1,5 +1,5 @@
 # Makefile for wxWidgets Application
-# Last Change: 2018-11-09  08:45:49.
+# Last Change: 2019-05-29  15:43:02.
 # by Takayuki Mutoh
 #
 
@@ -8,13 +8,16 @@
 ### Variables ###
 OBJDIR = ./obj
 CXX = g++
+ARCH = 32
+#ARCH = 64
+LOCAL = C:/msys64/home/muto/local$(ARCH)
 vpath %.cpp ./src
 vpath %.h   ./include
 
 # For Microsoft Windows
 ifdef COMSPEC
-WXCXXFLAGS = -I/local/lib/wx/include/msw-unicode-static-3.1 -I/local/include/wx-3.1 -D_LARGEFILE_SOURCE=unknown -D__WXMSW__ -mthreads
-WXLIBS =-L/local/lib -Wl,--subsystem,windows -mwindows /local/lib/libwx_mswu_xrc-3.1.a /local/lib/libwx_mswu_qa-3.1.a /local/lib/libwx_baseu_net-3.1.a /local/lib/libwx_mswu_html-3.1.a /local/lib/libwx_mswu_adv-3.1.a /local/lib/libwx_mswu_core-3.1.a /local/lib/libwx_baseu_xml-3.1.a /local/lib/libwx_baseu-3.1.a -lwxtiff-3.1 -lwxjpeg-3.1 -lwxpng-3.1 -lwxregexu-3.1 -lwxscintilla-3.1 -lwxexpat-3.1 -lwxzlib-3.1 -lrpcrt4 -loleaut32 -lole32 -luuid -luxtheme -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lcomdlg32 -ladvapi32 -lversion -lwsock32 -lgdi32 -loleacc 
+WXCXXFLAGS = -I$(LOCAL)/lib/wx/include/msw-unicode-static-3.1 -I$(LOCAL)/include/wx-3.1 -D_LARGEFILE_SOURCE=unknown -D__WXMSW__ -mthreads
+WXLIBS = -L$(LOCAL)/lib -Wl,--subsystem,windows -mwindows -lwx_mswu_xrc-3.1 -lwx_mswu_qa-3.1 -lwx_baseu_net-3.1 -lwx_mswu_html-3.1 -lwx_mswu_adv-3.1 -lwx_mswu_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu-3.1 -lwxtiff-3.1 -lwxjpeg-3.1 -lwxpng-3.1 -lwxregexu-3.1 -lwxscintilla-3.1 -lwxexpat-3.1 -lwxzlib-3.1 -lrpcrt4 -loleaut32 -lole32 -luuid -luxtheme -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lcomdlg32 -ladvapi32 -lversion -lwsock32 -lgdi32 -loleacc 
 LIBS = $(WXLIBS) -static
 
 EXECUTABLE = $(PROGNAME).exe
@@ -33,9 +36,10 @@
 
 
 OBJ = $(OBJDIR)/main.o \
+	  $(OBJDIR)/rsearcher.o \
 	  $(OBJDIR)/auth.o \
 	  $(OBJDIR)/mngdb.o \
-	  $(OBJDIR)/rsearcher.o \
+	  $(OBJDIR)/index.o \
 	  $(OBJDIR)/net.o
 
 ifdef COMSPEC
@@ -62,6 +66,9 @@
 $(OBJDIR)/auth.o: auth.cpp auth.h id.h
 	$(CXX) -c $< -o $@ $(CXXFLAGS)
 
+$(OBJDIR)/index.o: index.cpp index.h id.h
+	$(CXX) -c $< -o $@ $(CXXFLAGS)
+
 $(OBJDIR)/net.o: net.cpp net.h 
 	$(CXX) -c $< -o $@ $(CXXFLAGS)
 
@@ -72,7 +79,7 @@
 # for icon
 ifdef COMSPEC
 $(OBJDIR)/sample_rc.o: sample.rc
-	windres -i sample.rc -o $@ -I/local/include/wx-3.1
+	windres -i sample.rc -o $@ -I$(LOCAL)/include/wx-3.1
 endif
 
 $(EXECUTABLE): $(PROGNAME)
@@ -97,9 +104,6 @@
 	open $(PROGNAME).app
 endif
 
-go:
-	go build -o rsearcher main.go
-
 tgz:
 	tar cvfz a.tgz src include Makefile memo.txt
 
--- a/app.conf	Sun Dec 09 14:38:15 2018 +0900
+++ b/app.conf	Sat Jun 08 15:50:59 2019 +0900
@@ -1,21 +1,23 @@
 [Geometry]
-x=71
-y=0
-w=1191
-h=724
+x=84
+y=4
+w=1150
+h=734
 
 [Server]
-address=192.168.0.124
+address=192.168.79.52
 port=3910
 proxy_address=
 proxy_port=
 
 [DBManage]
-;dbdir=C:\\MinGW\\msys\\1.0\\home\\muto\\wx\\rsearcher\\searcher03db
-dbdir=/Users/takayuki/wx/rsearcher/db
+dbdir=C:\\msys64\\home\\muto\\wx\\rsearcher\\searcher03db
+qdlhhs=1
 
 [Misc]
 splash=-1
-;unlock_key=054fa2ab56938fc46ed69eb7ad93fa4828e4963b8a82f9514c3e2e86940510ed
-print_zoom=100
+unlock_key=a019d1591b28ebdfce5124ae378656d42313d451ec8cc5ea8aea42e73b666c56
 
+[Print]
+zoom=99
+
--- a/go/server.go	Sun Dec 09 14:38:15 2018 +0900
+++ b/go/server.go	Sat Jun 08 15:50:59 2019 +0900
@@ -1,7 +1,7 @@
 /*
  server.go  : server-program.
- Version    : 1.4
- Last Change: 2018-12-05 水 08:08:02.
+ Version    : 1.5
+ Last Change: 2019-05-29 水 08:58:19.
 
  install to: server_root/
 
@@ -22,6 +22,7 @@
     "net/http"
 	"os"
     "path/filepath"
+	"strings"
 	"time"
 )
 
@@ -36,25 +37,28 @@
 )
 
 func init() {
-	version = "1.4"	// piece-image version
+	version = "1.5"	// piece-image version
 	port = ":3910"
-    server_root = filepath.Dir( os.Args[0] )
-	logfile = filepath.Join( server_root, "rsearcher.log" )
+    server_root = filepath.Dir(os.Args[0])
+	logfile = filepath.Join(server_root, "rsearcher.log")
 	wlfile = "rsearcher.whitelist"
 }
 
 func main() {
 
-    flag.BoolVar( &not_ac, "d", false, "no access control ( for debug )" )
+    flag.BoolVar(&not_ac, "d", false, "no access control ( for debug )")
 	flag.Parse()
 
 	// setting IP-Address & Port
 	addrs, err := net.InterfaceAddrs()
 	if err != nil {
-		log.Fatal( err )
+		log.Fatal(err)
 	}
 	for _, a := range addrs {
-		if ipnet, ok := a.( *net.IPNet ); ok && !ipnet.IP.IsLoopback() {
+		if ipnet, ok := a.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
+			if strings.HasPrefix(ipnet.IP.String(), "169.254") {
+				continue
+			}
 			if ipnet.IP.To4() != nil {
 				server = ipnet.IP.String() + port
 			}
@@ -62,92 +66,92 @@
 	}
 
 	// start Web-server
-	fmt.Println( "server start [", server, "] ( program version", version, ")" )
-	http.HandleFunc( "/",        handler        )
-	http.HandleFunc( "/upload/", upload_handler )
-	http.HandleFunc( "/mngdb/",  mngdb_handler  )
-	log.Fatal( http.ListenAndServe( server, nil ) )
+	fmt.Println("server start [", server, "] ( program version", version, ")")
+	http.HandleFunc("/",        handler       )
+	http.HandleFunc("/upload/", upload_handler)
+	http.HandleFunc("/mngdb/",  mngdb_handler )
+	log.Fatal(http.ListenAndServe(server, nil))
 }
 
-func handler( w http.ResponseWriter, r *http.Request ) {
-	if !not_ac && !is_valid_host( r.RemoteAddr ) {
-		http.NotFound( w, r )
+func handler(w http.ResponseWriter, r *http.Request) {
+	if !not_ac && !is_valid_host(r.RemoteAddr) {
+		http.NotFound(w, r)
 		return
 	}
 
-	file := filepath.Join( server_root, filepath.FromSlash( r.URL.Path ) )
-	img := r.URL.Query().Get( "q" )
+	file := filepath.Join(server_root, filepath.FromSlash(r.URL.Path))
+	//img := r.URL.Query().Get("q")
 
-	fmt.Println( "[access]", r.RemoteAddr, "|", time.Now().Format( "2006-01-02 15:04" ), "|", file )
-	fmt.Println( "--", img , "--")
-	write_log( "[access] " + r.RemoteAddr + " " + file )
+	fmt.Println("[access]", r.RemoteAddr, "|", time.Now().Format("2006-01-02 15:04"), "|", file)
+	//fmt.Println("--", img , "--")
+	write_log("[access] " + r.RemoteAddr + " " + file)
 
-	f, err := os.Open( file )
+	f, err := os.Open(file)
 	if err != nil {
-		http.NotFound( w, r )
+		http.NotFound(w, r)
 		return
 	}
 	defer f.Close()
 
 	fi, _ := f.Stat()
 
-	w.Header().Set( "Content-Type",   "rsearcher/octet-stream" )
-	w.Header().Set( "Content-Length", fmt.Sprintf( "%d", fi.Size() ) )
-	io.Copy( w, f )
+	w.Header().Set("Content-Type",   "rsearcher/octet-stream")
+	w.Header().Set("Content-Length", fmt.Sprintf("%d", fi.Size()))
+	io.Copy(w, f)
 }
 
-func upload_handler( w http.ResponseWriter, r *http.Request ) {
-	if !not_ac && !is_valid_host( r.RemoteAddr ) {
-		http.NotFound( w, r )
+func upload_handler(w http.ResponseWriter, r *http.Request) {
+	if !not_ac && !is_valid_host(r.RemoteAddr) {
+		http.NotFound(w, r)
 		return
 	}
 
-	fmt.Println( "[access]", r.RemoteAddr, "|", time.Now().Format( "2006-01-02 15:04" ), "|", "/upload" )
-	now := time.Now().Format( "20060102_150405" )
-	file := filepath.Join( server_root, "upload", now )
-	f, err := os.Create( file )
+	fmt.Println("[access]", r.RemoteAddr, "|", time.Now().Format("2006-01-02 15:04"), "|", "/upload")
+	now := time.Now().Format("20060102_150405")
+	file := filepath.Join(server_root, "upload", now)
+	f, err := os.Create(file)
 	if err != nil {
-		http.NotFound( w, r )
+		http.NotFound(w, r)
 		return
 	}
-	n, err := io.Copy( f, r.Body )
+	n, err := io.Copy(f, r.Body)
 	if err != nil {
-		http.NotFound( w, r )
+		http.NotFound(w, r)
 		return
 	}
 	f.Close()
-	w.Write( []byte( fmt.Sprintf( "%d bytes are recieved.\n", n ) ) )
+	w.Write([]byte(fmt.Sprintf("%d bytes are recieved.\n", n)))
 }
 
-func mngdb_handler( w http.ResponseWriter, r *http.Request ) {
-	if !not_ac && !is_valid_host( r.RemoteAddr ) {
-		http.NotFound( w, r )
+func mngdb_handler(w http.ResponseWriter, r *http.Request) {
+	if !not_ac && !is_valid_host(r.RemoteAddr) {
+		http.NotFound(w, r)
 		return
 	}
 
-	fmt.Println( "[access]", r.RemoteAddr, "|", time.Now().Format( "2006-01-02 15:04" ), "|", "/mngdb" )
-	write_log( "[access] " + r.RemoteAddr + "manage-db" )
-	db := r.URL.Path[ len( "/mngdb/" ): ]
+	fmt.Println("[access]", r.RemoteAddr, "|", time.Now().Format("2006-01-02 15:04" ), "|", "/mngdb")
+	write_log("[access] " + r.RemoteAddr + "manage-db")
+	db := r.URL.Path[len("/mngdb/"):]
 
-	file := filepath.Join( server_root, "db", db )
+	file := filepath.Join(server_root, "db", db)
 
-	f, err := os.Create( file )
+	f, err := os.Create(file)
 	if err != nil {
-		http.NotFound( w, r )
+		http.NotFound(w, r)
 		return
 	}
-	_, err = io.Copy( f, r.Body )
+	_, err = io.Copy(f, r.Body)
 	if err != nil {
-		http.NotFound( w, r )
+		http.NotFound(w, r)
 		return
 	}
 	f.Close()
 }
 
-func is_valid_host( host string ) bool {
-	f, _ := os.Open( wlfile )
+func is_valid_host(host string) bool {
+	f, _ := os.Open(wlfile)
 	defer f.Close()
-	input := bufio.NewScanner( f )
+	input := bufio.NewScanner(f)
 	for input.Scan() {
 		if input.Text() == host {
 			return true
@@ -156,14 +160,14 @@
 	return false
 }
 
-func write_log( msg string ) {
-	f, err := os.OpenFile( logfile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644 )
+func write_log(msg string) {
+	f, err := os.OpenFile(logfile, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
 	if err != nil {
-		log.Fatal( err )
+		log.Fatal(err)
 	}
 	defer f.Close()
 
-	logger := log.New( f, "", log.LstdFlags )
-	logger.Println( msg )
+	logger := log.New(f, "", log.LstdFlags)
+	logger.Println(msg)
 }
 
--- a/include/id.h	Sun Dec 09 14:38:15 2018 +0900
+++ b/include/id.h	Sat Jun 08 15:50:59 2019 +0900
@@ -1,5 +1,5 @@
 // Filename   : id.h
-// Last Change: 2018-11-21  08:25:58.
+// Last Change: 2019-05-28  10:01:22.
 //
 
 #ifndef __ID_H__
@@ -7,8 +7,8 @@
 
 #include <wx/wx.h>
 
-#define RSVER "1.6b"
-#define RSRELEASE "2018.11.30"
+#define RSVER "1.7"
+#define RSRELEASE "2019.05.30"
 
 enum {
 	/* for mainframe */
--- a/include/main.h	Sun Dec 09 14:38:15 2018 +0900
+++ b/include/main.h	Sat Jun 08 15:50:59 2019 +0900
@@ -1,5 +1,5 @@
 // Filename   : main.h
-// Last Change: 2018-11-14  11:32:46.
+// Last Change: 2019-05-28  10:08:07.
 //
 #include <wx/wx.h>
 #include <wx/config.h>
@@ -16,15 +16,17 @@
 	private:
 		wxFileConfig *config;
 		wxString      conf_file;
-		int			  splash = 150;
-		wxString      unlock_key;
+		int			  m_splash = 150;
+		wxString      m_unlock_key;
 		wxString	  m_serveraddr;
 		int     	  m_serverport;
 		wxString	  m_dbdir;
+		bool		  m_qdlhhs;
         bool          develop;
 
 	public:
 		wxRect rect;
+		int    pzoom;
 
 		MyApp();
 		~MyApp();
--- a/include/net.h	Sun Dec 09 14:38:15 2018 +0900
+++ b/include/net.h	Sat Jun 08 15:50:59 2019 +0900
@@ -1,5 +1,5 @@
 // Filename   : net.h
-// Last Change: 2018-11-14 水 10:05:44.
+// Last Change: 2019-05-24 金 16:03:16.
 //
 
 #ifndef __NET_H__
@@ -20,10 +20,9 @@
 
 		void SetServer( wxString server, int port ) { m_server = server; m_port = port; };
 		bool Get( wxString url, wxString file );
-		bool GetDB( int a, int h, int i);
+		bool GetDB( bool a, bool h, bool i);
 		int  GetImagesSize( wxString hhs, wxString date );
-		void GetImages( wxString hhs, wxString date );
-		void GetImages2Memory( wxString hhs, wxString date );
+		void GetImages( wxString hhs, wxString date, wxString flag );
 };
 
 #endif //__NET_H__
--- a/include/rsearcher.h	Sun Dec 09 14:38:15 2018 +0900
+++ b/include/rsearcher.h	Sat Jun 08 15:50:59 2019 +0900
@@ -1,5 +1,5 @@
 // Filename   : rsearcher.h
-// Last Change: 2018-12-04  12:51:07.
+// Last Change: 2019-05-28  09:29:59.
 //
 
 #ifndef __RSEARCH_H__
@@ -182,7 +182,7 @@
 		void Cmd( wxString cmd );
 		void Search( void );
 		void PasteSearch( void );
-		void LoadDB( void );
+		void LoadDB( bool load_hhsdb );
 		void UpdateIndex( void );
         bool LoadBitmap( wxScrolledWindow* sc, MyStaticBitmap* sb, wxString file );
         bool LoadBitmaps( wxString date, bool reload );
--- a/src/main.cpp	Sun Dec 09 14:38:15 2018 +0900
+++ b/src/main.cpp	Sat Jun 08 15:50:59 2019 +0900
@@ -1,5 +1,5 @@
 // Filename   : main.cpp
-// Last Change: 2018-11-14 水 12:54:16.
+// Last Change: 2019-05-29 水 15:04:09.
 //
 
 #include <wx/socket.h>
@@ -44,25 +44,9 @@
 		return false;
 	}
 
-    wxImage::AddHandler( new wxJPEGHandler );
-    wxImage::AddHandler( new wxPNGHandler  );
-	wxFileSystem::AddHandler( new wxZipFSHandler );
-
-	// Main Window
-	MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE );
-	mainframe->SetServer( m_serveraddr, m_serverport );
-	mainframe->SetDBdir( m_dbdir );
-	mainframe->InDevelop( true );
-	if ( !mainframe->GetDB( 1, 1, 1 ) ) {
-		mainframe->Destroy();
-		return true;
-	}
-
-	// Splash Screen
-	SplashScreen( splash );
-
-	// Mode
-	if ( !unlock_key.IsEmpty() ) {
+	// Validation Host
+	bool valid_host = false;
+	if ( !m_unlock_key.IsEmpty() ) {
 		wxIPV4address addr;
 		addr.Hostname( wxGetFullHostName() );
 
@@ -75,13 +59,42 @@
 		wxArrayString output, errors;
 		wxExecute( wxJoin( args, ' ', '\\' ), output, errors );
 
-		if ( unlock_key.IsSameAs( output[0] ) ) {
-			mainframe->SetUser( wxT( "root" ) );
-			mainframe->SetTitle( wxT( "Re:Searcher - root" ) );
-			mainframe->LoadDB();
-			mainframe->Show( true );
-			return true;
-		}
+		if ( m_unlock_key.IsSameAs( output[0] ) ) valid_host = true;
+	}
+
+    wxImage::AddHandler( new wxJPEGHandler );
+    wxImage::AddHandler( new wxPNGHandler  );
+	wxFileSystem::AddHandler( new wxZipFSHandler );
+
+	// Main Window
+	MainFrame *mainframe = new MainFrame( NULL, ID_MAIN, wxEmptyString, wxPoint( rect.x, rect.y ), rect.GetSize(), wxDEFAULT_FRAME_STYLE );
+	mainframe->SetServer( m_serveraddr, m_serverport );
+	mainframe->SetDBdir( m_dbdir );
+	mainframe->InDevelop( true );
+
+	bool dlhhs = false;
+	if ( valid_host && !m_qdlhhs ) {
+		dlhhs = true;
+	} else {
+		wxMessageDialog dlg( NULL, wxT("download h-data ?"), wxT("Ask"), wxYES_NO );
+		if ( wxID_YES == dlg.ShowModal() ) dlhhs = true;
+	}
+
+	if ( !mainframe->GetDB( true, dlhhs, false ) ) {
+		mainframe->Destroy();
+		return true;
+	}
+
+	// Splash Screen
+	SplashScreen( m_splash );
+
+	if ( valid_host ) {
+		mainframe->SetUser( wxT( "root" ) );
+		mainframe->SetTitle( wxT( "Re:Searcher - root" ) );
+		mainframe->LoadDB( dlhhs );
+		mainframe->Show( true );
+		mainframe->Raise();
+		return true;
 	}
 
 	// User Dialog
@@ -113,7 +126,7 @@
 
 		mainframe->SetUser( authdlg->GetUser() );
 		mainframe->SetTitle( wxT( "Re:Searcher - " ) + authdlg->GetUser() );
-		mainframe->LoadDB();
+		mainframe->LoadDB( dlhhs );
 		mainframe->Show( true );
 	} else {
 		mainframe->Destroy();
@@ -148,6 +161,7 @@
 
     config->SetPath( wxT( "/DBManage" ) );
     config->Read( wxT( "dbdir" ), &m_dbdir );
+    config->Read( wxT( "qdlhhs" ), &m_qdlhhs );
 
     config->SetPath( wxT( "/Server" ) );
     config->Read( wxT( "proxy_address" ), &m_serveraddr );
@@ -162,9 +176,12 @@
         m_serverport = 80;
 	}
 
+    config->SetPath( wxT( "/Print" ) );
+    config->Read( wxT( "zoom" ), &pzoom );
+
     config->SetPath( wxT( "/Misc" ) );
-    config->Read( wxT( "splash" ), &splash );
-    config->Read( wxT( "unlock_key" ), &unlock_key );
+    config->Read( wxT( "splash" ), &m_splash );
+    config->Read( wxT( "unlock_key" ), &m_unlock_key );
 
     delete config;
 }
@@ -178,6 +195,10 @@
     config->Write( wxT( "y" ), rect.y );
     config->Write( wxT( "w" ), rect.width );
     config->Write( wxT( "h" ), rect.height );
+
+    config->SetPath( wxT( "/Print" ) );
+    config->Write( wxT( "zoom" ), pzoom );
+
     delete config;
 }
 
@@ -193,7 +214,7 @@
 			wxInputStream* s = file->GetStream();
 			wxImage image( *s, wxBITMAP_TYPE_PNG );
 			wxBitmap bmp = wxBitmap( image );
-			wxSplashScreen* splash = new wxSplashScreen( bmp, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 2000, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxSTAY_ON_TOP );
+			wxSplashScreen* splashwin = new wxSplashScreen( bmp, wxSPLASH_CENTRE_ON_SCREEN|wxSPLASH_TIMEOUT, 2000, NULL, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_NONE|wxSTAY_ON_TOP );
 			delete file;
 		}
 		wxMilliSleep( ms );
--- a/src/net.cpp	Sun Dec 09 14:38:15 2018 +0900
+++ b/src/net.cpp	Sat Jun 08 15:50:59 2019 +0900
@@ -1,5 +1,5 @@
 // Filename   : net.cpp
-// Last Change: 2018-11-14 水 10:46:24.
+// Last Change: 2019-05-24 金 16:02:39.
 //
 
 #include <wx/datetime.h>
@@ -39,13 +39,13 @@
 	return ret;
 }
 
-bool RsHttp::GetDB( int a, int h, int i )
+bool RsHttp::GetDB( bool a, bool h, bool i )
 {
 	bool ret = false;
-	if ( a == 1 ) ret = Get( wxT( "/db/auth.db"), wxT( "auth.db") );
-	if ( h == 1 ) ret = Get( wxT( "/db/hhs.db"),  wxT( "hhs.db") );
+	if ( a ) ret = Get( wxT( "/db/auth.db"), wxT( "auth.db") );
+	if ( h ) ret = Get( wxT( "/db/hhs.db"),  wxT( "hhs.db") );
 	wxDateTime now = wxDateTime::Now();
-	if ( i == 2 || now.GetDay() % 13 == 0 || now.GetDay() % 28 == 0 ) 
+	if ( i || now.GetDay() % 13 == 0 || now.GetDay() % 28 == 0 ) 
 		Get( wxT( "/db/index.db"), wxT( "index.db" ) );
 	return ret;
 }
@@ -71,7 +71,7 @@
 	return size;
 }
 
-void RsHttp::GetImages( wxString hhs, wxString date )
+void RsHttp::GetImages( wxString hhs, wxString date, wxString flag )
 {
 	wxHTTP get;
 	get.SetTimeout( 30 );
@@ -80,6 +80,7 @@
 		wxSleep( 1 );
 
 	wxString url = wxT( "/images/" ) + date + wxT( "/" ) + hhs + wxT( ".tgz" );
+	url += wxT( "?q=" ) + flag;
 
 	wxInputStream *http_istream = get.GetInputStream( url );
 	if ( get.GetError() == wxPROTO_NOERR ) {
@@ -103,35 +104,3 @@
 	get.Close();
 }
 
-void RsHttp::GetImages2Memory( wxString hhs, wxString date )
-{
-	wxHTTP get;
-	get.SetTimeout( 30 );
-	get.SetFlags( wxSOCKET_WAITALL|wxSOCKET_BLOCK );
-	while ( !get.Connect( m_server, m_port ) )
-		wxSleep( 1 );
-
-	wxString url = wxT( "/images/" ) + date + wxT( "/" ) + hhs + wxT( ".tgz" );
-
-	wxInputStream *http_istream = get.GetInputStream( url );
-	if ( get.GetError() == wxPROTO_NOERR ) {
-		//int size = http_istream->GetSize();
-		wxZlibInputStream zlib_istream( http_istream ); // 0: no cache : bad
-
-		wxTarEntry* entry;
-		wxTarInputStream tar_istream( zlib_istream );
-		int i = 1;
-		while ( ( entry = tar_istream.GetNextEntry() ) != NULL ) {
-			//wxString name = entry->GetName();
-			wxFileOutputStream file_ostream( wxString::Format( wxT( ".cache/%s_%d" ), date, i++ ) );
-			file_ostream.Write( tar_istream );
-			file_ostream.Close();
-		}
-	} else {
-		wxMessageBox( wxT( "Re:Searcher Error: get err" ) );
-	}
-
-	//wxDELETE( http_istream );
-	get.Close();
-}
-
--- a/src/rsearcher.cpp	Sun Dec 09 14:38:15 2018 +0900
+++ b/src/rsearcher.cpp	Sat Jun 08 15:50:59 2019 +0900
@@ -1,5 +1,5 @@
 // Filename   : rsearcher.cpp
-// Last Change: 2018-12-04 火 16:00:36.
+// Last Change: 2019-05-29 水 15:37:32.
 //
 
 #include <wx/arrstr.h> 
@@ -431,7 +431,7 @@
 
 void MainFrame::OnUpdateIndex( wxCommandEvent& WXUNUSED(event ) )
 {
-	GetDB( 0, 0, 2 );
+	GetDB( false, false, true );
 	UpdateIndex();
 	wxMessageBox( wxT( "update index done." ) );
 }
@@ -548,14 +548,6 @@
 	m_textCtrlAddr->SetBackgroundColour( wxColour( 180, 210, 240 ) );
 	bSizerRight->Add( m_textCtrlAddr, 0, wxALL|wxEXPAND, 5 );
 	
-	m_checkListBox = new wxCheckListBox( m_panelRight, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
-	m_checkListBox->Append( wxT( "1: Marksheet" ) );
-	m_checkListBox->Append( wxT( "2: Marksheet ( R )" ) );
-	m_checkListBox->Append( wxT( "3: Special Mention" ) );
-	m_checkListBox->Append( wxT( "4: Opinion" ) );
-	m_checkListBox->Append( wxT( "5: Opinion ( R )" ) );
-	bSizerRight->Add( m_checkListBox, 0, wxALL|wxEXPAND, 5 );
-
 	m_dataViewListCtrl = new wxDataViewListCtrl( m_panelRight, ID_LIST, wxDefaultPosition, wxDefaultSize, wxDV_ROW_LINES|wxDV_SINGLE );
 	m_dataViewListColumnNo    = m_dataViewListCtrl->AppendTextColumn( wxT( "No" ),      wxDATAVIEW_CELL_INERT, 30, wxALIGN_RIGHT,  wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
 	m_dataViewListColumnDate  = m_dataViewListCtrl->AppendTextColumn( wxT( "  Date" ),  wxDATAVIEW_CELL_INERT, 80, wxALIGN_LEFT,   wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
@@ -568,6 +560,14 @@
 	m_dataViewListColumnAddr = m_dataViewListKana->AppendTextColumn( wxT( "  Address" ), wxDATAVIEW_CELL_INERT, -1, wxALIGN_LEFT, wxDATAVIEW_COL_RESIZABLE|wxDATAVIEW_COL_SORTABLE );
 	bSizerRight->Add( m_dataViewListKana, 1, wxALL|wxEXPAND, 5 );
 	
+	m_checkListBox = new wxCheckListBox( m_panelRight, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
+	m_checkListBox->Append( wxT( "1: Marksheet" ) );
+	m_checkListBox->Append( wxT( "2: Marksheet ( R )" ) );
+	m_checkListBox->Append( wxT( "3: Special Mention" ) );
+	m_checkListBox->Append( wxT( "4: Opinion" ) );
+	m_checkListBox->Append( wxT( "5: Opinion ( R )" ) );
+	bSizerRight->Add( m_checkListBox, 0, wxALL|wxEXPAND, 5 );
+
 	m_textCtrlLog = new wxTextCtrl( m_panelRight, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( -1, 40 ), 0 );
 	bSizerRight->Add( m_textCtrlLog, 0, wxALL|wxEXPAND, 5 );
 
@@ -638,6 +638,8 @@
 
 	for ( int i = 0; i < m_checkListBox->GetCount(); i++ )
 		m_checkListBox->Check( i, true );
+
+	m_spinCtrl->SetValue( wxGetApp().pzoom );
 }
 
 void MainFrame::SetAccelerator( void )
@@ -922,9 +924,10 @@
 	}
 
 	WriteLog( wxT( "[search] " ) + m_hhs );
+	Raise();
 }
 
-void MainFrame::LoadDB( void )
+void MainFrame::LoadDB( bool load_hhsdb )
 {
     wxProgressDialog pd( wxT( "Load Data" ), wxT( "Now loading..." ), 100, NULL, wxPD_APP_MODAL|wxPD_ELAPSED_TIME|wxPD_REMAINING_TIME|wxPD_AUTO_HIDE );
     pd.SetSize( wxSize( 320, 140 ) );
@@ -932,7 +935,10 @@
 	// index
 	UpdateIndex();
 
-	// decrypto
+	if ( !load_hhsdb ) {
+		return;
+	}
+	// decrypto hhs
 	wxString key = wxT( "12345678900123456789abcdefabcdef" );
 	wxArrayString args;
 	args.Add( wxT( "crypto.exe" ) );
@@ -1062,6 +1068,7 @@
     if ( !IsIconized() && !IsMaximized() ) {
         wxGetApp().rect = this->GetRect();
     }
+	wxGetApp().pzoom = m_spinCtrl->GetValue();
     Destroy();
 }
 
@@ -1069,6 +1076,10 @@
 {
     if ( !flag ) return;
     
+	bool cb = false;
+	m_checkListBox->Enable( cb );
+	//m_checkListBox->Show( cb );
+
 	bool lo = false;
 	m_buttonLogout->Enable( lo );
 	m_buttonLogout->Show( lo );