Exemplo n.º 1
0
 def load_config_data(self, file_name):
     gen_cfg_data = CGenCfgData()
     if file_name.endswith('.pkl'):
         with open(file_name, "rb") as pkl_file:
             gen_cfg_data.__dict__ = marshal.load(pkl_file)
         gen_cfg_data.prepare_marshal(False)
     elif file_name.endswith('.yaml'):
         if gen_cfg_data.load_yaml(file_name) != 0:
             raise Exception(gen_cfg_data.get_last_error())
     else:
         raise Exception('Unsupported file "%s" !' % file_name)
     return gen_cfg_data
Exemplo n.º 2
0
 def LoadConfigData(self, FileName):
     GenCfgData = CGenCfgData()
     if FileName.endswith('.pkl'):
         with open(FileName, "rb") as PklFile:
             GenCfgData.__dict__ = marshal.load(PklFile)
     elif FileName.endswith('.dsc'):
         if GenCfgData.ParseDscFile(FileName) != 0:
             raise Exception(GenCfgData.Error)
         if GenCfgData.CreateVarDict() != 0:
             raise Exception(GenCfgData.Error)
     else:
         raise Exception('Unsupported file "%s" !' % FileName)
     GenCfgData.UpdateDefaultValue()
     return GenCfgData