mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
Consolidated preference files and main.properties under res/preferences/.
Updated methods to make change smoothly without losing old preferences.
This commit is contained in:
2
.gitattributes
vendored
2
.gitattributes
vendored
@@ -11067,6 +11067,8 @@ res/pics_product/tournamentpacks/SHM.jpg -text
|
||||
res/pics_product/tournamentpacks/TMP.jpg -text
|
||||
res/pics_product/tournamentpacks/TSP.jpg -text
|
||||
res/pics_product/tournamentpacks/USG.jpg -text
|
||||
res/preferences/editor.preferences -text
|
||||
res/preferences/main.properties -text
|
||||
res/product-images.txt -text
|
||||
res/quest/all-prices.txt svneol=native#text/plain
|
||||
res/quest/bazaar/ape_pet_l1.txt -text
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -358,6 +358,7 @@ res/pics/booster
|
||||
res/pics/icons
|
||||
res/pics/tokens/*.jpg
|
||||
res/pics_product/*.jpg
|
||||
res/preferences/forge.preferences
|
||||
res/quest/data
|
||||
res/quest/quest.preferences
|
||||
res/quest/questData.dat
|
||||
|
||||
@@ -43,4 +43,4 @@
|
||||
|
||||
# this link includes the main properties file. you can move/rename etc. the res-folder. you just have to change
|
||||
# this single line
|
||||
main--transparent-properties=res/main.properties
|
||||
main--transparent-properties=res/preferences/main.properties
|
||||
|
||||
32
res/preferences/editor.preferences
Normal file
32
res/preferences/editor.preferences
Normal file
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0"?>
|
||||
<preferences type="editor">
|
||||
<pref name="stats_catalog" value="true"></pref>
|
||||
<pref name="stats_deck" value="true"></pref>
|
||||
<col enumval="CAT_QUANTITY" identifier="Quantity" index="0" show="true" sortpriority="0" sortstate="NONE" width="75"></col>
|
||||
<col enumval="CAT_NAME" identifier="Name" index="0" show="true" sortpriority="2" sortstate="ASC" width="79"></col>
|
||||
<col enumval="CAT_COST" identifier="Cost" index="4" show="true" sortpriority="0" sortstate="NONE" width="71"></col>
|
||||
<col enumval="CAT_COLOR" identifier="Color" index="1" show="true" sortpriority="0" sortstate="NONE" width="81"></col>
|
||||
<col enumval="CAT_TYPE" identifier="Type" index="2" show="true" sortpriority="0" sortstate="ASC" width="88"></col>
|
||||
<col enumval="CAT_POWER" identifier="Power" index="3" show="true" sortpriority="0" sortstate="NONE" width="58"></col>
|
||||
<col enumval="CAT_TOUGHNESS" identifier="Toughness" index="5" show="true" sortpriority="1" sortstate="ASC" width="59"></col>
|
||||
<col enumval="CAT_CMC" identifier="CMC" index="6" show="true" sortpriority="0" sortstate="NONE" width="58"></col>
|
||||
<col enumval="CAT_RARITY" identifier="Rarity" index="7" show="false" sortpriority="0" sortstate="ASC" width="75"></col>
|
||||
<col enumval="CAT_SET" identifier="Set" index="9" show="false" sortpriority="0" sortstate="NONE" width="75"></col>
|
||||
<col enumval="CAT_AI" identifier="AI" index="10" show="false" sortpriority="0" sortstate="NONE" width="75"></col>
|
||||
<col enumval="CAT_NEW" identifier="New" index="8" show="true" sortpriority="0" sortstate="NONE" width="75"></col>
|
||||
<col enumval="CAT_PURCHASE_PRICE" identifier="Purchase Price" index="10" show="true" sortpriority="0" sortstate="NONE" width="75"></col>
|
||||
<col enumval="CAT_DECKS" identifier="Decks" index="9" show="true" sortpriority="0" sortstate="NONE" width="75"></col>
|
||||
<col enumval="DECK_QUANTITY" identifier="Quantity" index="0" show="true" sortpriority="0" sortstate="NONE" width="47"></col>
|
||||
<col enumval="DECK_NAME" identifier="Name" index="1" show="true" sortpriority="1" sortstate="ASC" width="107"></col>
|
||||
<col enumval="DECK_COST" identifier="Cost" index="2" show="true" sortpriority="0" sortstate="NONE" width="42"></col>
|
||||
<col enumval="DECK_COLOR" identifier="Color" index="5" show="true" sortpriority="0" sortstate="NONE" width="41"></col>
|
||||
<col enumval="DECK_TYPE" identifier="Type" index="4" show="true" sortpriority="0" sortstate="NONE" width="41"></col>
|
||||
<col enumval="DECK_POWER" identifier="Power" index="6" show="true" sortpriority="0" sortstate="NONE" width="40"></col>
|
||||
<col enumval="DECK_TOUGHNESS" identifier="Toughness" index="7" show="true" sortpriority="0" sortstate="NONE" width="37"></col>
|
||||
<col enumval="DECK_CMC" identifier="CMC" index="8" show="true" sortpriority="0" sortstate="NONE" width="40"></col>
|
||||
<col enumval="DECK_RARITY" identifier="Rarity" index="9" show="true" sortpriority="0" sortstate="NONE" width="36"></col>
|
||||
<col enumval="DECK_SET" identifier="Set" index="10" show="true" sortpriority="0" sortstate="NONE" width="35"></col>
|
||||
<col enumval="DECK_AI" identifier="AI" index="3" show="true" sortpriority="0" sortstate="NONE" width="43"></col>
|
||||
<col enumval="DECK_NEW" identifier="New" index="11" show="true" sortpriority="0" sortstate="NONE" width="75"></col>
|
||||
<col enumval="DECK_SALE_PRICE" identifier="Sale Price" index="12" show="true" sortpriority="1" sortstate="ASC" width="75"></col>
|
||||
</preferences>
|
||||
69
res/preferences/main.properties
Normal file
69
res/preferences/main.properties
Normal file
@@ -0,0 +1,69 @@
|
||||
program/howToReportBugsURL=http://tinyurl.com/3zzrnyb
|
||||
program/cardforgeURL=http://cardforge.org
|
||||
|
||||
showdeck/2color=false
|
||||
showdeck/3color=false
|
||||
showdeck/4color=false
|
||||
showdeck/5color=false
|
||||
|
||||
tokens--file=AllTokens.txt
|
||||
mtg-data--file=mtg-data.txt
|
||||
|
||||
decks--file=all-decks2
|
||||
booster-decks--file=booster-deck
|
||||
decks-dir--file=../decks
|
||||
|
||||
card-pictures--file=card-pictures.txt
|
||||
token-images--file=token-images.txt
|
||||
card-pictures_a--file=../pics_link/card-pictures_a.txt
|
||||
card-pictures_b--file=../pics_link/card-pictures_b.txt
|
||||
card-pictures_c--file=../pics_link/card-pictures_c.txt
|
||||
card-pictures_d--file=../pics_link/card-pictures_d.txt
|
||||
card-pictures_e--file=../pics_link/card-pictures_e.txt
|
||||
card-pictures_f--file=../pics_link/card-pictures_f.txt
|
||||
card-pictures_g--file=../pics_link/card-pictures_g.txt
|
||||
card-pictures_h--file=../pics_link/card-pictures_h.txt
|
||||
card-pictures_i--file=../pics_link/card-pictures_i.txt
|
||||
card-pictures_j--file=../pics_link/card-pictures_j.txt
|
||||
card-pictures_k--file=../pics_link/card-pictures_k.txt
|
||||
card-pictures_l--file=../pics_link/card-pictures_l.txt
|
||||
card-pictures_m--file=../pics_link/card-pictures_m.txt
|
||||
card-pictures_n--file=../pics_link/card-pictures_n.txt
|
||||
card-pictures_o--file=../pics_link/card-pictures_o.txt
|
||||
card-pictures_p--file=../pics_link/card-pictures_p.txt
|
||||
card-pictures_q--file=../pics_link/card-pictures_q.txt
|
||||
card-pictures_r--file=../pics_link/card-pictures_r.txt
|
||||
card-pictures_s--file=../pics_link/card-pictures_s.txt
|
||||
card-pictures_t--file=../pics_link/card-pictures_t.txt
|
||||
card-pictures_u--file=../pics_link/card-pictures_u.txt
|
||||
card-pictures_v--file=../pics_link/card-pictures_v.txt
|
||||
card-pictures_w--file=../pics_link/card-pictures_w.txt
|
||||
card-pictures_x--file=../pics_link/card-pictures_x.txt
|
||||
card-pictures_y--file=../pics_link/card-pictures_y.txt
|
||||
card-pictures_z--file=../pics_link/card-pictures_z.txt
|
||||
card-pictures_other--file=../pics_link/card-pictures_other.txt
|
||||
card-pictures_token_hq--file=../pics_link/card-pictures_token.txt
|
||||
cards--file=cards.txt
|
||||
cardsfolder--file=../cardsfolder
|
||||
removed-cards--file=removedCards.txt
|
||||
|
||||
regular/common--file=common.txt
|
||||
regular/uncommon--file=uncommon.txt
|
||||
regular/rare--file=rare.txt
|
||||
|
||||
name-mutator--file=name-mutator.txt
|
||||
|
||||
quest--properties=../quest/quest.properties
|
||||
draft--properties=../draft/draft.properties
|
||||
|
||||
lang--transparent-properties=../lang/lang.properties
|
||||
|
||||
image/base--file=../pics
|
||||
image/token--file=../pics/tokens
|
||||
image/icon--file=../pics/icons
|
||||
image/product--file=../pics_product
|
||||
pics/booster/images--file=../quest/booster-images.txt
|
||||
|
||||
quest/opponent/icons--file=../quest/quest-opponent-icons.txt
|
||||
quest/pet/icons--file=../quest/quest-pet-shop-icons.txt
|
||||
quest/pet/tokens--file=../quest/quest-pet-token-images.txt
|
||||
@@ -1,7 +1,10 @@
|
||||
package forge.gui.deckeditor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@@ -179,7 +182,7 @@ public class SEditorIO {
|
||||
*/
|
||||
private static void save() throws Exception {
|
||||
final XMLOutputFactory out = XMLOutputFactory.newInstance();
|
||||
final XMLEventWriter writer = out.createXMLEventWriter(new FileOutputStream(NewConstants.PREFERENCES_FILE_EDITOR));
|
||||
final XMLEventWriter writer = out.createXMLEventWriter(new FileOutputStream(NewConstants.PREFS_EDITOR_FILE));
|
||||
|
||||
writer.add(EVENT_FACTORY.createStartDocument());
|
||||
writer.add(NEWLINE);
|
||||
@@ -232,8 +235,28 @@ public class SEditorIO {
|
||||
}
|
||||
|
||||
private static void load() throws Exception {
|
||||
// Preferences files have been consolidated into res/preferences/.
|
||||
// This code is here temporarily to facilitate this transfer.
|
||||
// After a while, this can be deleted. Doublestrike 21-5-12
|
||||
final File oldFile = new File("editor.preferences");
|
||||
if (oldFile.exists()) {
|
||||
final File newFile = new File(NewConstants.PREFS_EDITOR_FILE);
|
||||
final InputStream in = new FileInputStream(oldFile);
|
||||
final OutputStream out = new FileOutputStream(newFile);
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
|
||||
oldFile.delete();
|
||||
} // END TEMPORARY CONSOLIDATION FACILITATION
|
||||
|
||||
final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
|
||||
final String fileAddress = NewConstants.PREFERENCES_FILE_EDITOR;
|
||||
final String fileAddress = NewConstants.PREFS_EDITOR_FILE;
|
||||
final XMLEventReader reader = inputFactory.createXMLEventReader(new FileInputStream(fileAddress));
|
||||
|
||||
PREFS.clear();
|
||||
|
||||
@@ -19,10 +19,15 @@ package forge.properties;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileReader;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -145,7 +150,27 @@ public class ForgePreferences {
|
||||
public ForgePreferences() {
|
||||
preferenceValues = new HashMap<FPref, String>();
|
||||
try {
|
||||
final BufferedReader input = new BufferedReader(new FileReader(NewConstants.PREFERENCE_FILE));
|
||||
// Preferences files have been consolidated into res/prefs/.
|
||||
// This code is here temporarily to facilitate this transfer.
|
||||
// After a while, this can be deleted. Doublestrike 21-5-12
|
||||
final File oldFile = new File("forge.preferences");
|
||||
if (oldFile.exists()) {
|
||||
final File newFile = new File(NewConstants.PREFS_GLOBAL_FILE);
|
||||
final InputStream in = new FileInputStream(oldFile);
|
||||
final OutputStream out = new FileOutputStream(newFile);
|
||||
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
while ((len = in.read(buf)) > 0) {
|
||||
out.write(buf, 0, len);
|
||||
}
|
||||
in.close();
|
||||
out.close();
|
||||
|
||||
oldFile.delete();
|
||||
} // END TEMPORARY CONSOLIDATION FACILITATION
|
||||
|
||||
final BufferedReader input = new BufferedReader(new FileReader(NewConstants.PREFS_GLOBAL_FILE));
|
||||
String line = null;
|
||||
while ((line = input.readLine()) != null) {
|
||||
if (line.startsWith("#") || (line.length() == 0)) {
|
||||
@@ -170,7 +195,7 @@ public class ForgePreferences {
|
||||
BufferedWriter writer = null;
|
||||
|
||||
try {
|
||||
writer = new BufferedWriter(new FileWriter(NewConstants.PREFERENCE_FILE));
|
||||
writer = new BufferedWriter(new FileWriter(NewConstants.PREFS_GLOBAL_FILE));
|
||||
for (FPref key : FPref.values()) {
|
||||
writer.write(key + "=" + getPref(key));
|
||||
writer.newLine();
|
||||
|
||||
@@ -44,7 +44,7 @@ public class ForgeProps {
|
||||
static {
|
||||
TreeProperties p;
|
||||
try {
|
||||
p = new TreeProperties("forge.properties");
|
||||
p = new TreeProperties(NewConstants.PREFS_MAIN_PROPERTIES_FILE);
|
||||
p.rethrow();
|
||||
} catch (final IOException ex) {
|
||||
ErrorViewer.showError(ex);
|
||||
|
||||
@@ -43,10 +43,12 @@ public final class NewConstants {
|
||||
/** Constant <code>CARDFORGE_URL = "program/cardforgeURL"</code>. */
|
||||
public static final String CARDFORGE_URL = "program/cardforgeURL";
|
||||
|
||||
/** Constant <code>PREFERENCE_FILE = "forge.preferences"</code>. */
|
||||
public static final String PREFERENCE_FILE = "forge.preferences";
|
||||
/** Constant <code>PREFERENCE_FILE = "forge.preferences"</code>. */
|
||||
public static final String PREFERENCES_FILE_EDITOR = "editor.preferences";
|
||||
/** Constant <code>PREFS_GLOBAL_FILE = "forge.preferences"</code>. */
|
||||
public static final String PREFS_GLOBAL_FILE = "res/preferences/forge.preferences";
|
||||
/** Constant <code>PREFS_GLOBAL_FILE = "editor.preferences"</code>. */
|
||||
public static final String PREFS_EDITOR_FILE = "res/preferences/editor.preferences";
|
||||
/** */
|
||||
public static final String PREFS_MAIN_PROPERTIES_FILE = "res/preferences/main.properties";
|
||||
|
||||
/** Constant <code>LAYOUT_DIR = "res/layouts/"</code>. */
|
||||
public static final String LAYOUT_DIR = "res/layouts/";
|
||||
|
||||
Reference in New Issue
Block a user