From cce009a622e1a14cc0b85bbf04b71af996e6f001 Mon Sep 17 00:00:00 2001 From: Antoine Jacquet Date: Sun, 8 Jun 2003 00:00:00 +0200 Subject: [PATCH] version 0.2 * More results for the searches * ETA is now displayed (time remaining in hours) * A statistics tab was added * DonkeyCore class is now commented --- COPYING | 0 README | 2 +- build.bat | 0 build.xml | 0 build/icon.gif | Bin 0 -> 199 bytes build/splash.jpg | Bin 19908 -> 20040 bytes src/DonkeyCore.java | 213 ++++++++++++++++++++++------- src/DonkeyGui.java | 33 +++-- src/DownloadTableModel.java | 2 +- src/Main.java | 0 src/RefreshAbstractTableModel.java | 0 src/ResultTableModel.java | 0 src/ServerTableModel.java | 0 src/StatTableModel.java | 44 ++++++ src/TableMap.java | 0 src/TableSorter.java | 0 src/manifest.txt | 0 17 files changed, 231 insertions(+), 63 deletions(-) mode change 100644 => 100755 COPYING mode change 100644 => 100755 README mode change 100644 => 100755 build.bat mode change 100644 => 100755 build.xml create mode 100755 build/icon.gif mode change 100644 => 100755 build/splash.jpg mode change 100644 => 100755 src/DonkeyCore.java mode change 100644 => 100755 src/DonkeyGui.java mode change 100644 => 100755 src/DownloadTableModel.java mode change 100644 => 100755 src/Main.java mode change 100644 => 100755 src/RefreshAbstractTableModel.java mode change 100644 => 100755 src/ResultTableModel.java mode change 100644 => 100755 src/ServerTableModel.java create mode 100755 src/StatTableModel.java mode change 100644 => 100755 src/TableMap.java mode change 100644 => 100755 src/TableSorter.java mode change 100644 => 100755 src/manifest.txt diff --git a/COPYING b/COPYING old mode 100644 new mode 100755 diff --git a/README b/README old mode 100644 new mode 100755 index acbaa89..ec9d439 --- a/README +++ b/README @@ -1,4 +1,4 @@ -jMoule 0.1 +jMoule 0.2 site: http://royale.zerezo.com/jmoule/ mail: royale@zerezo.com diff --git a/build.bat b/build.bat old mode 100644 new mode 100755 diff --git a/build.xml b/build.xml old mode 100644 new mode 100755 diff --git a/build/icon.gif b/build/icon.gif new file mode 100755 index 0000000000000000000000000000000000000000..01c2fd895d08678d25553595924d7149e3a6802a GIT binary patch literal 199 zcmZ?wbhEHb6krfw*vtR|ii(PchK81wmO(*5$;rvt+1b_A)h#V8bLPxhx^(H2c#DwS;BHA|eXR zCk+{T97U4arM5OYItFma?FijbyWp}4Ki%=^fuPAG~IO-7jR`s vVNqMWqM2RAh`G4@WXHcaPAm3uVNH*~XiXz22CMR(x^|CNk8TD*1_o;Y3m`*O literal 0 HcmV?d00001 diff --git a/build/splash.jpg b/build/splash.jpg old mode 100644 new mode 100755 index fe75caa6d49d2fa48dfc1cbdc91e77b4863b4ac3..d0e1286a408f778a96aeb6ae8685a8a9ddbffc84 GIT binary patch delta 1725 zcmV;u215D7n*qq20kFnDe=94+I{k-+G)s+FRgk5$I2ciuk%_{hj_gSQ3g|eJzKGSL zybkN)hm7u~X>INFT{hUC-Nh_VJb-o#+tg?1D{sQz6?FvFZEU<>Yi5@BQY;bQS*t3f ztUysBF*pRAZU=*mj`hh5bqULoGSu{{Jyd};2 zc8*AsSG_P<#52oFmCJv?a9E#e=yk|1^yHJoTC^8h_lTy%OXWt)kOt>uY6008?m#5> z$u+0o%~Qi(8F{tu5>KjLYa0n`r_wGG3pnx0#0q??>c^Ac(!OSmYB=h!G>rzMN)LAR zlk!{G_TDP49ut*D#m0BZ*xm8s&-1^NB~xA6CdlHS}}&uug-JFr&rrdbZ= z0GzhdlY`04cJx+wT(b*=gMX(&7Egaap5vWq&E8D&8&3)NmgmJDAHLL~(e3SY+n2b1 zv)xH6zG8F$0~(I6p1rH6@wbGc@hVx*71Wj*t&5knyNyF^-NP#>;gNtD9CR2Uis`7T z!{9LZdM^)7KI6Wd@4n$Wvz)o)^*pxY!M-NC3c8KAg*5{nc1bEqzkiO>t&hOfn@<30 zTBf0GH;XUq+fTNUWsgm;jf8SKoT-)DmH>cufCfi7uSuf0sAQNL6%|T!^;>T3=$o=C zSc;NXZ1c|&cw=9a#}|6ujUJag7dB8^6uP*0nOZlH^sWR4^1Fh?Xib_vEbI-r98Aq9N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`WpK;_K9CZg2G43l{}nfBQT;&g0NK zfEVfkKT7qgWT>vcFbC^glF0B9tL@z-&G>!W8Z1pzxp}la3sCrY@o7s2jT~^v4A%0+ z6wE?mITgqx0(sll2DN0+yg{sMx*Yn2o|$iLr`)y6c{eXBK4NqO1~u-$_3d7~+I(BO zRFPUnoq?{ZxC#}kLcHU7e?w=khH4o7AOARKZl zv!b@ILY^WHl~s7Yghoy-=<|6zKjT>;L`gh11c!&4Gf9tdm|w`6={zstOMee(H;_d$ z+~40bOLuuF0jH3zGC<%c7y(BB3h5}WOcqsyz&7ykQE&R{TGMq;*#GC?STNgl$aqPN50DPg(2lD9Lv)$j8i zTJ~O2DAqNN zZFKm)*K2QW99EM&xboUUNi2)k%pa9^R8;*!ht__#%kSFP5xd*dVtu5!c`u+*MHSXT F|JjXtIE(-Q diff --git a/src/DonkeyCore.java b/src/DonkeyCore.java old mode 100644 new mode 100755 index 023100e..bd79353 --- a/src/DonkeyCore.java +++ b/src/DonkeyCore.java @@ -4,6 +4,12 @@ import java.util.Hashtable; import java.util.Vector; import javax.swing.*; +/** + * This class implements mlDonkey Core/GUI protocol. + * This is a part of jMoule. + * This project is licenced under GPL. + * @author Antoine Jacquet + */ public class DonkeyCore extends Thread { byte[] buffer=new byte[1024*100]; @@ -11,13 +17,50 @@ public class DonkeyCore extends Thread int nbsearches=0; Socket connection; String password; - Hashtable fileInfos=new Hashtable(); - Hashtable resultInfos=new Hashtable(); - Hashtable serverInfos=new Hashtable(); - Vector searchResults=new Vector(); + + /** + * This contains the informations about the files being downloaded. + * File ID are the hash keys. + * The values of the hash are vectors containing file informations : filename, size, downloaded, %, rate, ETA and running state. + */ + public Hashtable fileInfos=new Hashtable(); + + /** + * This contains the informations about the results of searches. + * Files ID are the hash keys. + * The values of the hash are vectors containing result informations : filename, size, tags and download state. + */ + public Hashtable resultInfos=new Hashtable(); + + /** + * This contains the informations about the donkey servers. + * Servers ID are the hash keys. + * The values of the hash are vectors containing server informations : host, users, files, connected state. + */ + public Hashtable serverInfos=new Hashtable(); + + /** + * This contains all the searches results. + * Each entry is a vector containing a specific search result. + * Each specific search result contains vectors with same format as resultInfos. + */ + public Vector searchResults=new Vector(); + + /** + * This contains statistics informations. + * The keys are the variables and the values are numbers. + */ + public Hashtable statInfos=new Hashtable(); + + /** + * This is a text panel containing console messages... + */ + public JTextArea console=new JTextArea(); //String console=new String(); - JTextArea console=new JTextArea(); + /** + * Constructs an unconnected DonkeyCore. + */ public DonkeyCore() { /* @@ -74,12 +117,22 @@ public class DonkeyCore extends Thread */ } + /** + * Constructs a connected DonkeyCore. + * Same parameters as "connect". + */ public DonkeyCore(String host,int port,String password) { this(); connect(host,port,password); } + /** + * Connects an unconnected DonkeyCore. + * @param host mlDonkey host you wish to connect to. + * @param port mlDonkey core port. + * @param password Password if needed. + */ public boolean connect(String host,int port,String password) { this.password=password; @@ -97,6 +150,9 @@ public class DonkeyCore extends Thread } } + /** + * Disconnects this DonkeyCore. + */ public void disconnect() { try @@ -110,6 +166,10 @@ public class DonkeyCore extends Thread } } + /** + * Tests if this DonkeyCore is already connected. + * @return true if connected. + */ public boolean isConnected() { return connection!=null; @@ -164,12 +224,12 @@ public class DonkeyCore extends Thread int readInt() { - return(readByte()+256*readByte()); + return(readByte()+(readByte()<<8)); } long readLong() { - return(readByte()+256*(readByte()+256*(readByte()+256*readByte()))); + return(readInt()+((long)readInt()<<16)); } String readString() @@ -202,6 +262,9 @@ public class DonkeyCore extends Thread } } + /** + * Asks the mlDonkey core to connect more servers. + */ public void connectMore() { byte[] buffer=new byte[2]; @@ -209,6 +272,9 @@ public class DonkeyCore extends Thread sendMessage(buffer,2); } + /** + * Asks the mlDonkey core to clean old servers. + */ public void cleanOld() { byte[] buffer=new byte[2]; @@ -216,6 +282,9 @@ public class DonkeyCore extends Thread sendMessage(buffer,2); } + /** + * Asks the mlDonkey core to kill (terminate) itself. + */ public void kill() { byte[] buffer=new byte[2]; @@ -223,6 +292,9 @@ public class DonkeyCore extends Thread sendMessage(buffer,2); } + /** + * Extends (redo) the last search. + */ public void extend() { byte[] buffer=new byte[2]; @@ -230,6 +302,10 @@ public class DonkeyCore extends Thread sendMessage(buffer,2); } + /** + * Start a new download. + * @param fileID ID of the file to download (found in resultInfos key). + */ public void download(Long fileID) { byte[] buffer=new byte[9]; @@ -246,6 +322,11 @@ public class DonkeyCore extends Thread sendMessage(buffer,i); } + /** + * Pause/Resume a download. + * @param fileID ID of the file to switch (found in resultInfos key). + * @param bool true = resume, false = pause. + */ public void switchDownload(Long fileID,boolean bool) { byte[] buffer=new byte[9]; @@ -264,6 +345,10 @@ public class DonkeyCore extends Thread sendMessage(buffer,i); } + /** + * Asks mlDonkey to connect to a new server. + * @param serverID ID of the server to connect to (found in serverInfos key). + */ public void connectServer(Long serverID) { byte[] buffer=new byte[6]; @@ -278,6 +363,10 @@ public class DonkeyCore extends Thread sendMessage(buffer,i); } + /** + * Asks mlDonkey to disconnect from a server. + * @param serverID ID of the server to disconnect (found in serverInfos key). + */ public void disconnectServer(Long serverID) { byte[] buffer=new byte[6]; @@ -292,51 +381,59 @@ public class DonkeyCore extends Thread sendMessage(buffer,i); } + /** + * Start a new search. + * @param query A simple string to describe what you want to search. + * @return A vector of search results (entries of this vector have same structure as resultInfos entries). + */ public Vector search(String query) { - byte[] buffer=new byte[1024*100]; - int i=0,j; - buffer[i++]=42; buffer[i++]=0; // function - buffer[i++]=(byte)(nbsearches%256); buffer[i++]=(byte)(nbsearches/256); - buffer[i++]=0; buffer[i++]=0; // num - buffer[i++]=4; // keywords - buffer[i++]=0; buffer[i++]=0; // empty string - buffer[i++]=(byte)(query.length()%256); - buffer[i++]=(byte)(query.length()/256); - for (j=0;j0) + fileInfo.add(new Float(time/3600.0)); + else + fileInfo.add(new Float(0)); n=readInt(); for (i=0;i