Author: ks156
Date: 2009-09-14 13:34:18 +0200 (Mon, 14 Sep 2009)
New Revision: 5376

Modified:
   
software_suite_v3/software/tool/tool-attitunes-studio/branches/user_mode/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
Log:
* Added a test to determine if the server is on the port 270 or 54321


Modified: 
software_suite_v3/software/tool/tool-attitunes-studio/branches/user_mode/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
===================================================================
--- 
software_suite_v3/software/tool/tool-attitunes-studio/branches/user_mode/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
    2009-09-14 11:15:33 UTC (rev 5375)
+++ 
software_suite_v3/software/tool/tool-attitunes-studio/branches/user_mode/src/com/tuxisalive/attitunes/visual/ATTBlockViewer.java
    2009-09-14 11:34:18 UTC (rev 5376)
@@ -104,7 +104,7 @@
        
        public ATTFormatReadWrite attituneFile;
        
-       public TuxAPI tux = new TuxAPI("localhost", 270); //$NON-NLS-1$
+       public TuxAPI tux; //$NON-NLS-1$
        
        private boolean sceneHaveChanged = false;
        
@@ -210,8 +210,25 @@
                /* Set visible */
                this.setVisible(true);
                /* Connect the tuxdroid api */
+                tux = new TuxAPI("127.0.0.1", 270);
                tux.server.autoConnect(TuxAPIConst.CLIENT_LEVEL_RESTRICTED, 
"AttitunesStudio", "attscene"); //$NON-NLS-1$ //$NON-NLS-2$
-               /* Refresh the viewer */
+
+                /* Wait 1 second, and check if the API is connected */
+                try {
+                    Thread.sleep(1000);
+                }
+                catch(Exception except) {  
+                    except.printStackTrace();
+                }  
+
+                /* If the API is not connected, try with the port 54321 */
+                if (tux.server.getConnected() != true)
+                {
+                    tux = new TuxAPI("127.0.0.1", 54321);
+                   tux.server.autoConnect(TuxAPIConst.CLIENT_LEVEL_RESTRICTED, 
"AttitunesStudio", "attscene"); //$NON-NLS-1$ //$NON-NLS-2$
+                }    
+                
+                /* Refresh the viewer */
                this.setZoomFactor(1);
        }
        


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to