1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.xnap.plugin.opennap.net.msg.client;
21
22 import org.xnap.io.MP3MetaInfo;
23 import org.xnap.io.MetaInfoFile;
24 import org.xnap.plugin.opennap.util.OpenNapFileHelper;
25
26 public class DirectShareFileMessage extends ClientMessage
27 {
28
29
30
31
32 public static final int TYPE = 100;
33
34
35
36
37 public DirectShareFileMessage(int index, MetaInfoFile file)
38 {
39 super(TYPE);
40
41 StringBuffer sb = new StringBuffer();
42 sb.append("\"");
43 sb.append(OpenNapFileHelper.getShareString(index, file));
44 sb.append("\" ");
45
46 sb.append("0 ");
47 sb.append(file.length());
48
49 if (MP3MetaInfo.hasInfo(file)) {
50 MP3MetaInfo m = new MP3MetaInfo(file);
51 sb.append(" ");
52 sb.append(m.getBitrate());
53 sb.append(" ");
54 sb.append(m.getFrequency());
55 sb.append(" ");
56 sb.append(m.getPlayingTime());
57 }
58 else {
59 sb.append(" 24 16000 600");
60 }
61
62 data = sb.toString();
63 }
64
65 }