    def dump(self, file):
        """ 转储到旧版配置文件 """
        if not file:
            file = 'config.toml'
        if os.path.exists(file):
            from datetime import datetime
            import logging
            logger = logging.getLogger('biliup')
            new_name = f'{file}.backup.{datetime.now().strftime("%Y%m%d%H%M%S")}'
            logger.info(f"{file} 文件已存在，已将原文件重命名为 {new_name}")
            os.rename(file, new_name)
        exclude_keys = ['PluginInfo', 'upload_filename', 'url_upload_count']
        temp = {k: v for k, v in self.data.items() if k not in exclude_keys}
        if self.data.get('yaml') or file.endswith(".yaml"):
            import yaml
            with open(file, 'w+', encoding='utf-8') as stream:
                yaml.dump(temp, stream, default_flow_style=False, allow_unicode=True)
        else:
            import tomli_w
            # print(config)
            with open(file, 'wb') as stream:
                tomli_w.dump(temp, stream)
        return file
转储到旧版配置文件
biliup/config.py