MCPcopy Index your code
hub / github.com/Garten/sourcecraft / Main

Method Main

src/main/Main.java:37–98  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35 }
36
37 public Main() {
38 try {
39 assert false;
40 } catch (java.lang.AssertionError e) {
41 Loggger.log("assertions enabeled");
42 }
43
44 Material.init();
45 Periphery.init();
46
47 this.converter = new Converter();
48 this.gui = new Gui(TITLE + " " + VERSION);
49
50 new GuiLogic().run(this.gui);
51
52 this.gui.setUponRun(() -> {
53 this.saveNewPlace();
54
55 File output = new File(this.gui.getOutputFile());
56 ConverterData data = this.getConverterData();
57 if (data == null) {
58 return;
59 }
60 this.converter.convert(data, output);
61 if (data.getUpdateTextures()) {
62 final TexturePack pack = data.getTexturePack();
63 if (!Steam.areTexturesUpToDate(data.getGame(), pack)) {
64 File targetDirectory = data.getGame()
65 .getMatriealPath(pack);
66 if (targetDirectory.exists()) {
67 TextureFolderMover.copyFolder(pack.getFolder(), data.getGame()
68 .getMatriealPath(pack));
69 } else if (targetDirectory.getParentFile()
70 .getParentFile()
71 .exists()) {
72 targetDirectory.getParentFile()
73 .mkdir(); // Garrysmod comes without material folder
74 TextureFolderMover.copyFolder(pack.getFolder(), data.getGame()
75 .getMatriealPath(pack));
76 } else {
77 Loggger.log("Not copying textures. The directory " + targetDirectory + " does not exist. Have you launched " + data.getGame()
78 .getLongName() + " at least once?");
79 }
80 }
81 }
82
83 data.getGame()
84 .setGameTargetSavePath(output);
85 Periphery.CONFIG.setConvertData(data);
86 Periphery.CONFIG.setMinecraftPath(new File(this.gui.getMincraftPath()));
87 Periphery.CONFIG.setSteamPath(this.gui.getSourcePath());
88 Periphery.write();
89
90 // result
91 String outputLast = output.getName();
92 this.gui.setDisplayedOutputName(outputLast);
93 this.gui.setLabelOutputPath(output.getName());
94 this.gui.setDisplayOpenFor(data.getGame()

Callers

nothing calls this directly

Calls 15

logMethod · 0.95
initMethod · 0.95
initMethod · 0.95
saveNewPlaceMethod · 0.95
getConverterDataMethod · 0.95
getUpdateTexturesMethod · 0.95
getTexturePackMethod · 0.95
areTexturesUpToDateMethod · 0.95
getGameMethod · 0.95
copyFolderMethod · 0.95
getFolderMethod · 0.95
writeMethod · 0.95

Tested by

no test coverage detected