mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 13:17:00 -04:00
add download_image, refactor import_image
This commit is contained in:
@@ -189,7 +189,7 @@ public:
|
||||
|
||||
// ----------------------------------------------------------------------------- : Package : inside
|
||||
|
||||
bool Package::existsIn(const String& file) {
|
||||
bool Package::contains(const String& file) {
|
||||
FileInfos::iterator it = files.find(normalize_internal_filename(file));
|
||||
if (it == files.end()) {
|
||||
// does it look like a relative filename?
|
||||
@@ -650,11 +650,11 @@ void Packaged::loadFully() {
|
||||
}
|
||||
}
|
||||
|
||||
void Packaged::save() {
|
||||
void Packaged::save(bool remove_unused) {
|
||||
WITH_DYNAMIC_ARG(writing_package, this);
|
||||
writeFile(typeName(), *this, fileVersion());
|
||||
referenceFile(typeName());
|
||||
Package::save();
|
||||
Package::save(remove_unused);
|
||||
}
|
||||
void Packaged::saveAs(const String& package, bool remove_unused, bool as_directory) {
|
||||
WITH_DYNAMIC_ARG(writing_package, this);
|
||||
|
||||
@@ -178,15 +178,15 @@ public:
|
||||
// --------------------------------------------------- : Managing the inside of the package
|
||||
|
||||
/// Check if a file is in the package.
|
||||
bool existsIn(const String& file);
|
||||
inline bool existsIn(const LocalFileName& file) {
|
||||
return existsIn(file.fn);
|
||||
bool contains(const String& file);
|
||||
inline bool contains(const LocalFileName& file) {
|
||||
return contains(file.fn);
|
||||
}
|
||||
|
||||
/// Open an input stream for a file in the package.
|
||||
unique_ptr<wxInputStream> openIn(const String& file);
|
||||
inline unique_ptr<wxInputStream> openIn(const LocalFileName& file) {
|
||||
return openIn(file.fn);
|
||||
return openIn(file.fn);
|
||||
}
|
||||
|
||||
/// Open an output stream for a file in the package.
|
||||
@@ -331,7 +331,7 @@ public:
|
||||
void open(const String& package, bool just_header = false);
|
||||
/// Ensure the package is fully loaded.
|
||||
void loadFully();
|
||||
void save();
|
||||
void save(bool remove_unused = true);
|
||||
void saveAs(const String& package, bool remove_unused = true, bool as_directory = false);
|
||||
void saveCopy(const String& package);
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ bool PackageManager::existsInPackage(const String& name) {
|
||||
if (start < pos && pos != String::npos) {
|
||||
// open package
|
||||
PackagedP p = openAny(name.substr(start, pos - start));
|
||||
return p->existsIn(name.substr(pos + 1));
|
||||
return p->contains(name.substr(pos + 1));
|
||||
}
|
||||
}
|
||||
throw FileNotFoundError(name, _("No package name specified, use '/package/filename'"));
|
||||
|
||||
Reference in New Issue
Block a user