public void applyConfig(ConfigBase tempConfig) { if (mFloatOrString) { foreach (var item in tempConfig.getFloatList()) { float value = getFloatParam(item.Key); string comment = getFloatComment(item.Key); // 如果旧表里有键 那么保留目前的值到新表 if (hasParameter(item.Key)) { tempConfig.setFloatParam(item.Key, value, comment); } // 如果旧表里有缺少的键 那么就拿新表的键合并 else { value = tempConfig.getFloatParam(item.Key); comment = tempConfig.getFloatComment(item.Key); tempConfig.setFloatParam(item.Key, value, comment); } } FileUtility.writeTxtFile(mOtherFileName, tempConfig.generateFloatFile()); } else { foreach (var item in tempConfig.getStringList()) { string value = getStringParam(item.Key); string comment = getStringComment(item.Key); if (hasParameter(item.Key)) { tempConfig.setStringParam(item.Key, value, comment); } else { value = tempConfig.getStringParam(item.Key); comment = tempConfig.getStringComment(item.Key); tempConfig.setStringParam(item.Key, value, comment); } } FileUtility.writeTxtFile(mOtherFileName, tempConfig.generateStringFile()); } }