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

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

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

            _array = array;
        }
Exemplo n.º 4
0
        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];
        }
Exemplo n.º 5
0
        private FileFormatException WithLineInfo(JsonValue value)
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

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

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

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