~motu-torrent/azureus/upstream-stable

« back to all changes in this revision

Viewing changes to org/gudy/azureus2/platform/win32/access/impl/Test.java

  • Committer: John Dong
  • Date: 2007-10-22 04:54:13 UTC
  • Revision ID: john.dong@gmail.com-20071022045413-3ovb11u82rrcokxx
Commit 3.0.3.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Created on Apr 16, 2004
3
 
 * Created by Paul Gardner
4
 
 * Copyright (C) 2004, 2005, 2006 Aelitis, All Rights Reserved.
5
 
 *
6
 
 * This program is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the GNU General Public License
8
 
 * as published by the Free Software Foundation; either version 2
9
 
 * of the License, or (at your option) any later version.
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 * You should have received a copy of the GNU General Public License
15
 
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
17
 
 * 
18
 
 * AELITIS, SAS au capital de 46,603.30 euros
19
 
 * 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
20
 
 *
21
 
 */
22
 
 
23
 
package org.gudy.azureus2.platform.win32.access.impl;
24
 
 
25
 
/**
26
 
 * @author parg
27
 
 *
28
 
 */
29
 
 
30
 
import java.net.InetAddress;
31
 
 
32
 
import org.gudy.azureus2.platform.PlatformManagerPingCallback;
33
 
 
34
 
public class 
35
 
Test 
36
 
{
37
 
        public static void
38
 
        main(
39
 
                String[]        args )
40
 
        {
41
 
                try{
42
 
                        /*
43
 
                        AEWin32Access access = AEWin32Manager.getAccessor();
44
 
                        
45
 
                        String  app_data = access.getUserAppData();
46
 
                        
47
 
                        System.out.println( "AppData = " + app_data );
48
 
 
49
 
                        String az_home = access.getApplicationInstallDir("azureus");
50
 
                        
51
 
                        File    az_exe = new File( az_home + File.separator + "Azureus.exe" ).getAbsoluteFile();
52
 
                        
53
 
                        if ( az_exe.exists()){
54
 
                                
55
 
                                //<Nolar>       WriteRegStr HKCR ".torrent" "" "BitTorrent"
56
 
                                //<Nolar>       WriteRegStr HKCR "BitTorrent" "" "Bittorrent File"
57
 
                                //<Nolar>       WriteRegStr HKCR "BitTorrent\shell" "" "open"
58
 
                                //<Nolar>       WriteRegStr HKCR "BitTorrent\DefaultIcon" "" $INSTDIR\Azureus.exe,1
59
 
                                //<Nolar>       WriteRegStr HKCR "BitTorrent\shell\open\command" "" '"$INSTDIR\Azureus.exe" "%1"'
60
 
                                //<Nolar>       WriteRegStr HKCR "BitTorrent\Content Type" "" "application/x-bittorrent"
61
 
                                
62
 
                                System.out.println( "current = " + 
63
 
                                                access.readStringValue(         
64
 
                                                AEWin32Access.HKEY_CLASSES_ROOT,
65
 
                                                "BitTorrent\\shell\\open\\command",
66
 
                                                "" ));
67
 
                                
68
 
                                access.deleteKey(       AEWin32Access.HKEY_CLASSES_ROOT,
69
 
                                                                        ".torrent" );
70
 
                        
71
 
                                access.deleteKey(       AEWin32Access.HKEY_CLASSES_ROOT,
72
 
                                                                        "BitTorrent",
73
 
                                                                        true );
74
 
                        
75
 
                                access.writeStringValue(        AEWin32Access.HKEY_CLASSES_ROOT,
76
 
                                                                                        ".torrent",
77
 
                                                                                        "",
78
 
                                                                                        "BitTorrent" );
79
 
                                
80
 
                                access.writeStringValue(        
81
 
                                                AEWin32Access.HKEY_CLASSES_ROOT,
82
 
                                                "BitTorrent",
83
 
                                                "",
84
 
                                                "Bittorrent File" );
85
 
 
86
 
                                access.writeStringValue(        
87
 
                                                AEWin32Access.HKEY_CLASSES_ROOT,
88
 
                                                "BitTorrent\\shell",
89
 
                                                "",
90
 
                                                "open" );
91
 
                                
92
 
                                access.writeStringValue(        
93
 
                                                AEWin32Access.HKEY_CLASSES_ROOT,
94
 
                                                "BitTorrent\\DefaultIcon",
95
 
                                                "",
96
 
                                                az_exe.toString() + ",1" );
97
 
                                
98
 
                                access.writeStringValue(        
99
 
                                                AEWin32Access.HKEY_CLASSES_ROOT,
100
 
                                                "BitTorrent\\shell\\open\\command",
101
 
                                                "",
102
 
                                                "\"" + az_exe.toString() + "\" \"%1\"" );
103
 
                                
104
 
                                access.writeStringValue(        
105
 
                                                AEWin32Access.HKEY_CLASSES_ROOT,
106
 
                                                "BitTorrent\\Content Type" ,
107
 
                                                "",
108
 
                                                "application/x-bittorrent" );
109
 
                                
110
 
                        }else{
111
 
                                
112
 
                                System.out.println( "can't find Azureus.exe");
113
 
                        }
114
 
                */
115
 
                        
116
 
                        //AEWin32AccessInterface.copyPermission( "C:\\temp\\fred", "C:\\temp\\bill" );
117
 
                        
118
 
                        
119
 
                        AEWin32AccessImpl.getSingleton( false ).traceRoute(
120
 
                                        InetAddress.getByName( "192.168.1.143" ),
121
 
                                        InetAddress.getByName( "www.google.com"),
122
 
                                        new PlatformManagerPingCallback()
123
 
                                        {
124
 
                                                public boolean
125
 
                                                reportNode(
126
 
                                                        int                             distance,
127
 
                                                        InetAddress             address,
128
 
                                                        int                             millis )
129
 
                                                {
130
 
                                                        System.out.println( distance + ": " + address + " - " + millis );
131
 
                                                        
132
 
                                                        return( true );
133
 
                                                }
134
 
                                        });
135
 
                        
136
 
                        // AEWin32AccessInterface.ping( "www.google.com" );
137
 
                        
138
 
                }catch( Throwable e ){
139
 
                        
140
 
                        e.printStackTrace();
141
 
                }
142
 
        }
143
 
}
 
1
/*
 
2
 * Created on Apr 16, 2004
 
3
 * Created by Paul Gardner
 
4
 * Copyright (C) 2004, 2005, 2006 Aelitis, All Rights Reserved.
 
5
 *
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU General Public License
 
8
 * as published by the Free Software Foundation; either version 2
 
9
 * of the License, or (at your option) any later version.
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
17
 * 
 
18
 * AELITIS, SAS au capital de 46,603.30 euros
 
19
 * 8 Allee Lenotre, La Grille Royale, 78600 Le Mesnil le Roi, France.
 
20
 *
 
21
 */
 
22
 
 
23
package org.gudy.azureus2.platform.win32.access.impl;
 
24
 
 
25
/**
 
26
 * @author parg
 
27
 *
 
28
 */
 
29
 
 
30
import java.net.InetAddress;
 
31
 
 
32
import org.gudy.azureus2.platform.PlatformManagerPingCallback;
 
33
 
 
34
public class 
 
35
Test 
 
36
{
 
37
        public static void
 
38
        main(
 
39
                String[]        args )
 
40
        {
 
41
                try{
 
42
                        /*
 
43
                        AEWin32Access access = AEWin32Manager.getAccessor();
 
44
                        
 
45
                        String  app_data = access.getUserAppData();
 
46
                        
 
47
                        System.out.println( "AppData = " + app_data );
 
48
 
 
49
                        String az_home = access.getApplicationInstallDir("azureus");
 
50
                        
 
51
                        File    az_exe = new File( az_home + File.separator + "Azureus.exe" ).getAbsoluteFile();
 
52
                        
 
53
                        if ( az_exe.exists()){
 
54
                                
 
55
                                //<Nolar>       WriteRegStr HKCR ".torrent" "" "BitTorrent"
 
56
                                //<Nolar>       WriteRegStr HKCR "BitTorrent" "" "Bittorrent File"
 
57
                                //<Nolar>       WriteRegStr HKCR "BitTorrent\shell" "" "open"
 
58
                                //<Nolar>       WriteRegStr HKCR "BitTorrent\DefaultIcon" "" $INSTDIR\Azureus.exe,1
 
59
                                //<Nolar>       WriteRegStr HKCR "BitTorrent\shell\open\command" "" '"$INSTDIR\Azureus.exe" "%1"'
 
60
                                //<Nolar>       WriteRegStr HKCR "BitTorrent\Content Type" "" "application/x-bittorrent"
 
61
                                
 
62
                                System.out.println( "current = " + 
 
63
                                                access.readStringValue(         
 
64
                                                AEWin32Access.HKEY_CLASSES_ROOT,
 
65
                                                "BitTorrent\\shell\\open\\command",
 
66
                                                "" ));
 
67
                                
 
68
                                access.deleteKey(       AEWin32Access.HKEY_CLASSES_ROOT,
 
69
                                                                        ".torrent" );
 
70
                        
 
71
                                access.deleteKey(       AEWin32Access.HKEY_CLASSES_ROOT,
 
72
                                                                        "BitTorrent",
 
73
                                                                        true );
 
74
                        
 
75
                                access.writeStringValue(        AEWin32Access.HKEY_CLASSES_ROOT,
 
76
                                                                                        ".torrent",
 
77
                                                                                        "",
 
78
                                                                                        "BitTorrent" );
 
79
                                
 
80
                                access.writeStringValue(        
 
81
                                                AEWin32Access.HKEY_CLASSES_ROOT,
 
82
                                                "BitTorrent",
 
83
                                                "",
 
84
                                                "Bittorrent File" );
 
85
 
 
86
                                access.writeStringValue(        
 
87
                                                AEWin32Access.HKEY_CLASSES_ROOT,
 
88
                                                "BitTorrent\\shell",
 
89
                                                "",
 
90
                                                "open" );
 
91
                                
 
92
                                access.writeStringValue(        
 
93
                                                AEWin32Access.HKEY_CLASSES_ROOT,
 
94
                                                "BitTorrent\\DefaultIcon",
 
95
                                                "",
 
96
                                                az_exe.toString() + ",1" );
 
97
                                
 
98
                                access.writeStringValue(        
 
99
                                                AEWin32Access.HKEY_CLASSES_ROOT,
 
100
                                                "BitTorrent\\shell\\open\\command",
 
101
                                                "",
 
102
                                                "\"" + az_exe.toString() + "\" \"%1\"" );
 
103
                                
 
104
                                access.writeStringValue(        
 
105
                                                AEWin32Access.HKEY_CLASSES_ROOT,
 
106
                                                "BitTorrent\\Content Type" ,
 
107
                                                "",
 
108
                                                "application/x-bittorrent" );
 
109
                                
 
110
                        }else{
 
111
                                
 
112
                                System.out.println( "can't find Azureus.exe");
 
113
                        }
 
114
                */
 
115
                        
 
116
                        //AEWin32AccessInterface.copyPermission( "C:\\temp\\fred", "C:\\temp\\bill" );
 
117
                        
 
118
                        
 
119
                        AEWin32AccessImpl.getSingleton( false ).traceRoute(
 
120
                                        InetAddress.getByName( "192.168.1.143" ),
 
121
                                        InetAddress.getByName( "www.google.com"),
 
122
                                        new PlatformManagerPingCallback()
 
123
                                        {
 
124
                                                public boolean
 
125
                                                reportNode(
 
126
                                                        int                             distance,
 
127
                                                        InetAddress             address,
 
128
                                                        int                             millis )
 
129
                                                {
 
130
                                                        System.out.println( distance + ": " + address + " - " + millis );
 
131
                                                        
 
132
                                                        return( true );
 
133
                                                }
 
134
                                        });
 
135
                        
 
136
                        // AEWin32AccessInterface.ping( "www.google.com" );
 
137
                        
 
138
                }catch( Throwable e ){
 
139
                        
 
140
                        e.printStackTrace();
 
141
                }
 
142
        }
 
143
}