You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.7 KiB

  1. using System;
  2. namespace Newtonsoft.Json.Linq
  3. {
  4. /// <summary>
  5. /// Specifies the settings used when loading JSON.
  6. /// </summary>
  7. internal class JsonLoadSettings
  8. {
  9. private CommentHandling _commentHandling;
  10. private LineInfoHandling _lineInfoHandling;
  11. /// <summary>
  12. /// Initializes a new instance of the <see cref="JsonLoadSettings"/> class.
  13. /// </summary>
  14. public JsonLoadSettings()
  15. {
  16. _lineInfoHandling = LineInfoHandling.Load;
  17. _commentHandling = CommentHandling.Ignore;
  18. }
  19. /// <summary>
  20. /// Gets or sets how JSON comments are handled when loading JSON.
  21. /// </summary>
  22. /// <value>The JSON comment handling.</value>
  23. public CommentHandling CommentHandling
  24. {
  25. get => _commentHandling;
  26. set
  27. {
  28. if (value < CommentHandling.Ignore || value > CommentHandling.Load)
  29. {
  30. throw new ArgumentOutOfRangeException(nameof(value));
  31. }
  32. _commentHandling = value;
  33. }
  34. }
  35. /// <summary>
  36. /// Gets or sets how JSON line info is handled when loading JSON.
  37. /// </summary>
  38. /// <value>The JSON line info handling.</value>
  39. public LineInfoHandling LineInfoHandling
  40. {
  41. get => _lineInfoHandling;
  42. set
  43. {
  44. if (value < LineInfoHandling.Ignore || value > LineInfoHandling.Load)
  45. {
  46. throw new ArgumentOutOfRangeException(nameof(value));
  47. }
  48. _lineInfoHandling = value;
  49. }
  50. }
  51. }
  52. }