/ResourceEnumGenerator

A tool for generating code dynamically based on the config file for the folder selected(When dropping a new file or saving the config).

Primary LanguageJavaGNU Lesser General Public License v3.0LGPL-3.0

ResourceEnumGenerator

It is capable to generate dynamically code based on the config file for the folder selected.

I wrote it for creating enums based on a resources folder.

Functionalities:

  • Generating JSON or Javascript Object
  • Generating Enum for Java
  • Generating Enum for C styled languages
  • String variable type
  1. The program auto generates some default settings.config file (for C#) in its executable directory
  2. If you're using windows, you will be able to see in the SystemTray one icon
  3. By right-clicking on it, some user-friendly functionalities will appear
  4. The program will listen to one input folder, in the settings.config it is as PATH_TO_WATCH
  5. After that, you should update its PATH_TO_CREATE_FILE (aka Output Path)
  6. You can configure the settings.config for creating enumerators for your language
  7. You will be able to drag and drop files inside the folder listening, it will dynamically update your enumerators

Explanation on settings.config

Setting Name Default Config Functionality
PATH_TO_WATCH= ./ Input path(always recursive)
PATH_RELATIVE_TO= Path where the enum constant will point to, defaulted on null
PATH_TO_CREATE_FILE= ./enumwriter.cs Output path
WILL_USE_CLASS_NAME= true Class name on top of file(Defaulted on input directory name)
RELATIVIZE_PATH_NAMES_TO_GENERATOR_DIRECTORY= true It will relativize the input and output path based on the executable current directory (Recommended when constantly changing drives)
PACKAGE_DECLARATOR= package It will be the declarator for the package/module for the output file
PACKAGE_NAME= The package name, if not defined, no package will be added at the start, necessary in case you're doing a java project
IMPORT_DECLARATOR= import The import keyword, as it rarely needs to import something, it will use Java structure
IMPORT_LIST= Import list separated by ','
WILL_USE_CLASS_NAME= true If will use or not a class name(Json-like)
CUSTOM_CLASS_NAME= If you don't want the default class name
CLASS_NAME_START_WITH_CAPITAL= true Capital for the default class name
CLASS_DECLARATOR= public class Prefix for declarating the class
POST_CLASS_DECLARATOR= Sufix for declarating the class
IS_ENUM_MODE= true For alternating between pure variable assignment
ENUM_DECLARATOR= public enum Prefix for declarating enums
POST_ENUM_DECLARATION= Sufix after the enum name
ENUM_START_BLOCK_SYMBOL= { The block start symbol
ENUM_END_BLOCK_SYMBOL= } The block end symbol
ENUM_LAST_END_BLOCK_SYMBOL= } The block end symbol when it is the last enum to be declarated
ENUM_CONST_SURROUND_WITH= Useful for json object, tested with double quotes
ENUM_START_WITH_CAPITAL= true Capital for the enum names
ENUM_TO_UPPERCASE= false Uppercase for enums
ENUM_CONST_TO_UPPERCASE= false Uppercase for enum constants
INNER_CLASS_DECLARATOR= public static class Prefix for declaring inner objects(folders with folders inside) when recursion is made necessary
POST_INNER_CLASS_DECLARATOR= Sufix the inner class name
INNER_CLASS_START_BLOCK_SYMBOL= } The block start symbol
INNER_CLASS_END_BLOCK_SYMBOL= } The block end symbol
LAST_INNER_CLASS_END_BLOCK_SYMBOL= } The block end symbol when it is the last class to be declarated
STRING_ARRAY_DECLARATOR= public static string[] String declarator (as it will be linked with the enum used as an ID for accessign the resource name)
POST_STRING_ARRAY_DECLARATOR= = new String[] Sufix for the string array name
STRING_ARRAY_PREFIX= get Prefix for the string array name
WILL_START_STRING_ARRAY_WITH_CAPITAL= true Capital for the string array name
STRING_ARRAY_SUFIX= If you prefer using sufixes
STRING_ARRAY_START_BLOCK_SYMBOL= { Defaulted on { symbol, as in many languages is a starting block definition
STRING_ARRAY_END_BLOCK_SYMBOL= }; For ending the string array definition block
LAST_STRING_ARRAY_END_BLOCK_SYMBOL= }; For ending the string array definition block when it is the last string array to be defined
POST_STRING_DEFINITION= , After every string is defined inside the block, the comma will be placed
ASSIGN_SYMBOL= = Did thinking about json, where the assign symbol is ':'
WILL_USE_ASSIGN= false If you need to use the assign symbol(Only on non-enum mode)
WILL_REMOVE_EXTENSION= false Every extension is maintained by replacing with a _, if you prefer, you can remove the extension from the enum name
WILL_REMOVE_EXTENSION_FROM_STRING= false It will remove every extension from the string constants (added for Unity purposes)
IGNORE_EXTENSIONS= .config, .java, .git, .classpath, .project, .meta Will ignore archives with these extensions
IGNORE_PATHS= .git, .vscode, node_modules Will ignore paths with these prefixes

WARNING

Every setting must:
  • End with '= ', yes, there is one default space after every "=" symbol
  • Not listen to Desktop, it won't work
  • Must not be running 2 instances for the same input/output
Folders must:
  • Not have files with foldes in the same path, these files will be ignored
  • Not contain ~ character, as it is one default character for temporary files, it guarantees support for visual studio

If you ever find some bug, contact me