This repository has been archived by the owner on Dec 18, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
386 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
mohistlauncher/src/main/java/com/mohistmc/action/ZipTree.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.mohistmc.action; | ||
|
||
import com.mohistmc.MohistMCStart; | ||
import java.io.BufferedReader; | ||
import java.io.FileReader; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.InputStreamReader; | ||
|
||
public class ZipTree { | ||
|
||
public static void init() throws IOException { | ||
InputStream is = MohistMCStart.class.getClassLoader().getResourceAsStream("META-INF/libraries"); | ||
getFileContent(is); | ||
} | ||
|
||
public static void getFileContent(Object fileInPath) throws IOException { | ||
BufferedReader br = null; | ||
if (fileInPath == null) { | ||
return; | ||
} | ||
if (fileInPath instanceof String) { | ||
br = new BufferedReader(new FileReader((String) fileInPath)); | ||
} else if (fileInPath instanceof InputStream) { | ||
br = new BufferedReader(new InputStreamReader((InputStream) fileInPath)); | ||
} | ||
String line; | ||
while ((line = br.readLine()) != null) { | ||
System.out.println(line); | ||
} | ||
br.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
mohistlauncher/src/main/java/com/mohistmc/libraries/Libraries.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* Mohist - MohistMC | ||
* Copyright (C) 2018-2024. | ||
* | ||
* 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 <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.mohistmc.libraries; | ||
|
||
import com.mohistmc.tools.MD5Util; | ||
import java.io.File; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Data; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
public class Libraries { | ||
|
||
String path; | ||
String md5; | ||
long size; | ||
boolean installer; | ||
|
||
public static Libraries from(String line) { | ||
String[] parts = line.split("\\|"); | ||
return new Libraries(parts[0], parts[1], Long.parseLong(parts[2]), Boolean.parseBoolean(parts[3])); | ||
} | ||
|
||
public static Libraries from(File file) { | ||
return new Libraries(file.getAbsolutePath(), MD5Util.get(file), file.length(), false); | ||
} | ||
} |
Oops, something went wrong.