mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
launcher icon injection work in progress
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<install-over minbuild="126.1" maxbuild="127.9999" version="12.1"/>
|
||||
<logo url="/idea_community_logo.png" textcolor="ffffff" progressColor="ffaa16" progressY="236" progressTailIcon="/community_progress_tail.png"/>
|
||||
<about url="/idea_community_about.png" foreground="ffffff" logoX="300" logoY="265" logoW="75" logoH="30"/>
|
||||
<icon size32="/icon_CE.png" size16="/icon_CEsmall.png" size32opaque="/icon_CEwhite.png" size12="/toolwindows/toolWindowProject.png" size128="/icon_CE_128.png"/>
|
||||
<icon size32="/icon_CE.png" size16="/icon_CEsmall.png" size32opaque="/icon_CEwhite.png" size12="/toolwindows/toolWindowProject.png" size128="/icon_CE_128.png" ico="idea_CE.ico"/>
|
||||
<package code="__PACKAGE_CODE__"/>
|
||||
<names product="IDEA" fullname="IntelliJ IDEA" script="idea"/>
|
||||
|
||||
|
||||
+1
@@ -14,6 +14,7 @@
|
||||
<entry name="?*.dtd" />
|
||||
<entry name="?*.tld" />
|
||||
<entry name="?*.ftl" />
|
||||
<entry name="?*.ico" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="guava-12.0">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/../../lib/guava-12.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
+1
@@ -3,6 +3,7 @@
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/../../community-resources/community-resources.iml" filepath="$PROJECT_DIR$/../../community-resources/community-resources.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/../../platform/icons/icons.iml" filepath="$PROJECT_DIR$/../../platform/icons/icons.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/launcher-generator.iml" filepath="$PROJECT_DIR$/launcher-generator.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
<orderEntry type="module" module-name="community-resources" />
|
||||
<orderEntry type="library" name="jdom" level="project" />
|
||||
<orderEntry type="library" name="sanselan-0.98-snapshot" level="project" />
|
||||
<orderEntry type="module" module-name="icons" />
|
||||
<orderEntry type="library" name="guava-12.0" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -21,10 +21,7 @@ import com.pme.exe.Bin;
|
||||
import com.pme.exe.res.Level;
|
||||
import com.pme.exe.res.LevelEntry;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.IOException;
|
||||
import java.io.File;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* Date: Apr 27, 2006
|
||||
@@ -62,12 +59,11 @@ public class IconFile extends Bin.Structure {
|
||||
try {
|
||||
super.read(stream);
|
||||
Word idCount = (Word) ((Bin.Structure) getMember("Header")).getMember("idCount");
|
||||
ArrayOfBins iconDirs = new ArrayOfBins("Icon directories", IconDirectory.class, idCount);
|
||||
ArrayOfBins<IconDirectory> iconDirs = new ArrayOfBins<IconDirectory>("Icon directories", IconDirectory.class, idCount);
|
||||
iconDirs.setCountHolder(idCount);
|
||||
addMember(myImages);
|
||||
Bin[] array = iconDirs.getArray();
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
Bin bin = array[i];
|
||||
for (Bin bin : array) {
|
||||
myImages.addLevelEntry((LevelEntry) bin);
|
||||
}
|
||||
myImages.read(stream);
|
||||
|
||||
@@ -17,13 +17,10 @@
|
||||
|
||||
package com.pme.exe.res.icon;
|
||||
|
||||
import com.pme.exe.res.*;
|
||||
import com.pme.exe.Bin;
|
||||
import com.pme.exe.res.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
|
||||
package com.pme.launcher;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import com.google.common.io.InputSupplier;
|
||||
import com.pme.exe.Bin;
|
||||
import com.pme.exe.ExeReader;
|
||||
import com.pme.exe.SectionReader;
|
||||
@@ -36,11 +38,11 @@ import java.io.*;
|
||||
*/
|
||||
public class LauncherGenerator {
|
||||
private File myTemplate;
|
||||
private File myIcon;
|
||||
private File myExePath;
|
||||
private StringTableDirectory myStringTableDirectory;
|
||||
private DirectoryEntry myRoot;
|
||||
private ExeReader myReader;
|
||||
private VersionInfo myVersionInfo;
|
||||
|
||||
public LauncherGenerator(File template, File exePath) {
|
||||
myTemplate = template;
|
||||
@@ -58,22 +60,17 @@ public class LauncherGenerator {
|
||||
myRoot = resourceReader.getRoot();
|
||||
DirectoryEntry subDir = myRoot.findSubDir("IRD6");
|
||||
myStringTableDirectory = new StringTableDirectory(subDir);
|
||||
}
|
||||
|
||||
public void generate() throws IOException {
|
||||
myStringTableDirectory.save();
|
||||
|
||||
if (myIcon != null) {
|
||||
IconResourceInjector iconInjector = new IconResourceInjector();
|
||||
iconInjector.injectIcon(myIcon, myRoot, "IRD101");
|
||||
}
|
||||
|
||||
DirectoryEntry viDir = myRoot.findSubDir("IRD16").findSubDir( "IRD1" );
|
||||
Bin.Bytes viBytes = viDir.getRawResource( 0 ).getBytes();
|
||||
ByteArrayInputStream bytesStream = new ByteArrayInputStream(viBytes.getBytes());
|
||||
|
||||
VersionInfo viReader = new VersionInfo();
|
||||
viReader.read(new OffsetTrackingInputStream(new DataInputStream(bytesStream)));
|
||||
myVersionInfo = new VersionInfo();
|
||||
myVersionInfo.read(new OffsetTrackingInputStream(new DataInputStream(bytesStream)));
|
||||
}
|
||||
|
||||
public void generate() throws IOException {
|
||||
myStringTableDirectory.save();
|
||||
|
||||
myReader.resetOffsets(0);
|
||||
|
||||
@@ -93,4 +90,16 @@ public class LauncherGenerator {
|
||||
RawResource bmpRes = subDirBmp.getRawResource(0);
|
||||
bmpRes.setBytes(bitmapData);
|
||||
}
|
||||
|
||||
public void injectIcon(String name, final InputStream iconStream) throws IOException {
|
||||
File f = File.createTempFile("launcher", "ico");
|
||||
Files.copy(new InputSupplier<InputStream>() {
|
||||
@Override
|
||||
public InputStream getInput() throws IOException {
|
||||
return iconStream;
|
||||
}
|
||||
}, f);
|
||||
IconResourceInjector iconInjector = new IconResourceInjector();
|
||||
iconInjector.injectIcon(f, myRoot, "IRD101");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class LauncherGeneratorMain {
|
||||
try {
|
||||
appInfo = new SAXBuilder().build(appInfoStream);
|
||||
} catch (Exception e) {
|
||||
System.err.println("Error loading application info file " + appInfoStream + ": " + e.getMessage());
|
||||
System.err.println("Error loading application info file " + args[1] + ": " + e.getMessage());
|
||||
System.exit(4);
|
||||
return;
|
||||
}
|
||||
@@ -81,6 +81,17 @@ public class LauncherGeneratorMain {
|
||||
System.exit(6);
|
||||
}
|
||||
|
||||
String icoUrl = appInfo.getRootElement().getChild("icon").getAttributeValue("ico");
|
||||
if (icoUrl == null) {
|
||||
System.err.println(".ico file URL not specified in application info file " + args[1]);
|
||||
System.exit(11);
|
||||
}
|
||||
InputStream iconStream = LauncherGeneratorMain.class.getClassLoader().getResourceAsStream(icoUrl);
|
||||
if (iconStream == null) {
|
||||
System.err.println(".ico file " + icoUrl + " not found");
|
||||
System.exit(12);
|
||||
}
|
||||
|
||||
Map<String, Integer> resourceIDs;
|
||||
try {
|
||||
resourceIDs = loadResourceIDs(args[2]);
|
||||
@@ -121,6 +132,7 @@ public class LauncherGeneratorMain {
|
||||
}
|
||||
|
||||
generator.injectBitmap(resourceIDs.get("IDB_SPLASH"), splashBmpStream.toByteArray());
|
||||
generator.injectIcon(icoUrl, iconStream);
|
||||
|
||||
generator.generate();
|
||||
} catch (IOException e) {
|
||||
|
||||
Reference in New Issue
Block a user