diff options
| author | 2014-08-07 00:55:43 -0400 | |
|---|---|---|
| committer | 2014-08-07 00:55:43 -0400 | |
| commit | 6aa7c6121a2ecbe78f14f8c3d7ddb55b8ddb10bd (patch) | |
| tree | 0b97553e42e2e3a52a1aab30914d885d143d5bf0 /src/cuchaz/enigma/gui/SourceFormatter.java | |
| parent | added un-obfuscated classes to the deobfuscated classes list (diff) | |
| download | enigma-fork-6aa7c6121a2ecbe78f14f8c3d7ddb55b8ddb10bd.tar.gz enigma-fork-6aa7c6121a2ecbe78f14f8c3d7ddb55b8ddb10bd.tar.xz enigma-fork-6aa7c6121a2ecbe78f14f8c3d7ddb55b8ddb10bd.zip | |
started working on recognition of non-class member identifiers in the source
got class extends,implements working
and argument,field types
added filtering to make sure highlighted class names are actually classes in the jar
Diffstat (limited to 'src/cuchaz/enigma/gui/SourceFormatter.java')
| -rw-r--r-- | src/cuchaz/enigma/gui/SourceFormatter.java | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/src/cuchaz/enigma/gui/SourceFormatter.java b/src/cuchaz/enigma/gui/SourceFormatter.java deleted file mode 100644 index f387840..0000000 --- a/src/cuchaz/enigma/gui/SourceFormatter.java +++ /dev/null | |||
| @@ -1,62 +0,0 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2014 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Public License v3.0 | ||
| 5 | * which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/gpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma.gui; | ||
| 12 | |||
| 13 | import java.io.BufferedReader; | ||
| 14 | import java.io.IOException; | ||
| 15 | import java.io.StringReader; | ||
| 16 | |||
| 17 | public class SourceFormatter | ||
| 18 | { | ||
| 19 | public static String format( String in ) | ||
| 20 | { | ||
| 21 | return collapseNewlines( in ); | ||
| 22 | } | ||
| 23 | |||
| 24 | private static String collapseNewlines( String in ) | ||
| 25 | { | ||
| 26 | StringBuffer buf = new StringBuffer(); | ||
| 27 | int numBlankLines = 0; | ||
| 28 | |||
| 29 | BufferedReader reader = new BufferedReader( new StringReader( in ) ); | ||
| 30 | String line = null; | ||
| 31 | try | ||
| 32 | { | ||
| 33 | while( ( line = reader.readLine() ) != null ) | ||
| 34 | { | ||
| 35 | // how blank lines is this? | ||
| 36 | boolean isBlank = line.trim().length() == 0; | ||
| 37 | if( isBlank ) | ||
| 38 | { | ||
| 39 | numBlankLines++; | ||
| 40 | |||
| 41 | // stop printing blank lines after the first one | ||
| 42 | if( numBlankLines < 2 ) | ||
| 43 | { | ||
| 44 | buf.append( line ); | ||
| 45 | buf.append( "\n" ); | ||
| 46 | } | ||
| 47 | } | ||
| 48 | else | ||
| 49 | { | ||
| 50 | numBlankLines = 0; | ||
| 51 | buf.append( line ); | ||
| 52 | buf.append( "\n" ); | ||
| 53 | } | ||
| 54 | } | ||
| 55 | } | ||
| 56 | catch( IOException ex ) | ||
| 57 | { | ||
| 58 | // StringReader will never throw an IOExecption here... | ||
| 59 | } | ||
| 60 | return buf.toString(); | ||
| 61 | } | ||
| 62 | } | ||