Example #1
0
        /// <summary>
        /// Convenience function for creating a <see cref="JsonFingerprinter"/> and writing a single JSON object.
        /// </summary>
        /// <remarks>
        /// If no <see cref="PathTable"/> is provided, no APIs that expand <see cref="AbsolutePath"/>s can be used by the fingerprinter.
        /// </remarks>
        public static string CreateJsonString(
            Action <JsonFingerprinter> fingerprintOps,
            Formatting formatting     = Formatting.None,
            PathTable pathTable       = null,
            PathExpander pathExpander = null)
        {
            using (var sbPool = Pools.GetStringBuilder())
            {
                var sb = sbPool.Instance;
                using (var writer = new JsonFingerprinter(sb, formatting: formatting, pathTable: pathTable, pathExpander: pathExpander))
                {
                    fingerprintOps(writer);
                }

                return(sb.ToString());
            }
        }
Example #2
0
 /// <inheritdoc />
 public JsonCollectionFingerprinter(JsonFingerprinter jsonFingerprinter) : base(jsonFingerprinter)
 {
     m_jsonFingerprinter = jsonFingerprinter;
 }
Example #3
0
 /// <summary>
 /// Constructor for <see cref="JsonCollectionFingerprinter"/>/ to use the same underlying state.
 /// </summary>
 private JsonFingerprinter(JsonFingerprinter jsonFingerprinter)
 {
     Writer       = jsonFingerprinter.Writer;
     PathTable    = jsonFingerprinter.PathTable;
     PathExpander = jsonFingerprinter.PathExpander;
 }