/**
   * Write the wishlist passed as a parameter to the wishlist file
   *
   * @param mCtx A context to open the file and pop toasts with
   * @param lWishlist The wishlist to write to the file
   */
  private static void WriteWishlist(Context mCtx, ArrayList<MtgCard> lWishlist) {
    try {
      FileOutputStream fos = mCtx.openFileOutput(WISHLIST_NAME, Context.MODE_PRIVATE);

      for (MtgCard m : lWishlist) {
        fos.write(m.toWishlistString().getBytes());
      }

      fos.close();
    } catch (IOException e) {
      ToastWrapper.makeText(mCtx, e.getLocalizedMessage(), ToastWrapper.LENGTH_LONG).show();
    }
  }
  /**
   * Read the wishlist from a file and return it as an ArrayList<MtgCard>
   *
   * @param mCtx A context to open the file and pop toasts with
   * @return The wishlist in ArrayList form
   */
  public static ArrayList<MtgCard> ReadWishlist(Context mCtx) {

    ArrayList<MtgCard> lWishlist = new ArrayList<>();

    try {
      String line;
      BufferedReader br =
          new BufferedReader(new InputStreamReader(mCtx.openFileInput(WISHLIST_NAME)));
      /* Read each line as a card, and add them to the ArrayList */
      while ((line = br.readLine()) != null) {
        lWishlist.add(new MtgCard(line, mCtx));
      }
    } catch (NumberFormatException e) {
      ToastWrapper.makeText(mCtx, e.getLocalizedMessage(), ToastWrapper.LENGTH_LONG).show();
    } catch (IOException e) {
      /* Catches file not found exception when wishlist doesn't exist */
    }
    return lWishlist;
  }
  /**
   * Write the wishlist passed as a parameter to the wishlist file
   *
   * @param mCtx A context to open the file and pop toasts with
   * @param mCompressedWishlist The wishlist to write to the file
   */
  public static void WriteCompressedWishlist(
      Context mCtx, ArrayList<CompressedWishlistInfo> mCompressedWishlist) {
    try {
      FileOutputStream fos = mCtx.openFileOutput(WISHLIST_NAME, Context.MODE_PRIVATE);

      /* For each compressed card, make an MtgCard and write it to the wishlist */
      for (CompressedWishlistInfo cwi : mCompressedWishlist) {
        MtgCard card = cwi.mCard;
        for (IndividualSetInfo isi : cwi.mInfo) {
          card.set = isi.mSet;
          card.setCode = isi.mSetCode;
          card.number = isi.mNumber;
          card.foil = isi.mIsFoil;
          card.numberOf = isi.mNumberOf;
          fos.write(card.toWishlistString().getBytes());
        }
      }

      fos.close();
    } catch (IOException e) {
      ToastWrapper.makeText(mCtx, e.getLocalizedMessage(), ToastWrapper.LENGTH_LONG).show();
    }
  }