All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jnngl.system.AppStore Maven / Gradle / Ivy

/*
    Plugin for computers in vanilla minecraft!
    Copyright (C) 2022  JNNGL

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see .
 */

package com.jnngl.system;

import com.jnngl.totalcomputers.TotalComputers;
import com.jnngl.totalcomputers.system.TotalOS;
import com.jnngl.totalcomputers.system.Web;
import com.jnngl.totalcomputers.system.desktop.ApplicationHandler;
import com.jnngl.totalcomputers.system.desktop.WindowApplication;
import com.jnngl.totalcomputers.system.overlays.Keyboard;
import com.jnngl.totalcomputers.system.ui.Button;
import com.jnngl.totalcomputers.system.ui.Field;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

public class AppStore extends WindowApplication {

    private static final class ApplicationData {

        private BufferedImage image;
        private final String name;
        private final String author;
        private final String uuid;
        private final String downloadURL;

        private ApplicationData(BufferedImage image, String name, String author, String uuid, String downloadURL) {
            this.image = image;
            this.name = name;
            this.author = author;
            this.uuid = uuid;
            this.downloadURL = downloadURL;
        }

        @Override
        public boolean equals(Object obj) {
            if (obj == this) return true;
            if (obj == null || obj.getClass() != this.getClass()) return false;
            var that = (ApplicationData) obj;
            return Objects.equals(this.image, that.image) &&
                    Objects.equals(this.name, that.name) &&
                    Objects.equals(this.author, that.author) &&
                    Objects.equals(this.uuid, that.uuid) &&
                    Objects.equals(this.downloadURL, that.downloadURL);
        }

        @Override
        public String toString() {
            return "ApplicationData[" +
                    "image=" + image + ", " +
                    "name=" + name + ", " +
                    "author=" + author + ", " +
                    "uuid=" + uuid + ", " +
                    "downloadURL=" + downloadURL + ']';
        }
    }

    private List applications;
    private List installed, installing;
    private List




© 2015 - 2024 Weber Informatics LLC | Privacy Policy