Comments (4)
BTW, the only reason why Converter
is not an Archive
that does file_saver.save(one_file)
is to ensure that following
./arc_unpacker ~/file.dat ~/file2.dat
produces
~/file~.png
~/file2~.png
and not
~/file~/file.png
~/file2~/file2.png
Because of this, the code needs to be duplicated all over the place:
ConverterFactory
↔ArchiveFactory
Converter::add_cli_help
↔Archive::add_cli_help
Converter::parse_cli_options
↔Archive::parse_cli_options
Converter::try_convert(File &)
↔Archive::try_unpack(File &, FileSaver &)
Converter::convert(File &)
↔Archive::unpack(File &, FileSaver &)
Converter::convert_internal(File &)
↔Archive::unpack_internal(File &, FileSaver &)
bin/file_decoder
↔bin/arc_unpacker
If Archive
and Converter
were to be merged into one Transformer
, the original behaviour could be emulated with a use_folder_prefix
public field inside each Transformer
. This isn't exactly best solution ever, but it's probably better than having to deal with such a dual design thorough whole project.
from arc_unpacker.
I tried implementing this by making Converter
derive from Archive
( == Transformer
from my ponderings above) but it didn't end too well, since it didn't understood that nested archives should have name in form of parent file/inner file
. It just kept naming everything in inner file
form.
If I am to merge these classes indeed, use_folder_prefix
or injecting file naming strategy on Transformer
level is an absolute must. Additionally, the ideal solution would unify file naming logic between main executable and nested archives handling. Right now they're completely separate 👎
The other option to detect how to name the file is to do it after the fact. If the transformer produced more than two files, it should create a folder for them, if not, place it aside the original file. Detecting this is difficult, because it would require file pooling to be able to tell how to proceed before saving, or renaming the files after the fact. Both variants can get a little mind-numbing when considering nested archives.
Needless to say, I'd prefer automatic way over manual, failure-prone micromanagement. I'm going to try file pools this weekend. Until then, I'll focus on making handling nested archives less pain in the ass (see 6a270ee for what I mean).
from arc_unpacker.
Needless to say, I'd prefer automatic way over manual, failure-prone micromanagement. I'm going to try file pools this weekend. Until then, I'll focus on making handling nested archives less pain in the ass (see 6a270ee for what I mean).
Actually I just stumbled across a use case that makes manual file naming convention injecting seem much more reasonable. Imagine archive containing files, that, once extracted, make up for the final file system:
th.dat
file1.anm
data/character/patchouli/sprite1.png
data/character/patchouli/sprite2.png
data/character/patchouli/sprite3.png
file2.anm
data/character/alice/sprite1.png
data/character/alice/sprite2.png
data/character/alice/sprite3.png
So forget about file pools for now, gonna go with use_folder_prefix
(or similar, more enterprisey approach). The way I see it is that both Archive
and Converter
should derive from a Transformer
and implement use_folder_prefix
. By default Converter
disables prefixes and Archive
enables them, but at the same time, it's left public so it can be manually tweaked depending on current needs. After that, FileSaver
proxy within Transformer
will either add the folder prefix to the saved file or not, depending on configuration of active sub-transformer.
from arc_unpacker.
Fuck yeah 💯
The naming management is now hard-to-follow, but it works better than before, made project structure much cleaner and unit tests should convey why it needs to be like this. I'm quite satisfied with the results.
from arc_unpacker.
Related Issues (20)
- Game Request: Memories Off -Innocent Fille-
- Game Request: Wagamama High Spec
- Game Request: Making*Lovers HOT 1
- Add "If You Love Me, Then Say So!" to supported game list
- 'recognition finished with errors (Bad value for option "--plugin".' HOT 1
- help :( with vnmaker
- G-Senjou No Maou (decrypting chunk issue)
- Are there plans for a new release? HOT 1
- Game Request: Oppai Gakuen Marching Band Bu!
- Game Request: Kyonyuu Kazoku Saimin
- Add "Baku Ane ~Otouto Shibocchau zo!" to supported game HOT 1
- boost : : filesystem: :path codecvt to wstring: error
- Front wing's (ISLAND STEAM GAME) HOT 1
- Game Request: Koi x Shin Ai Kanojo
- Game Request: [Silky's] Gakuen Saimin Reido -Sakki made, Daikirai Datta Hazu na no ni-
- Game request: The Runaway Girl And Me - recognition finished with errors (Premature end of file)
- Convert from tlg to png?
- Game request: Dolphin Divers
- Unpack Tsumamigui3 use CLI:--dec=alice-soft/afa report error: recognition finished with errors (Invalid byte sequence) HOT 1
- [Valkyria][140926]Gachinko! B* Club HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from arc_unpacker.