Beispiel #1
0
  public static void main(String[] args) {
    if (args.length < 1) {
      printHelp();
      return;
    }
    try {
      GetConfig.parse(Process.ParseXMLBytes1(ReadFileAll(args[0])));
    } catch (Exception e) {
      Go.log("[User] Configure paraments reading error, please check your xml file.");
      return;
    }
    if (args.length < 3) {
      System.out.println(Version.strVersion());
      System.out.println(Version.strThanks());
      Go.log(String.format("Read cards that can be sold (%d).", Info.CanBeSold.size()));
    }
    if (args.length == 1) {
      // auto mode
      while (true) {
        Process proc = new Process();
        Profile2 prof = new Profile2();
        while (true) {
          try {
            switch (Info.Profile) {
              case 1:
                proc.auto();
                break;
              case 2:
                prof.auto();
                break;
            }
          } catch (Exception ex) {
            boolean printed = false;
            if (ErrorData.text != null) {
              Go.log("[User] " + ErrorData.text);
              ErrorData.clear();
              printed = true;
            }
            if (ErrorData.bytes != null && printed == false) {
              Go.log("[User] " + new String(ErrorData.bytes));
              ErrorData.clear();
              printed = true;
            }
            if (ex.getMessage() != null && printed == false) {
              Go.log("[System] " + ex.getMessage());
              printed = true;
            }
            if (printed == false) {
              Go.log("[System] Unexpected Error:");
              ex.printStackTrace();
            }
            Process.info.events.add(EventType.cookieOutOfDate);
            Go.log("[Global] Restart");
          }
        }
      }

    } else if (args.length == 2) {
      if (args[1].equals("-m")) {
        // manual operation
        System.out.println("come soon");
      } else {
        printHelp();
      }
    } else if (args.length == 3) {
      try {
        if (args[1].startsWith("-f")) {
          if (args[1].charAt(2) == '1') {
            System.out.println(new String(Crypto.DecryptNoKey(ReadFileAll(args[2]))));
          } else if (args[1].charAt(2) == '2') {
            System.out.println(new String(Crypto.DecryptWithKey(ReadFileAll(args[2]))));
          }
        } else if (args[1].equals("-t")) {
          // 用作测试使用
          try {
          } catch (Exception ex) {
            ex.printStackTrace();
          }
        } else if (args[1].startsWith("-d")) {
          if (args[1].charAt(2) == '1') {
            System.out.println(new String(Crypto.DecryptBase64NoKey2Str(args[2])));
          } else if (args[1].charAt(2) == '2') {
            System.out.println(new String(Crypto.DecryptBase64WithKey2Str(args[2])));
          }
        }
      } catch (Exception ex) {
        ex.printStackTrace();
        printHelp();
      }
    } else {
      printHelp();
    }
  }