Beispiel #1
0
        internal static FileFormatException Create(Exception exception, JsonValue jsonValue, string filePath)
        {
            var result = Create(exception, jsonValue)
                .WithFilePath(filePath);

            return result;
        }
Beispiel #2
0
        internal static FileFormatException Create(Exception exception, JsonValue jsonValue)
        {
            var result = new FileFormatException(exception.Message, exception)
                .WithLineInfo(jsonValue);

            return result;
        }
Beispiel #3
0
        public JsonArray(JsonValue[] array, int line, int column)
            : base(line, column)
        {
            if (array == null)
            {
                throw new ArgumentNullException(nameof(array));
            }

            _array = array;
        }
        private static string[] ExtractValues(JsonValue json)
        {
            var valueAsString = json as JsonString;
            if (valueAsString != null)
            {
                return new string[] { valueAsString.Value };
            }

            var valueAsArray = json as JsonArray;
            if(valueAsArray != null)
            {
                return valueAsArray.Values.Select(v => v.ToString()).ToArray();
            }
            return new string[0];
        }
Beispiel #5
0
        private FileFormatException WithLineInfo(JsonValue value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            Line = value.Line;
            Column = value.Column;

            return this;
        }
Beispiel #6
0
        internal static FileFormatException Create(string message, JsonValue jsonValue)
        {
            var result = new FileFormatException(message)
                .WithLineInfo(jsonValue);

            return result;
        }
 internal PackIncludeEntry(string target, JsonValue json)
     : this(target, ExtractValues(json), json.Line, json.Column)
 {
 }