DR -> DR SDK #16
6
DR.py
6
DR.py
@ -8,6 +8,8 @@ import time
|
||||
import cProfile
|
||||
import traceback
|
||||
|
||||
from io import StringIO
|
||||
|
||||
# TODO 默认位置配置文件
|
||||
# TODO 可自定义工作路径
|
||||
|
||||
@ -89,6 +91,10 @@ def main() -> None:
|
||||
print(error_format['error.unknown'])
|
||||
print(error)
|
||||
crash.create_crash_report(error)
|
||||
cache_steam = StringIO()
|
||||
crash.write_info_to_cache(cache_steam)
|
||||
text = cache_steam.getvalue()
|
||||
print(text)
|
||||
else:
|
||||
crash.record_thread = False
|
||||
print(crash.all_thread)
|
||||
|
@ -113,7 +113,7 @@ class _DR_runtime(Options):
|
||||
API_version: Version = Api_version # DR SDK API 版本
|
||||
DR_long_version: int = long_version # DR SDK 内部协议版本 (不要问我为什么不用 Version,我也在考虑)
|
||||
|
||||
DR_Mod_List: List[Tuple[str, Version]] = [] # DR Mod 列表
|
||||
DR_Mod_List: List[Tuple[str, Version]] = [] # DR Mod 列表 (name, version)
|
||||
|
||||
DR_Rust_version: Version = DR_rust_version # 后面要去掉的 DR_rs 版本
|
||||
DR_Rust_get_version: Optional[Version] = None # 后面也要去掉的 DR_rs 版本
|
||||
@ -177,6 +177,7 @@ class _DR_runtime(Options):
|
||||
except ImportError:
|
||||
print(f'ImportError when loading mod {mod_path}')
|
||||
traceback.print_exc()
|
||||
self.DR_Mod_List = [(mod, Version('0.0.0-unknown')) for mod in mods]
|
||||
return mods
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ file_error = {FileNotFoundError: 'no {filetype} file was founded!:\n file name:
|
||||
|
||||
|
||||
def load_file(file_name: str,
|
||||
stack: Union[str, list, dict] = None,
|
||||
stack: Union[str, list, dict, None] = None,
|
||||
raise_error: bool = True,
|
||||
encoding: str = 'utf-8') -> Union[dict, ElementTree.ElementTree]:
|
||||
f_type = file_name[file_name.rfind('.') + 1:] # 从最后一个.到末尾 (截取文件格式)
|
||||
|
@ -50,6 +50,9 @@
|
||||
- Add `DR_Mod_List: List[Tuple[str, Version]]` field
|
||||
- Add `load_mods() -> None` method
|
||||
- Add `find_mods -> List[str]` method
|
||||
- 现在游戏崩溃时会自动在 stdio 中输出崩溃日志 内容跟 crash report 中的基本相同
|
||||
- Now when the game crashes, it will automatically output the crash log in stdio
|
||||
- The content of the crash log is basically the same as the crash report
|
||||
|
||||
### Mod Loader
|
||||
|
||||
|
@ -102,6 +102,9 @@ class Version:
|
||||
version_str += '+' + str(self.build)
|
||||
return version_str
|
||||
|
||||
def __repr__(self):
|
||||
return 'Version({})'.format(self.__str__())
|
||||
|
||||
def __getitem__(self, index):
|
||||
if index < len(self.component):
|
||||
return self.component[index]
|
||||
|
Loading…
Reference in New Issue
Block a user