public override bool Execute() { JObject jsonObj = JObject.Parse(File.ReadAllText(JsonFilePath)); UpdateAttribute(jsonObj, PathToAttribute.Split('.'), NewAttributeValue); File.WriteAllText(JsonFilePath, jsonObj.ToString()); return(true); }
public override bool Execute() { JObject jsonObj = JObject.Parse(File.ReadAllText(JsonFilePath)); string[] escapedPathToAttributeParts = PathToAttribute.Replace("\\.", "\x1F").Split('.'); for (int i = 0; i < escapedPathToAttributeParts.Length; ++i) { escapedPathToAttributeParts[i] = escapedPathToAttributeParts[i].Replace("\x1F", "."); } UpdateAttribute(jsonObj, escapedPathToAttributeParts, NewAttributeValue); File.WriteAllText(JsonFilePath, jsonObj.ToString()); return(true); }
public override bool Execute() { string json = File.ReadAllText(JsonFilePath); string newLineChars = FileUtilities.DetectNewLineChars(json); JObject jsonObj = JObject.Parse(json); string[] escapedPathToAttributeParts = PathToAttribute.Replace("\\.", "\x1F").Split('.'); for (int i = 0; i < escapedPathToAttributeParts.Length; ++i) { escapedPathToAttributeParts[i] = escapedPathToAttributeParts[i].Replace("\x1F", "."); } UpdateAttribute(jsonObj, escapedPathToAttributeParts, NewAttributeValue); File.WriteAllText(JsonFilePath, FileUtilities.NormalizeNewLineChars(jsonObj.ToString(), newLineChars)); return(true); }