import java.awt.DisplayMode;
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.lang.reflect.Field;

public class Class466 {

   DisplayMode aDisplayMode5745;
   GraphicsDevice aGraphicsDevice5746;
   static String aString5747;
   public static byte aByte5748;


   int[] method7843() {
      DisplayMode[] var1 = this.aGraphicsDevice5746.getDisplayModes();
      int[] var2 = new int[var1.length << 2];

      for(int var3 = 0; var3 < var1.length; ++var3) {
         var2[var3 << 2] = var1[var3].getWidth();
         var2[(var3 << 2) + 1] = var1[var3].getHeight();
         var2[(var3 << 2) + 2] = var1[var3].getBitDepth();
         var2[3 + (var3 << 2)] = var1[var3].getRefreshRate();
      }

      return var2;
   }

   int[] method7844(byte var1) {
      DisplayMode[] var2 = this.aGraphicsDevice5746.getDisplayModes();
      int[] var3 = new int[var2.length << 2];

      for(int var4 = 0; var4 < var2.length; ++var4) {
         var3[var4 << 2] = var2[var4].getWidth();
         var3[(var4 << 2) + 1] = var2[var4].getHeight();
         var3[(var4 << 2) + 2] = var2[var4].getBitDepth();
         var3[3 + (var4 << 2)] = var2[var4].getRefreshRate();
      }

      return var3;
   }

   void method7845(Frame var1, int var2, int var3, int var4, int var5, int var6) {
      this.aDisplayMode5745 = this.aGraphicsDevice5746.getDisplayMode();
      if(this.aDisplayMode5745 == null) {
         throw new NullPointerException();
      } else {
         var1.setUndecorated(true);
         var1.enableInputMethods(false);
         this.method7858(var1, 1908752799);
         if(var5 == 0) {
            int var7 = this.aDisplayMode5745.getRefreshRate();
            DisplayMode[] var8 = this.aGraphicsDevice5746.getDisplayModes();
            boolean var9 = false;

            for(int var10 = 0; var10 < var8.length; ++var10) {
               if(var8[var10].getWidth() == var2 && var8[var10].getHeight() == var3 && var8[var10].getBitDepth() == var4) {
                  int var11 = var8[var10].getRefreshRate();
                  if(!var9 || Math.abs(var11 - var7) < Math.abs(var5 - var7)) {
                     var5 = var11;
                     var9 = true;
                  }
               }
            }

            if(!var9) {
               var5 = var7;
            }
         }

         this.aGraphicsDevice5746.setDisplayMode(new DisplayMode(var2, var3, var4, var5));
      }
   }

   int[] method7846() {
      DisplayMode[] var1 = this.aGraphicsDevice5746.getDisplayModes();
      int[] var2 = new int[var1.length << 2];

      for(int var3 = 0; var3 < var1.length; ++var3) {
         var2[var3 << 2] = var1[var3].getWidth();
         var2[(var3 << 2) + 1] = var1[var3].getHeight();
         var2[(var3 << 2) + 2] = var1[var3].getBitDepth();
         var2[3 + (var3 << 2)] = var1[var3].getRefreshRate();
      }

      return var2;
   }

   void method7847(Frame var1, int var2, int var3, int var4, int var5) {
      this.aDisplayMode5745 = this.aGraphicsDevice5746.getDisplayMode();
      if(this.aDisplayMode5745 == null) {
         throw new NullPointerException();
      } else {
         var1.setUndecorated(true);
         var1.enableInputMethods(false);
         this.method7858(var1, 1872515923);
         if(var5 == 0) {
            int var6 = this.aDisplayMode5745.getRefreshRate();
            DisplayMode[] var7 = this.aGraphicsDevice5746.getDisplayModes();
            boolean var8 = false;

            for(int var9 = 0; var9 < var7.length; ++var9) {
               if(var7[var9].getWidth() == var2 && var7[var9].getHeight() == var3 && var7[var9].getBitDepth() == var4) {
                  int var10 = var7[var9].getRefreshRate();
                  if(!var8 || Math.abs(var10 - var6) < Math.abs(var5 - var6)) {
                     var5 = var10;
                     var8 = true;
                  }
               }
            }

            if(!var8) {
               var5 = var6;
            }
         }

         this.aGraphicsDevice5746.setDisplayMode(new DisplayMode(var2, var3, var4, var5));
      }
   }

   void method7848(byte var1) {
      if(null != this.aDisplayMode5745) {
         DisplayMode[] var2 = this.aGraphicsDevice5746.getDisplayModes();
         boolean var3 = false;
         DisplayMode[] var4 = var2;

         for(int var5 = 0; var5 < var4.length; ++var5) {
            DisplayMode var6 = var4[var5];
            if(var6.equals(this.aDisplayMode5745)) {
               this.aGraphicsDevice5746.setDisplayMode(this.aDisplayMode5745);
               var3 = true;
               break;
            }
         }

         if(!var3) {
            try {
               Field var8 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("defaultDisplayMode");
               var8.setAccessible(true);
               var8.set(this.aGraphicsDevice5746, (Object)null);
            } catch (Throwable var7) {
               ;
            }
         }

         this.aDisplayMode5745 = null;
      }

      this.method7858((Frame)null, 1862075047);
   }

   void method7849(Frame var1) {
      boolean var2 = false;

      Field var3;
      try {
         var3 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
         var3.setAccessible(true);
         boolean var4 = ((Boolean)var3.get(this.aGraphicsDevice5746)).booleanValue();
         if(var4) {
            var3.set(this.aGraphicsDevice5746, Boolean.FALSE);
            var2 = true;
         }
      } catch (Throwable var13) {
         ;
      }

      try {
         this.aGraphicsDevice5746.setFullScreenWindow(var1);
         if(var2) {
            try {
               var3 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
               var3.set(this.aGraphicsDevice5746, Boolean.TRUE);
            } catch (Throwable var12) {
               ;
            }
         }

      } finally {
         if(var2) {
            try {
               Field var6 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
               var6.set(this.aGraphicsDevice5746, Boolean.TRUE);
            } catch (Throwable var11) {
               ;
            }
         }

      }
   }

   void method7850(Frame var1) {
      boolean var2 = false;

      Field var3;
      try {
         var3 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
         var3.setAccessible(true);
         boolean var4 = ((Boolean)var3.get(this.aGraphicsDevice5746)).booleanValue();
         if(var4) {
            var3.set(this.aGraphicsDevice5746, Boolean.FALSE);
            var2 = true;
         }
      } catch (Throwable var13) {
         ;
      }

      try {
         this.aGraphicsDevice5746.setFullScreenWindow(var1);
         if(var2) {
            try {
               var3 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
               var3.set(this.aGraphicsDevice5746, Boolean.TRUE);
            } catch (Throwable var12) {
               ;
            }
         }

      } finally {
         if(var2) {
            try {
               Field var6 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
               var6.set(this.aGraphicsDevice5746, Boolean.TRUE);
            } catch (Throwable var11) {
               ;
            }
         }

      }
   }

   void method7851(Frame var1, int var2, int var3, int var4, int var5) {
      this.aDisplayMode5745 = this.aGraphicsDevice5746.getDisplayMode();
      if(this.aDisplayMode5745 == null) {
         throw new NullPointerException();
      } else {
         var1.setUndecorated(true);
         var1.enableInputMethods(false);
         this.method7858(var1, 1949882897);
         if(var5 == 0) {
            int var6 = this.aDisplayMode5745.getRefreshRate();
            DisplayMode[] var7 = this.aGraphicsDevice5746.getDisplayModes();
            boolean var8 = false;

            for(int var9 = 0; var9 < var7.length; ++var9) {
               if(var7[var9].getWidth() == var2 && var7[var9].getHeight() == var3 && var7[var9].getBitDepth() == var4) {
                  int var10 = var7[var9].getRefreshRate();
                  if(!var8 || Math.abs(var10 - var6) < Math.abs(var5 - var6)) {
                     var5 = var10;
                     var8 = true;
                  }
               }
            }

            if(!var8) {
               var5 = var6;
            }
         }

         this.aGraphicsDevice5746.setDisplayMode(new DisplayMode(var2, var3, var4, var5));
      }
   }

   void method7852(Frame var1, int var2, int var3, int var4, int var5) {
      this.aDisplayMode5745 = this.aGraphicsDevice5746.getDisplayMode();
      if(this.aDisplayMode5745 == null) {
         throw new NullPointerException();
      } else {
         var1.setUndecorated(true);
         var1.enableInputMethods(false);
         this.method7858(var1, 1897979973);
         if(var5 == 0) {
            int var6 = this.aDisplayMode5745.getRefreshRate();
            DisplayMode[] var7 = this.aGraphicsDevice5746.getDisplayModes();
            boolean var8 = false;

            for(int var9 = 0; var9 < var7.length; ++var9) {
               if(var7[var9].getWidth() == var2 && var7[var9].getHeight() == var3 && var7[var9].getBitDepth() == var4) {
                  int var10 = var7[var9].getRefreshRate();
                  if(!var8 || Math.abs(var10 - var6) < Math.abs(var5 - var6)) {
                     var5 = var10;
                     var8 = true;
                  }
               }
            }

            if(!var8) {
               var5 = var6;
            }
         }

         this.aGraphicsDevice5746.setDisplayMode(new DisplayMode(var2, var3, var4, var5));
      }
   }

   void method7853() {
      if(null != this.aDisplayMode5745) {
         DisplayMode[] var1 = this.aGraphicsDevice5746.getDisplayModes();
         boolean var2 = false;
         DisplayMode[] var3 = var1;

         for(int var4 = 0; var4 < var3.length; ++var4) {
            DisplayMode var5 = var3[var4];
            if(var5.equals(this.aDisplayMode5745)) {
               this.aGraphicsDevice5746.setDisplayMode(this.aDisplayMode5745);
               var2 = true;
               break;
            }
         }

         if(!var2) {
            try {
               Field var7 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("defaultDisplayMode");
               var7.setAccessible(true);
               var7.set(this.aGraphicsDevice5746, (Object)null);
            } catch (Throwable var6) {
               ;
            }
         }

         this.aDisplayMode5745 = null;
      }

      this.method7858((Frame)null, 1483352103);
   }

   void method7854(Frame var1, int var2, int var3, int var4, int var5) {
      this.aDisplayMode5745 = this.aGraphicsDevice5746.getDisplayMode();
      if(this.aDisplayMode5745 == null) {
         throw new NullPointerException();
      } else {
         var1.setUndecorated(true);
         var1.enableInputMethods(false);
         this.method7858(var1, 1672899692);
         if(var5 == 0) {
            int var6 = this.aDisplayMode5745.getRefreshRate();
            DisplayMode[] var7 = this.aGraphicsDevice5746.getDisplayModes();
            boolean var8 = false;

            for(int var9 = 0; var9 < var7.length; ++var9) {
               if(var7[var9].getWidth() == var2 && var7[var9].getHeight() == var3 && var7[var9].getBitDepth() == var4) {
                  int var10 = var7[var9].getRefreshRate();
                  if(!var8 || Math.abs(var10 - var6) < Math.abs(var5 - var6)) {
                     var5 = var10;
                     var8 = true;
                  }
               }
            }

            if(!var8) {
               var5 = var6;
            }
         }

         this.aGraphicsDevice5746.setDisplayMode(new DisplayMode(var2, var3, var4, var5));
      }
   }

   void method7855(Frame var1, int var2, int var3, int var4, int var5) {
      this.aDisplayMode5745 = this.aGraphicsDevice5746.getDisplayMode();
      if(this.aDisplayMode5745 == null) {
         throw new NullPointerException();
      } else {
         var1.setUndecorated(true);
         var1.enableInputMethods(false);
         this.method7858(var1, 1719611063);
         if(var5 == 0) {
            int var6 = this.aDisplayMode5745.getRefreshRate();
            DisplayMode[] var7 = this.aGraphicsDevice5746.getDisplayModes();
            boolean var8 = false;

            for(int var9 = 0; var9 < var7.length; ++var9) {
               if(var7[var9].getWidth() == var2 && var7[var9].getHeight() == var3 && var7[var9].getBitDepth() == var4) {
                  int var10 = var7[var9].getRefreshRate();
                  if(!var8 || Math.abs(var10 - var6) < Math.abs(var5 - var6)) {
                     var5 = var10;
                     var8 = true;
                  }
               }
            }

            if(!var8) {
               var5 = var6;
            }
         }

         this.aGraphicsDevice5746.setDisplayMode(new DisplayMode(var2, var3, var4, var5));
      }
   }

   public Class466() throws Exception {
      GraphicsEnvironment var1 = GraphicsEnvironment.getLocalGraphicsEnvironment();
      this.aGraphicsDevice5746 = var1.getDefaultScreenDevice();
      if(!this.aGraphicsDevice5746.isFullScreenSupported()) {
         GraphicsDevice[] var2 = var1.getScreenDevices();
         GraphicsDevice[] var3 = var2;

         for(int var4 = 0; var4 < var3.length; ++var4) {
            GraphicsDevice var5 = var3[var4];
            if(null != var5 && var5.isFullScreenSupported()) {
               this.aGraphicsDevice5746 = var5;
               return;
            }
         }

         throw new Exception();
      }
   }

   void method7856() {
      if(null != this.aDisplayMode5745) {
         DisplayMode[] var1 = this.aGraphicsDevice5746.getDisplayModes();
         boolean var2 = false;
         DisplayMode[] var3 = var1;

         for(int var4 = 0; var4 < var3.length; ++var4) {
            DisplayMode var5 = var3[var4];
            if(var5.equals(this.aDisplayMode5745)) {
               this.aGraphicsDevice5746.setDisplayMode(this.aDisplayMode5745);
               var2 = true;
               break;
            }
         }

         if(!var2) {
            try {
               Field var7 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("defaultDisplayMode");
               var7.setAccessible(true);
               var7.set(this.aGraphicsDevice5746, (Object)null);
            } catch (Throwable var6) {
               ;
            }
         }

         this.aDisplayMode5745 = null;
      }

      this.method7858((Frame)null, 1439605634);
   }

   void method7857(Frame var1) {
      boolean var2 = false;

      Field var3;
      try {
         var3 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
         var3.setAccessible(true);
         boolean var4 = ((Boolean)var3.get(this.aGraphicsDevice5746)).booleanValue();
         if(var4) {
            var3.set(this.aGraphicsDevice5746, Boolean.FALSE);
            var2 = true;
         }
      } catch (Throwable var13) {
         ;
      }

      try {
         this.aGraphicsDevice5746.setFullScreenWindow(var1);
         if(var2) {
            try {
               var3 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
               var3.set(this.aGraphicsDevice5746, Boolean.TRUE);
            } catch (Throwable var12) {
               ;
            }
         }

      } finally {
         if(var2) {
            try {
               Field var6 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
               var6.set(this.aGraphicsDevice5746, Boolean.TRUE);
            } catch (Throwable var11) {
               ;
            }
         }

      }
   }

   void method7858(Frame var1, int var2) {
      boolean var3 = false;

      Field var4;
      try {
         var4 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
         var4.setAccessible(true);
         boolean var5 = ((Boolean)var4.get(this.aGraphicsDevice5746)).booleanValue();
         if(var5) {
            var4.set(this.aGraphicsDevice5746, Boolean.FALSE);
            var3 = true;
         }
      } catch (Throwable var14) {
         ;
      }

      try {
         this.aGraphicsDevice5746.setFullScreenWindow(var1);
         if(var3) {
            try {
               var4 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
               var4.set(this.aGraphicsDevice5746, Boolean.TRUE);
            } catch (Throwable var13) {
               ;
            }
         }

      } finally {
         if(var3) {
            try {
               Field var7 = Class.forName("sun.awt.Win32GraphicsDevice").getDeclaredField("valid");
               var7.set(this.aGraphicsDevice5746, Boolean.TRUE);
            } catch (Throwable var12) {
               ;
            }
         }

      }
   }

   int[] method7859() {
      DisplayMode[] var1 = this.aGraphicsDevice5746.getDisplayModes();
      int[] var2 = new int[var1.length << 2];

      for(int var3 = 0; var3 < var1.length; ++var3) {
         var2[var3 << 2] = var1[var3].getWidth();
         var2[(var3 << 2) + 1] = var1[var3].getHeight();
         var2[(var3 << 2) + 2] = var1[var3].getBitDepth();
         var2[3 + (var3 << 2)] = var1[var3].getRefreshRate();
      }

      return var2;
   }
}
