-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
262 additions
and
153 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,85 +1,28 @@ | ||
# Copyright 2020-2020 the openage authors. See copying.md for legal info. | ||
|
||
""" | ||
Stores information about a game edition/expansion.. | ||
""" | ||
|
||
|
||
class GameInfo: | ||
class GameFileVersion: | ||
""" | ||
Stores information about a game edition or expansion, mostly | ||
indicators to detect the version as well as paths to assets | ||
and data files. | ||
Can be used to associate a file hash with a specific version number. | ||
This can be used to pinpoint the exact version of a game. | ||
""" | ||
|
||
def __init__(self, name, support_status, version_detect, | ||
media_paths, target_modpacks): | ||
def __init__(self, filepath, hashes): | ||
""" | ||
Create a new GameInfo instance. | ||
:param name: Name of the game. | ||
:type name: str | ||
:param support_status: Whether the converter can read/convert | ||
the game to openage formats. | ||
:type support_status: SupportStatus | ||
:param version_detect: A set of (file, [hashes]) that is unique to this | ||
version of the game. | ||
:type version_detect: set | ||
:param media_paths: A dictionary with MediaType as keys and | ||
(bool, [str]). bool denotes whether the path | ||
is a file that requires extraction. every str is | ||
a path to a file or folder. | ||
:type media_paths: dict | ||
:param target_modpacks: A list of tuples containing | ||
(modpack_name, uid, expected_manifest_hash). | ||
These modpacks will be created for this version. | ||
:type target_modpacks: list | ||
Create a new file hash to version association. | ||
""" | ||
|
||
self.name = name | ||
self.support_status = support_status | ||
self.version_detect = version_detect | ||
self.media_paths = media_paths | ||
self.target_modpacks = target_modpacks | ||
self.path = filepath | ||
self.hashes = hashes | ||
|
||
|
||
class GameEditionInfo(GameInfo): | ||
""" | ||
Info about a GameEdition. | ||
""" | ||
|
||
def __init__(self, name, support_status, version_detect, | ||
media_paths, target_modpacks, expansions): | ||
def get_path(self): | ||
""" | ||
Create a new GameEditionInfo instance. | ||
:param name: Name of the game. | ||
:type name: str | ||
:param support_status: Whether the converter can read/convert | ||
the game to openage formats. | ||
:type support_status: SupportStatus | ||
:param version_detect: A set of of (file, {hash: version}) that is | ||
unique to this version of the game. | ||
:type version_detect: set | ||
:param media_paths: A dictionary with MediaType as keys and | ||
(bool, [str]). bool denotes whether the path | ||
is a file that requires extraction. every str is | ||
a path to a file or folder. | ||
:type media_paths: dict | ||
:param target_modpacks: A list of tuples containing | ||
(modpack_name, uid, expected_manifest_hash). | ||
These modpacks will be created for this version. | ||
:type target_modpacks: list | ||
:param expansions: A list of expansions available for this edition. | ||
:type expansion: list | ||
Return the path of the file. | ||
""" | ||
super().__init__(name, support_status, version_detect, | ||
media_paths, target_modpacks) | ||
return self.path | ||
|
||
self.expansions = expansions | ||
|
||
|
||
class GameExpansionInfo(GameInfo): | ||
""" | ||
Info about a GameExpansion. | ||
""" | ||
def get_hashes(self): | ||
""" | ||
Return the hash-version association for the file. | ||
""" | ||
return self.hashes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.