/// <summary> /// 设置值 /// </summary> /// <param name="theYaml">YAML对象</param> /// <param name="key">key值</param> /// <param name="value">value值</param> /// <returns>是否成功</returns> public static bool SetYamlValue(YAML theYaml, string key, string value) { key = "patch." + key; bool bolR = false; if (theYaml.FindNodeByKey(key) != null) { //如果存在,修改 bolR = theYaml.Modify(key, value); } else { //如果不存在,添加 bolR = theYaml.Add(key, value, false);; } return(bolR); }
/// <summary> /// 获取值 /// </summary> /// <param name="yaml">YAML对象</param> /// <param name="key">key值</param> /// <returns>获取到的值或者null</returns> public static string GetYamlValue(YAML yaml, string key) { //没有从 x.yaml 加载 return(yaml.Read(key));; }