2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-07-03 09:41:50 +00:00

Rename ZoneLoader and ZoneWriter components to ZoneLoading and ZoneWriting to make a difference between the executive class and the component class

This commit is contained in:
Jan
2019-09-24 22:35:11 +02:00
parent 0d8432d4f7
commit 42af6df5d8
86 changed files with 22 additions and 13 deletions

View File

@ -0,0 +1,16 @@
#include "BlockOverflowException.h"
BlockOverflowException::BlockOverflowException(XBlock* block)
{
m_block = block;
}
std::string BlockOverflowException::DetailedMessage()
{
return "XBlock " + m_block->m_name + " overflowed while trying to load zone.";
}
char const* BlockOverflowException::what() const
{
return "Invalid Zone. XBlock overflowed.";
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "LoadingException.h"
#include "Zone/XBlock.h"
class BlockOverflowException final : public LoadingException
{
XBlock* m_block;
public:
explicit BlockOverflowException(XBlock* block);
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,30 @@
#include "InvalidChunkSizeException.h"
InvalidChunkSizeException::InvalidChunkSizeException(const size_t size)
{
m_size = size;
m_max = 0;
}
InvalidChunkSizeException::InvalidChunkSizeException(const size_t size, const size_t max)
{
m_size = size;
m_max = max;
}
std::string InvalidChunkSizeException::DetailedMessage()
{
if(m_max > 0)
{
return "Zone chunk size has a chunk size of " + std::to_string(m_size) + " which is larger than the maximum of " + std::to_string(m_max);
}
else
{
return "Zone chunk size has an invalid chunk size of " + std::to_string(m_size);
}
}
char const* InvalidChunkSizeException::what() const
{
return "Zone has invalid chunk size";
}

View File

@ -0,0 +1,15 @@
#pragma once
#include "LoadingException.h"
class InvalidChunkSizeException final : public LoadingException
{
size_t m_size;
size_t m_max;
public:
explicit InvalidChunkSizeException(size_t size);
InvalidChunkSizeException(size_t size, size_t max);
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,11 @@
#include "InvalidCompressionException.h"
std::string InvalidCompressionException::DetailedMessage()
{
return "Zone has invalid or unsupported compression. Inflate failed";
}
char const* InvalidCompressionException::what() const
{
return "Zone has invalid or unsupported compression. Inflate failed";
}

View File

@ -0,0 +1,9 @@
#pragma once
#include "LoadingException.h"
class InvalidCompressionException final : public LoadingException
{
public:
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,17 @@
#include "InvalidFileNameException.h"
InvalidFileNameException::InvalidFileNameException(std::string& actualFileName, std::string& expectedFileName)
{
m_actual_file_name = actualFileName;
m_expected_file_name = expectedFileName;
}
std::string InvalidFileNameException::DetailedMessage()
{
return "Name verification failed: The fastfile was created as '" + m_expected_file_name + "' but loaded as '" + m_actual_file_name + "'";
}
char const* InvalidFileNameException::what() const
{
return "The filename when created and when loaded does not match";
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "LoadingException.h"
class InvalidFileNameException final : public LoadingException
{
std::string m_actual_file_name;
std::string m_expected_file_name;
public:
InvalidFileNameException(std::string& actualFileName, std::string& expectedFileName);
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,16 @@
#include "InvalidMagicException.h"
InvalidMagicException::InvalidMagicException(const char* expectedMagic)
{
m_expected_magic = expectedMagic;
}
std::string InvalidMagicException::DetailedMessage()
{
return "Expected magic '" + std::string(m_expected_magic) + "'";
}
char const* InvalidMagicException::what() const
{
return "Encountered invalid magic when loading.";
}

View File

@ -0,0 +1,13 @@
#pragma once
#include "LoadingException.h"
class InvalidMagicException final : public LoadingException
{
const char* m_expected_magic;
public:
explicit InvalidMagicException(const char* expectedMagic);
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,16 @@
#include "InvalidOffsetBlockException.h"
InvalidOffsetBlockException::InvalidOffsetBlockException(const block_t referencedBlock)
{
m_referenced_block = referencedBlock;
}
std::string InvalidOffsetBlockException::DetailedMessage()
{
return "Zone tried to reference invalid block " + std::to_string(m_referenced_block);
}
char const* InvalidOffsetBlockException::what() const
{
return "Zone referenced invalid block";
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "LoadingException.h"
#include "Zone/ZoneTypes.h"
class InvalidOffsetBlockException final : public LoadingException
{
block_t m_referenced_block;
public:
explicit InvalidOffsetBlockException(block_t referencedBlock);
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,18 @@
#include "InvalidOffsetBlockOffsetException.h"
InvalidOffsetBlockOffsetException::InvalidOffsetBlockOffsetException(XBlock* block, const size_t referencedOffset)
{
m_referenced_block = block;
m_referenced_offset = referencedOffset;
}
std::string InvalidOffsetBlockOffsetException::DetailedMessage()
{
return "Zone referenced offset" + std::to_string(m_referenced_offset) + " of block " + m_referenced_block->m_name
+ " which is larger than its size " + std::to_string(m_referenced_block->m_buffer_size);
}
char const* InvalidOffsetBlockOffsetException::what() const
{
return "Zone referenced offset of block that is out of bounds";
}

View File

@ -0,0 +1,15 @@
#pragma once
#include "LoadingException.h"
#include "Zone/XBlock.h"
class InvalidOffsetBlockOffsetException final : public LoadingException
{
XBlock* m_referenced_block;
size_t m_referenced_offset;
public:
InvalidOffsetBlockOffsetException(XBlock* block, size_t referencedOffset);
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,11 @@
#include "InvalidSignatureException.h"
std::string InvalidSignatureException::DetailedMessage()
{
return "Loaded fastfile has an invalid signature.";
}
char const* InvalidSignatureException::what() const
{
return "Loaded fastfile has an invalid signature.";
}

View File

@ -0,0 +1,9 @@
#pragma once
#include "LoadingException.h"
class InvalidSignatureException final : public LoadingException
{
public:
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,17 @@
#include "InvalidVersionException.h"
InvalidVersionException::InvalidVersionException(const unsigned int expectedVersion, const unsigned int actualVersion)
{
m_expected_version = expectedVersion;
m_actual_version = actualVersion;
}
std::string InvalidVersionException::DetailedMessage()
{
return "Expected version " + std::to_string(m_expected_version) + " but encountered version " + std::to_string(m_actual_version);
}
char const* InvalidVersionException::what() const
{
return "Encountered invalid version when loading.";
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "LoadingException.h"
class InvalidVersionException final : public LoadingException
{
unsigned int m_expected_version;
unsigned int m_actual_version;
public:
InvalidVersionException(unsigned int expectedVersion, unsigned int actualVersion);
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,17 @@
#include "InvalidXBlockSizeException.h"
InvalidXBlockSizeException::InvalidXBlockSizeException(const uint64_t size, const uint64_t max)
{
m_size = size;
m_max = max;
}
std::string InvalidXBlockSizeException::DetailedMessage()
{
return "Zone uses more XBlock memory than allowed: " + std::to_string(m_size) + " (max is " + std::to_string(m_max) + ")";
}
char const* InvalidXBlockSizeException::what() const
{
return "Zone has invalid block size";
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "LoadingException.h"
class InvalidXBlockSizeException final : public LoadingException
{
uint64_t m_size;
uint64_t m_max;
public:
InvalidXBlockSizeException(uint64_t size, uint64_t max);
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,9 @@
#pragma once
#include <exception>
#include <string>
class LoadingException : public std::exception
{
public:
virtual std::string DetailedMessage() = 0;
};

View File

@ -0,0 +1,13 @@
#include "UnexpectedEndOfFileException.h"
UnexpectedEndOfFileException::UnexpectedEndOfFileException() = default;
std::string UnexpectedEndOfFileException::DetailedMessage()
{
return "Unexpected end of file";
}
char const* UnexpectedEndOfFileException::what() const
{
return "Unexpected end of file";
}

View File

@ -0,0 +1,11 @@
#pragma once
#include "LoadingException.h"
class UnexpectedEndOfFileException final : public LoadingException
{
public:
UnexpectedEndOfFileException();
std::string DetailedMessage() override;
char const* what() const override;
};

View File

@ -0,0 +1,16 @@
#include "UnsupportedAssetTypeException.h"
UnsupportedAssetTypeException::UnsupportedAssetTypeException(const int assetType)
{
m_asset_type = assetType;
}
std::string UnsupportedAssetTypeException::DetailedMessage()
{
return "Zone has an unsupported asset type " + std::to_string(m_asset_type) + " and therefore cannot be loaded.";
}
char const* UnsupportedAssetTypeException::what() const
{
return "Zone has unsupported asset type.";
}

View File

@ -0,0 +1,13 @@
#pragma once
#include "LoadingException.h"
class UnsupportedAssetTypeException final : public LoadingException
{
int m_asset_type;
public:
explicit UnsupportedAssetTypeException(int assetType);
std::string DetailedMessage() override;
char const* what() const override;
};