代码拉取完成,页面将自动刷新
import os
import os.path
rootdir = "./Result/cs"
class_names = []
for parent,dirnames,filenames in os.walk(rootdir):
for filename in filenames:
if filename.find("ConfigTable.cs") > 0:
name = filename[0:len(filename)-len("ConfigTable.cs")]
# print "filename is:" + name
class_names.append(name)
mgr_path = "./Result/cs/ConfigMgr.cs"
mgr_file = open(mgr_path,'w')
# import headers
mgr_file.write("using System.Collections;"+os.linesep+""+os.linesep+"public class ConfigMgr"+os.linesep+"{"+os.linesep+"\tpublic static ConfigMgr GetInstance() "+os.linesep+"\t{ "+os.linesep+"\t\tif(null == mInstance)"+os.linesep+"\t\t{"+os.linesep+"\t\t\tmInstance = new ConfigMgr();"+os.linesep+"\t\t\tmInstance.Init(); "+os.linesep+"\t\t}"+os.linesep+"\t\treturn mInstance;"+os.linesep+"\t}"+os.linesep+"\tprivate static ConfigMgr mInstance = null;"+os.linesep+""+os.linesep+"")
# declare config members
for i in range(len(class_names)):
name = class_names[i]
mgr_file.write("\tpublic "+name+"ConfigTable\t"+name+";"+os.linesep+"")
mgr_file.write(""+os.linesep+"")
mgr_file.write("\tpublic void Init () "+os.linesep+"\t{"+os.linesep+"")
# load member instances
for i in range(len(class_names)):
name = class_names[i]
mgr_file.write("\t\t"+name+" = new "+name+"ConfigTable();"+os.linesep+"")
mgr_file.write("\t\t"+name+".Load();"+os.linesep)
mgr_file.write(""+os.linesep+"\t}"+os.linesep+"}")
mgr_file.close()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。