net: support bridge network for Windows 10 OS
authorMunkyu Im <munkyu.im@samsung.com>
Fri, 11 Dec 2015 09:24:13 +0000 (18:24 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 21 Dec 2015 07:58:46 +0000 (16:58 +0900)
Because Windows 8 and above need manual bridge network,
the way to detect OS supported is changed.
environment veriable "os.version" is used for it.

Change-Id: Iba36478572a434e869a4933dbe6e5a5484508dca
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
src/org/tizen/emulator/manager/EmulatorManager.java
src/org/tizen/emulator/manager/tool/TapUtil.java
src/org/tizen/emulator/manager/ui/dialog/TapDeviceDialogForWin.java

index 40a884b..7d056fa 100755 (executable)
@@ -76,7 +76,7 @@ public class EmulatorManager {
        private static RandomAccessFile randomAccessFile;
        private static boolean isMac    = false;
        private static boolean isWin    = false;
-       private static boolean isWin8   = false;
+       private static boolean isWin8AndAbove   = false;
        private static boolean isLinux  = false;
        static {
 
@@ -84,8 +84,14 @@ public class EmulatorManager {
                        isLinux = true;
                } else if (System.getProperty("os.name").toLowerCase().indexOf("win") > -1) { //$NON-NLS-1$ //$NON-NLS-2$
                        isWin = true;
-                       if (System.getProperty("os.name").startsWith("Windows 8")) { //$NON-NLS-1$ //$NON-NLS-2$
-                               isWin8 = true;
+                       try {
+                               /*The version of Windows8 is 6.2 */
+                               if (Float.parseFloat(System.getProperty("os.version")) >= 6.2) { //$NON-NLS-1$ //$NON-NLS-2$
+                                       isWin8AndAbove = true;
+                               }
+                       } catch (NumberFormatException e) {
+                               EMLogger.getLogger().warning(e.getMessage());
+                               isWin8AndAbove = false;
                        }
                } else if (System.getProperty("os.name").toLowerCase().indexOf("mac") > -1) { //$NON-NLS-1$ //$NON-NLS-2$
                         isMac = true;
@@ -130,8 +136,8 @@ public class EmulatorManager {
                return isWin;
        }
 
-       public static boolean isWin8() {
-               return isWin8;
+       public static boolean isWin8AndAbove() {
+               return isWin8AndAbove;
        }
 
        public static boolean isLinux() {
index 9c30a80..657b247 100644 (file)
@@ -389,7 +389,7 @@ public class TapUtil {
                                        }
                                }
                                EMLogger.getLogger().warning("found tapid: " + foundTapId); //$NON-NLS-1$
-                               if (EmulatorManager.isWin8()) {
+                               if (EmulatorManager.isWin8AndAbove()) {
                                        topKey = "SYSTEM\\CurrentControlSet\\services\\NdisImPlatform\\Linkage"; //$NON-NLS-1$
                                } else {
                                        topKey = "SYSTEM\\CurrentControlSet\\services\\Bridge\\Linkage"; //$NON-NLS-1$
@@ -1378,7 +1378,7 @@ public class TapUtil {
                        List<String> cmd;
                        ProcessResult res;
                        try {
-                               if (!EmulatorManager.isWin8()) {
+                               if (!EmulatorManager.isWin8AndAbove()) {
                                        EMLogger.getLogger().info(
                                                        "get CompatibleIDs from pci network device"); //$NON-NLS-1$
                                        cmd = Arrays.asList(getDevconPath(platformVersion), "find", "=net", //$NON-NLS-1$ //$NON-NLS-2$
@@ -1476,7 +1476,7 @@ public class TapUtil {
                                        }
                                }
 
-                               if (!EmulatorManager.isWin8()) {
+                               if (!EmulatorManager.isWin8AndAbove()) {
                                        EMLogger.getLogger().info("bind host network to bridge"); //$NON-NLS-1$
                                        String tapPnpInstanceID = getPnpInstanceIDFromName(tapName);
 
index 14f49d0..c667452 100644 (file)
@@ -184,7 +184,7 @@ public class TapDeviceDialogForWin {
                nameText.setLayoutData(data);
                nameText.setEnabled(false);
                nameText.setText(TapUtil.getAvailableTapName());
-               if (!EmulatorManager.isWin8()) {
+               if (!EmulatorManager.isWin8AndAbove()) {
                        // interface (combo select)
                        Label ifLabel = new Label(upperComp, SWT.NONE);
                        ifLabel.setFont(FontResources.DETAIL_TITLE_FONT.getFont());
@@ -288,7 +288,7 @@ public class TapDeviceDialogForWin {
                                // Check Tap duplication
                                // if (TapUtil.nameNotExist(nameText.getText())) {
                                tapName = nameText.getText();
-                               if (!EmulatorManager.isWin8()) {
+                               if (!EmulatorManager.isWin8AndAbove()) {
                                        ifName = combo.getText();
                                }
                                dialog.close();