Made the comments in boilerplace mod metadata optional
This commit is contained in:
parent
1590a70627
commit
8038ba2f56
4 changed files with 84 additions and 61 deletions
|
@ -16,6 +16,7 @@
|
|||
"hidden" : true,
|
||||
"changes" : [
|
||||
"Edited a comment in boilerplate mod metadata to include AE ships",
|
||||
"Made the comments in boilerplace mod metadata optional",
|
||||
"Fixed omitted Validate warnings for PNG files",
|
||||
"Added Validate warnings about FTL 1.6.1+ for TTF, MP3, and PNG files"
|
||||
]
|
||||
|
|
|
@ -2,6 +2,7 @@ Changelog
|
|||
|
||||
1.9.1:
|
||||
- Edited a comment in boilerplate mod metadata to include AE ships
|
||||
- Made the comments in boilerplace mod metadata optional
|
||||
- Fixed omitted Validate warnings for PNG files
|
||||
- Added Validate warnings about FTL 1.6.1+ for TTF, MP3, and PNG files
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ public class CreateModDialog extends JDialog implements ActionListener {
|
|||
protected static final String DATA_ROOT = "data/";
|
||||
protected static final String FONTS_ROOT = "fonts/";
|
||||
protected static final String IMG_ROOT = "img/";
|
||||
protected static final String XML_COMMENTS = "XML Comments";
|
||||
protected static final String TITLE = "Title";
|
||||
protected static final String URL = "Thread URL";
|
||||
protected static final String AUTHOR = "Author";
|
||||
|
@ -77,6 +78,10 @@ public class CreateModDialog extends JDialog implements ActionListener {
|
|||
editorPanel.getBoolean( IMG_ROOT ).setHorizontalAlignment( javax.swing.SwingConstants.LEFT );
|
||||
editorPanel.addTextRow( "Create empty top-level directories?" );
|
||||
editorPanel.addSeparatorRow();
|
||||
editorPanel.addRow( XML_COMMENTS, ContentType.BOOLEAN );
|
||||
editorPanel.getBoolean( XML_COMMENTS ).setHorizontalAlignment( javax.swing.SwingConstants.LEFT );
|
||||
editorPanel.addTextRow( "Include XML comments about the purpose of these fields?" );
|
||||
editorPanel.addSeparatorRow();
|
||||
editorPanel.addRow( TITLE, ContentType.STRING );
|
||||
editorPanel.addTextRow( "The title of this mod." );
|
||||
editorPanel.addSeparatorRow();
|
||||
|
@ -93,6 +98,8 @@ public class CreateModDialog extends JDialog implements ActionListener {
|
|||
editorPanel.getTextArea( DESC ).setRows( 15 );
|
||||
editorPanel.addTextRow( "Summary of gameplay effects; flavor; features; concerns about compatibility, recommended patch order, requirements; replaced ship slot; etc." );
|
||||
|
||||
editorPanel.getBoolean( XML_COMMENTS ).setSelected( true );
|
||||
|
||||
JPanel ctrlPanel = new JPanel();
|
||||
ctrlPanel.setLayout( new BoxLayout( ctrlPanel, BoxLayout.X_AXIS ) );
|
||||
ctrlPanel.setBorder( BorderFactory.createEmptyBorder( 10, 0, 10, 0 ) );
|
||||
|
@ -141,6 +148,7 @@ public class CreateModDialog extends JDialog implements ActionListener {
|
|||
String modAuthor = editorPanel.getString( AUTHOR ).getText().trim();
|
||||
String modVersion = editorPanel.getString( VERSION ).getText().trim();
|
||||
String modDesc = editorPanel.getTextArea( DESC ).getText().trim();
|
||||
boolean xmlComments = editorPanel.getBoolean( XML_COMMENTS ).isSelected();
|
||||
|
||||
if ( dirName.length() == 0 ) {
|
||||
JOptionPane.showMessageDialog( CreateModDialog.this, "No directory name was given.", "Nothing to do", JOptionPane.WARNING_MESSAGE );
|
||||
|
@ -156,7 +164,7 @@ public class CreateModDialog extends JDialog implements ActionListener {
|
|||
if ( appendixDir.mkdir() ) {
|
||||
File metadataFile = new File( appendixDir, "metadata.xml" );
|
||||
|
||||
JDOMModMetadataWriter.writeMetadata( metadataFile, modTitle, modURL, modAuthor, modVersion, modDesc );
|
||||
JDOMModMetadataWriter.writeMetadata( metadataFile, modTitle, modURL, modAuthor, modVersion, modDesc, xmlComments );
|
||||
}
|
||||
else {
|
||||
throw new IOException( String.format( "Failed to create directory: %s", appendixDir.getName() ) );
|
||||
|
|
|
@ -28,8 +28,9 @@ public class JDOMModMetadataWriter {
|
|||
* @param modAuthor
|
||||
* @param modVersion
|
||||
* @param modDesc
|
||||
* @param xmlComments true to include comments describing each field, false otherwise
|
||||
*/
|
||||
public static void writeMetadata( File outFile, String modTitle, String modURL, String modAuthor, String modVersion, String modDesc ) throws IOException {
|
||||
public static void writeMetadata( File outFile, String modTitle, String modURL, String modAuthor, String modVersion, String modDesc, boolean xmlComments ) throws IOException {
|
||||
StringBuilder buf = new StringBuilder();
|
||||
|
||||
Element rootNode = new Element( "metadata" );
|
||||
|
@ -37,19 +38,23 @@ public class JDOMModMetadataWriter {
|
|||
|
||||
rootNode.addContent( new Text( "\n" ) );
|
||||
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
if ( xmlComments ) {
|
||||
buf.setLength( 0 );
|
||||
buf.append( "\n" );
|
||||
buf.append( "\t\tCDATA tags mean no need to escape special characters.\n" );
|
||||
buf.append( "\t\tDon't worry about spaces at the start/end. That gets trimmed.\n" );
|
||||
buf.append( "\t" );
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
rootNode.addContent( new Comment( buf.toString() ) );
|
||||
rootNode.addContent( new Text( "\n\n\n" ) );
|
||||
}
|
||||
|
||||
// title.
|
||||
if ( xmlComments ) {
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
rootNode.addContent( new Comment( String.format( " %s ", "The title of this mod." ) ) );
|
||||
rootNode.addContent( new Text( "\n" ) );
|
||||
}
|
||||
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
Element titleNode = new Element( "title" );
|
||||
|
@ -58,15 +63,17 @@ public class JDOMModMetadataWriter {
|
|||
rootNode.addContent( new Text( "\n\n\n" ) );
|
||||
|
||||
// threadUrl.
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
if ( xmlComments ) {
|
||||
buf.setLength( 0 );
|
||||
buf.append( "\n" );
|
||||
buf.append( "\t\tThis mod's thread on subsetgames.com.\n" );
|
||||
buf.append( "\t\tIf there's no thread yet, create one to announce your upcoming mod in the\n" );
|
||||
buf.append( "\t\tforum. Then paste the url here.\n" );
|
||||
buf.append( "\t" );
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
rootNode.addContent( new Comment( buf.toString() ) );
|
||||
rootNode.addContent( new Text( "\n" ) );
|
||||
}
|
||||
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
Element urlNode = new Element( "threadUrl" );
|
||||
|
@ -75,9 +82,11 @@ public class JDOMModMetadataWriter {
|
|||
rootNode.addContent( new Text( "\n\n\n" ) );
|
||||
|
||||
// author.
|
||||
if ( xmlComments ) {
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
rootNode.addContent( new Comment( String.format( " %s ", "Your forum user name." ) ) );
|
||||
rootNode.addContent( new Text( "\n" ) );
|
||||
}
|
||||
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
Element authorNode = new Element( "author" );
|
||||
|
@ -86,7 +95,7 @@ public class JDOMModMetadataWriter {
|
|||
rootNode.addContent( new Text( "\n\n\n" ) );
|
||||
|
||||
// version.
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
if ( xmlComments ) {
|
||||
buf.setLength( 0 );
|
||||
buf.append( "\n" );
|
||||
buf.append( "\t\tThe revision/variant of this release, preferably at least a number.\n" );
|
||||
|
@ -96,8 +105,10 @@ public class JDOMModMetadataWriter {
|
|||
buf.append( "\t\t\t2.4.1 Hi-res Bkgs\n" );
|
||||
buf.append( "\t\t\t1.0 for FTL 1.03.1\n" );
|
||||
buf.append( "\t" );
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
rootNode.addContent( new Comment( buf.toString() ) );
|
||||
rootNode.addContent( new Text( "\n" ) );
|
||||
}
|
||||
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
Element versionNode = new Element( "version" );
|
||||
|
@ -115,7 +126,7 @@ public class JDOMModMetadataWriter {
|
|||
|
||||
rootNode.addContent( new Text( "\n\n" ) );
|
||||
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
if ( xmlComments ) {
|
||||
buf.setLength( 0 );
|
||||
buf.append( "\n" );
|
||||
buf.append( "\t\tSuggestions for the description...\n" );
|
||||
|
@ -137,8 +148,10 @@ public class JDOMModMetadataWriter {
|
|||
buf.append( "\t\tAbove all, keep the description general, so you won't have to edit\n" );
|
||||
buf.append( "\t\tthat again for each new version.\n" );
|
||||
buf.append( "\t" );
|
||||
rootNode.addContent( new Text( "\t" ) );
|
||||
rootNode.addContent( new Comment( buf.toString() ) );
|
||||
rootNode.addContent( new Text( "\n" ) );
|
||||
}
|
||||
|
||||
Format format = Format.getPrettyFormat();
|
||||
format.setTextMode( Format.TextMode.PRESERVE );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue