Exemplo n.º 1
0
 /// <inheritdoc/>
 /// <exception cref="ArgumentOutOfRangeException">
 /// <paramref name="token"/> is not an instance of the class
 /// <see cref="JsonArray"/>.
 /// </exception>
 void IJsonCollection.Add(IJsonToken token) {
   JsonArray array = token as JsonArray;
   if (array == null) {
     throw new ArgumentOutOfRangeException(string.Format(
       StringResources.Arg_WrongType, "token", "JsonArray"));
   }
   Add(array);
 }
Exemplo n.º 2
0
        /// <inheritdoc/>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <paramref name="token"/> is not an instance of the class
        /// <see cref="JsonArray"/>.
        /// </exception>
        void IJsonCollection.Add(IJsonToken token)
        {
            JsonArray array = token as JsonArray;

            if (array == null)
            {
                throw new ArgumentOutOfRangeException(string.Format(
                                                          StringResources.Arg_WrongType, "token", "JsonArray"));
            }
            Add(array);
        }
Exemplo n.º 3
0
        /// <inheritdoc/>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <paramref name="token"/> is not instance of the
        /// <see cref="JsonMember"/> class.
        /// </exception>
        void IJsonCollection.Add(IJsonToken token)
        {
            JsonMember member = token as JsonMember;

            if (token == null)
            {
                throw new ArgumentOutOfRangeException(string.Format(
                                                          StringResources.Arg_WrongType, "token", "JsonObject.JsonMember"));
            }
            Add(member);
        }
Exemplo n.º 4
0
        public static Excel.Worksheet Spread(this Excel.Worksheet sheet, IJsonToken jsonToken, string sheetName = null)
        {
            Globals.ThisAddIn.Application.ScreenUpdating = false;

            sheet.Name = (sheetName ?? jsonToken.Path()).ConvertSheetName();
            jsonToken.Spread(sheet);
            sheet.Change += jsonToken.OnChangeValue;
            //sheet.Protect();

            Globals.ThisAddIn.Application.ScreenUpdating = true;
            return(sheet);
        }
Exemplo n.º 5
0
        public override async ValueTask HandleDispatchAsync(IGatewayApiClient shard, IJsonToken data)
        {
            var model     = data.ToType <TModel>();
            var eventArgs = await HandleDispatchAsync(shard, model).ConfigureAwait(false);

            if (eventArgs == null || eventArgs == EventArgs.Empty)
            {
                return;
            }

            await InvokeEventAsync(eventArgs).ConfigureAwait(false);
        }
Exemplo n.º 6
0
        /// <inheritdoc/>
        public string AsJson()
        {
            JsonStringBuilder builder = new JsonStringBuilder();

            builder.WriteBeginObject();
            for (int i = 0, j = members_.Count; i < j; i++)
            {
                IJsonToken token = members_[i];
                builder.WriteUnquotedString(token.AsJson());
            }
            builder.WriteEndObject();
            return(builder.ToString());
        }
Exemplo n.º 7
0
 public abstract ValueTask HandleDispatchAsync(IGatewayApiClient shard, IJsonToken data);
Exemplo n.º 8
0
 internal Token(IJsonToken json, TrelloAuthorization auth)
     : this(json.Id, auth)
 {
     _context.Merge(json);
 }
Exemplo n.º 9
0
        public static Excel.Workbook SpreadJsonToken(this Excel.Workbook book, Excel.Worksheet currentSheet, IJsonToken jsonToken)
        {
            var sheetName = jsonToken.Path().ConvertSheetName();

            if (book.SheetList().Any(x => x.Name == sheetName))
            {
                Excel.Worksheet sht = book.Sheets[sheetName];
                sht.Activate();
            }
            else
            {
                Excel.Worksheet sheet = book.Sheets.Add(After: currentSheet);
                sheet.Spread(jsonToken);
            }
            return(book);
        }
 public static bool CanSpreadType(this IJsonToken jsonToken)
 => jsonToken.Type().CanSpreadType();
Exemplo n.º 11
0
 public GatewayDispatchReceivedEventArgs(string name, IJsonToken data)
 {
     Name = name;
     Data = data;
 }
Exemplo n.º 12
0
 /// <inheritdoc/>
 public void Add(IJsonToken json_token)
 {
     tokens_.Add(json_token);
 }