# -*- coding: utf-8 -*- import os def replaceFile(filename): print(filename) lines = open(filename, 'r', encoding='UTF-8').readlines() fp = open(filename, 'w') for line in lines: line = line.replace('public partial class', 'internal partial class').replace('public class', 'internal class').replace('public enum', 'internal enum') fp.write(line) fp.close() def replacePath(filepath): files = os.listdir(filepath) for fi in files: fi_d = os.path.join(filepath, fi) if os.path.isfile(fi_d)and os.path.splitext(fi_d)[1] == '.cs': replaceFile(fi_d) # main print(os.sys.version) replacePath('../pandora_cli_proj/pandora/Assets/Scripts/AIMachine/HotFixLogic/GameConfig') # replacePath('../pandora_cli_proj/pandora/Assets/Scripts/AIMachine/HotFixLogic/protocol')