当前位置: 首页>>代码示例>>Java>>正文


Java EnumOS.WINDOWS属性代码示例

本文整理汇总了Java中net.minecraft.util.EnumOS.WINDOWS属性的典型用法代码示例。如果您正苦于以下问题:Java EnumOS.WINDOWS属性的具体用法?Java EnumOS.WINDOWS怎么用?Java EnumOS.WINDOWS使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraft.util.EnumOS的用法示例。


在下文中一共展示了EnumOS.WINDOWS属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isWindows

public static boolean isWindows() {
	return Minecraft.getOs() == EnumOS.WINDOWS;
}
 
开发者ID:austinv11,项目名称:PeripheralsPlusPlus,代码行数:3,代码来源:SpeechManager.java

示例2: func_73875_a

protected void func_73875_a(GuiButton p_73875_1_) {
   if(p_73875_1_.field_73742_g) {
      if(p_73875_1_.field_73741_f == 5) {
         File var2 = GuiScreenTemporaryResourcePackSelectSelectionList.func_110510_a(this.field_110346_c).func_110612_e();
         String var3 = var2.getAbsolutePath();
         if(Util.func_110647_a() == EnumOS.MACOS) {
            try {
               this.field_73882_e.func_98033_al().func_98233_a(var3);
               Runtime.getRuntime().exec(new String[]{"/usr/bin/open", var3});
               return;
            } catch (IOException var9) {
               var9.printStackTrace();
            }
         } else if(Util.func_110647_a() == EnumOS.WINDOWS) {
            String var4 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[]{var3});

            try {
               Runtime.getRuntime().exec(var4);
               return;
            } catch (IOException var8) {
               var8.printStackTrace();
            }
         }

         boolean var10 = false;

         try {
            Class var5 = Class.forName("java.awt.Desktop");
            Object var6 = var5.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
            var5.getMethod("browse", new Class[]{URI.class}).invoke(var6, new Object[]{var2.toURI()});
         } catch (Throwable var7) {
            var7.printStackTrace();
            var10 = true;
         }

         if(var10) {
            this.field_73882_e.func_98033_al().func_98233_a("Opening via system class!");
            Sys.openURL("file://" + var3);
         }
      } else if(p_73875_1_.field_73741_f == 6) {
         this.field_73882_e.func_71373_a(this.field_110347_a);
      } else {
         this.field_110346_c.func_77219_a(p_73875_1_);
      }

   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:47,代码来源:GuiScreenTemporaryResourcePackSelect.java

示例3: func_110647_a

public static EnumOS func_110647_a() {
   String var0 = System.getProperty("os.name").toLowerCase();
   return var0.contains("win")?EnumOS.WINDOWS:(var0.contains("mac")?EnumOS.MACOS:(var0.contains("solaris")?EnumOS.SOLARIS:(var0.contains("sunos")?EnumOS.SOLARIS:(var0.contains("linux")?EnumOS.LINUX:(var0.contains("unix")?EnumOS.LINUX:EnumOS.UNKNOWN)))));
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:4,代码来源:Util.java

示例4: actionPerformed

/**
 * Fired when a control is clicked. This is the equivalent of ActionListener.actionPerformed(ActionEvent e).
 */
protected void actionPerformed(GuiButton par1GuiButton)
{
    if (par1GuiButton.enabled)
    {
        if (par1GuiButton.id == 5)
        {
            File file1 = GuiScreenTemporaryResourcePackSelectSelectionList.func_110510_a(this.field_110346_c).getDirResourcepacks();
            String s = file1.getAbsolutePath();

            if (Util.getOSType() == EnumOS.MACOS)
            {
                try
                {
                    this.mc.getLogAgent().logInfo(s);
                    Runtime.getRuntime().exec(new String[] {"/usr/bin/open", s});
                    return;
                }
                catch (IOException ioexception)
                {
                    ioexception.printStackTrace();
                }
            }
            else if (Util.getOSType() == EnumOS.WINDOWS)
            {
                String s1 = String.format("cmd.exe /C start \"Open file\" \"%s\"", new Object[] {s});

                try
                {
                    Runtime.getRuntime().exec(s1);
                    return;
                }
                catch (IOException ioexception1)
                {
                    ioexception1.printStackTrace();
                }
            }

            boolean flag = false;

            try
            {
                Class oclass = Class.forName("java.awt.Desktop");
                Object object = oclass.getMethod("getDesktop", new Class[0]).invoke((Object)null, new Object[0]);
                oclass.getMethod("browse", new Class[] {URI.class}).invoke(object, new Object[] {file1.toURI()});
            }
            catch (Throwable throwable)
            {
                throwable.printStackTrace();
                flag = true;
            }

            if (flag)
            {
                this.mc.getLogAgent().logInfo("Opening via system class!");
                Sys.openURL("file://" + s);
            }
        }
        else if (par1GuiButton.id == 6)
        {
            this.mc.displayGuiScreen(this.field_110347_a);
        }
        else
        {
            this.field_110346_c.actionPerformed(par1GuiButton);
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:70,代码来源:GuiScreenTemporaryResourcePackSelect.java


注:本文中的net.minecraft.util.EnumOS.WINDOWS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。