Exemplo n.º 1
0
    public static void main(string[] args)
    {
      Exception exception1;
      try
      {
        SwingUtilities.invokeAndWait((Runnable) new main\u00241());
        goto label_5;
      }
      catch (Exception ex)
      {
        int num = 0;
        M0 m0 = ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num);
        if (m0 == null)
          throw;
        else
          exception1 = (Exception) m0;
      }
      Throwable.instancehelper_printStackTrace((Exception) exception1);
      System.exit(2);
label_5:
      ProgressMonitor monitor = new ProgressMonitor((Component) null, (object) "Loading SmartDashboard", "Initializing internal code...", 0, 1000);
      FileSniffer.findExtensions(monitor, 0, 490);
      string[] args1 = args;
      int num1 = 1;
      int num2 = 1;
      string[] valueArgs = new string[1];
      int index = 0;
      string str1 = "ip";
      valueArgs[index] = str1;
      ArgParser argParser = new ArgParser(args1, num1 != 0, num2 != 0, valueArgs);
      main.inCompetition = argParser.hasFlag("competition");
      Exception exception2;
      try
      {
        SwingUtilities.invokeAndWait((Runnable) new main\u00242());
        goto label_11;
      }
      catch (Exception ex)
      {
        int num3 = 0;
        M0 m0 = ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num3);
        if (m0 == null)
          throw;
        else
          exception2 = (Exception) m0;
      }
      Throwable.instancehelper_printStackTrace((Exception) exception2);
      System.exit(2);
label_11:
      IntegerProperty integerProperty = main.frame.getPrefs().__\u003C\u003Eteam;
      if (argParser.hasValue("ip"))
      {
        monitor.setProgress(650);
        monitor.setNote(new StringBuilder().append("Connecting to robot at: ").append(argParser.getValue("ip")).toString());
        Robot.setHost(argParser.getValue("ip"));
      }
      else
      {
        monitor.setProgress(600);
        monitor.setNote("Getting Team Number");
        int num3 = integerProperty.getValue().intValue();
        while (num3 <= 0)
        {
          string str2;
          try
          {
            str2 = JOptionPane.showInputDialog((object) "Input Team Number");
            if (str2 == null)
            {
              num3 = 0;
              break;
            }
            else
              goto label_20;
          }
          catch (Exception ex)
          {
            int num4 = 2;
            if (ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num4) == null)
              throw;
          }
          // ISSUE: variable of the null type
          __Null local = null;
          goto label_24;
label_20:
          try
          {
            num3 = Integer.parseInt(str2);
            continue;
          }
          catch (Exception ex)
          {
            int num4 = 2;
            if (ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num4) == null)
              throw;
          }
          local = null;
label_24:;
        }
        monitor.setProgress(650);
        monitor.setNote(new StringBuilder().append("Connecting to robot of team: ").append(num3).toString());
        integerProperty.setValue((object) Integer.valueOf(num3));
      }
      Exception exception3;
      try
      {
        SwingUtilities.invokeAndWait((Runnable) new main\u00243(monitor));
        return;
      }
      catch (Exception ex)
      {
        int num3 = 0;
        M0 m0 = ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num3);
        if (m0 == null)
          throw;
        else
          exception3 = (Exception) m0;
      }
      Throwable.instancehelper_printStackTrace((Exception) exception3);
      System.exit(2);
    }
Exemplo n.º 2
0
    public static void findExtensions(ProgressMonitor monitor, int min, int max)
    {
      monitor.setNote("Loading Extensions");
      File file1 = new File("./extensions");
      File file2 = new File("./lib");
      File file3 = new File("./extensions/lib");
      URLClassLoader urlClassLoader1 = (URLClassLoader) ClassLoader.getSystemClassLoader(FileSniffer.__\u003CGetCallerID\u003E());
      Class class1 = (Class) ClassLiteral<URLClassLoader>.Value;
      Method declaredMethod;
      Exception exception1;
      try
      {
        Class class2 = class1;
        string str = "addURL";
        Class[] classArray = new Class[1];
        int index = 0;
        // ISSUE: variable of the null type
        __Null local = ClassLiteral<URL>.Value;
        classArray[index] = (Class) local;
        CallerID callerId = FileSniffer.__\u003CGetCallerID\u003E();
        declaredMethod = class2.getDeclaredMethod(str, classArray, callerId);
        ((AccessibleObject) declaredMethod).setAccessible(true);
        goto label_6;
      }
      catch (Exception ex)
      {
        int num = 0;
        M0 m0 = ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num);
        if (m0 == null)
          throw;
        else
          exception1 = (Exception) m0;
      }
      Throwable.instancehelper_printStackTrace((Exception) exception1);
      monitor.setProgress(max);
      return;
label_6:
      File[] fileArray1 = new File[3];
      int index1 = 0;
      File file4 = file2;
      fileArray1[index1] = file4;
      int index2 = 1;
      File file5 = file3;
      fileArray1[index2] = file5;
      int index3 = 2;
      File file6 = file1;
      fileArray1[index3] = file6;
      File[] fileArray2 = fileArray1;
      int length1 = fileArray2.Length;
      for (int index4 = 0; index4 < length1; ++index4)
      {
        File file7 = fileArray2[index4];
        if (!file7.exists())
        {
          monitor.setProgress(min + (max - min) / 5);
        }
        else
        {
          System.get_out().println(new StringBuilder().append("Searching Folder:").append((object) file7).toString());
          monitor.setNote(new StringBuilder().append("Searching Folder:").append((object) file7).toString());
          File[] fileArray3 = file7.listFiles((FilenameFilter) new FileSniffer\u00241());
          if (fileArray3 == null)
          {
            monitor.setProgress(min + (max - min) / 5);
          }
          else
          {
            File[] fileArray4 = fileArray3;
            int length2 = fileArray4.Length;
            for (int index5 = 0; index5 < length2; ++index5)
            {
              File file8 = fileArray4[index5];
              System.get_out().println(new StringBuilder().append("Adding Jar:").append((object) file8).toString());
              Exception exception2;
              try
              {
                Method method = declaredMethod;
                URLClassLoader urlClassLoader2 = urlClassLoader1;
                object[] objArray = new object[1];
                int index6 = 0;
                URL url = file8.toURI().toURL();
                objArray[index6] = (object) url;
                CallerID callerId = FileSniffer.__\u003CGetCallerID\u003E();
                method.invoke((object) urlClassLoader2, objArray, callerId);
                continue;
              }
              catch (Exception ex)
              {
                int num = 0;
                M0 m0 = ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num);
                if (m0 == null)
                  throw;
                else
                  exception2 = (Exception) m0;
              }
              Throwable.instancehelper_printStackTrace((Exception) exception2);
            }
            monitor.setProgress(min + (max - min) / 5);
          }
        }
      }
      if (!file1.exists())
      {
        System.get_out().println("No Extension Folder");
        monitor.setProgress(max);
      }
      else
      {
        File[] fileArray3 = file1.listFiles((FilenameFilter) new FileSniffer\u00242());
        double num1 = 0.0;
        File[] fileArray4 = fileArray3;
        int length2 = fileArray4.Length;
label_26:
        for (int index4 = 0; index4 < length2; ++index4)
        {
          File file7 = fileArray4[index4];
          System.get_out().println(new StringBuilder().append("Searching Jar:").append((object) file7).toString());
          monitor.setProgress(ByteCodeHelper.d2i((double) (min + max) / 2.0 * (1.0 + num1++ / (double) fileArray3.Length)));
          monitor.setNote(new StringBuilder().append("Searching Jar:").append((object) file7).toString());
          Enumeration enumeration;
          Exception exception2;
          try
          {
            enumeration = new JarFile(file7).entries();
            goto label_31;
          }
          catch (Exception ex)
          {
            int num2 = 0;
            exception2 = (Exception) ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num2);
          }
          Exception exception3 = exception2;
          goto label_52;
label_31:
          Exception exception4;
          Exception exception5;
          while (true)
          {
            Class class2;
            try
            {
              string name;
              do
              {
                if (enumeration.hasMoreElements())
                  name = ((ZipEntry) enumeration.nextElement()).getName();
                else
                  goto label_26;
              }
              while (!String.instancehelper_endsWith(name, ".class"));
              class2 = (Class) null;
              try
              {
                try
                {
                  try
                  {
                    class2 = Class.forName(String.instancehelper_replaceAll(String.instancehelper_substring(name, 0, String.instancehelper_length(name) - 6), "/", "."), false, (ClassLoader) urlClassLoader1, FileSniffer.__\u003CGetCallerID\u003E());
                    DisplayElementRegistry.registerWidget(class2.asSubclass((Class) ClassLiteral<Widget>.Value));
                    System.get_out().println(new StringBuilder().append("Custom Widget:").append(class2.getSimpleName()).toString());
                    continue;
                  }
                  catch (Exception ex)
                  {
                    int num2 = 2;
                    if (ByteCodeHelper.MapException<ClassCastException>(ex, (ByteCodeHelper.MapFlags) num2) == null)
                      throw;
                  }
                }
                catch (ClassNotFoundException ex)
                {
                  goto label_42;
                }
              }
              catch (Exception ex)
              {
                int num2 = 2;
                if (ByteCodeHelper.MapException<NoClassDefFoundError>(ex, (ByteCodeHelper.MapFlags) num2) == null)
                  throw;
                else
                  goto label_43;
              }
            }
            catch (Exception ex)
            {
              int num2 = 0;
              exception4 = (Exception) ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num2);
              break;
            }
            try
            {
              try
              {
                DisplayElementRegistry.registerStaticWidget(class2.asSubclass((Class) ClassLiteral<StaticWidget>.Value));
                System.get_out().println(new StringBuilder().append("Custom Static Widget:").append(class2.getSimpleName()).toString());
              }
              catch (Exception ex)
              {
                int num2 = 2;
                if (ByteCodeHelper.MapException<ClassCastException>(ex, (ByteCodeHelper.MapFlags) num2) == null)
                  throw;
              }
            }
            catch (Exception ex)
            {
              int num2 = 0;
              exception5 = (Exception) ByteCodeHelper.MapException<Exception>(ex, (ByteCodeHelper.MapFlags) num2);
              goto label_51;
            }
            continue;
label_42:
            continue;
label_43:;
          }
          exception3 = exception4;
          goto label_52;
label_51:
          exception3 = exception5;
label_52:
          Throwable.instancehelper_printStackTrace(exception3);
          System.get_out().println("Error, could not add URL to system classloader");
        }
        monitor.setProgress(max);
      }
    }