protected override void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WritePropertyName("width");
     writer.WriteValue(Width);
     writer.WritePropertyName("height");
     writer.WriteValue(Height);
 }
Beispiel #2
0
 protected override void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WritePropertyName("sprite");
     writer.WriteValue(_spriteAsset);
     writer.WritePropertyName("depth");
     writer.WriteValue(Depth);
 }
Beispiel #3
0
        protected override void WriteKeys(Newtonsoft.Json.JsonWriter writer)
        {
            if (DateStyle != FieldDateTimeStyle.Unspecified)
            {
                writer.WritePropertyName("dateStyle");
                writer.WriteValue(DateStyle.ToString());
            }

            if (TimeStyle != FieldDateTimeStyle.Unspecified)
            {
                writer.WritePropertyName("timeStyle");
                writer.WriteValue(TimeStyle.ToString());
            }

            if (IsRelative.HasValue)
            {
                writer.WritePropertyName("isRelative");
                writer.WriteValue(IsRelative.Value);
            }

            if (IgnoresTimeZone.HasValue)
            {
                writer.WritePropertyName("ignoresTimeZone");
                writer.WriteValue(IgnoresTimeZone.Value);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Writes the JSON representation of the object.
        /// </summary>
        public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer)
        {
            var attribute = value as DataService.Attribute;

            if (attribute != null)
            {
                writer.WritePropertyName(attribute.Key.ToString(System.Globalization.CultureInfo.InvariantCulture));
                writer.WriteValue(attribute.Value);
            }
            else
            {
                writer.WriteStartObject();

                var attributes = (DataService.Attribute[])value;
                if (attributes != null && attributes.Length > 0)
                {
                    foreach (var att in attributes)
                    {
                        writer.WritePropertyName(att.Key.ToString(System.Globalization.CultureInfo.InvariantCulture));
                        writer.WriteValue(att.Value);
                    }
                }
                writer.WriteEndObject();
            }
        }
Beispiel #5
0
 public void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("averageForce");
     writer.WriteValue(this.AverageForce);
     writer.WritePropertyName("forceVariation");
     writer.WriteValue(this.ForceVariation);
     writer.WriteEndObject();
 }
Beispiel #6
0
 protected override void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WritePropertyName("size");
     writer.WriteValue(Size);
     writer.WritePropertyName("equip");
     writer.WriteValue(Equip.Length > 0);
     writer.WritePropertyName("use");
     writer.WriteValue(UseItems.Length > 0);
 }
 private void WriteExtendedJson(Newtonsoft.Json.JsonWriter writer, BsonRegularExpression regularExpression)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("$regex");
     writer.WriteValue(regularExpression.Pattern);
     writer.WritePropertyName("$options");
     writer.WriteValue(regularExpression.Options);
     writer.WriteEndObject();
 }
 private void WriteExtendedJson(Newtonsoft.Json.JsonWriter writer, BsonBinaryData binaryData, Newtonsoft.Json.JsonSerializer serializer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("$binary");
     writer.WriteValue(Convert.ToBase64String(binaryData.Bytes));
     writer.WritePropertyName("$type");
     writer.WriteValue(((int)binaryData.SubType).ToString("x2"));
     writer.WriteEnd();
 }
Beispiel #9
0
 private void WriteExtendedJson(Newtonsoft.Json.JsonWriter writer, BsonJavaScriptWithScope value, Newtonsoft.Json.JsonSerializer serializer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("$code");
     writer.WriteValue(value.Code);
     writer.WritePropertyName("$scope");
     serializer.Serialize(writer, value.Scope, typeof(BsonDocument));
     writer.WriteEndObject();
 }
Beispiel #10
0
 public void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("length");
     writer.WriteValue(this.Length);
     writer.WritePropertyName("stiffness");
     writer.WriteValue(this.Stiffness);
     writer.WriteEndObject();
 }
 public void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("velocity");
     writer.WriteValue(this.Velocity);
     writer.WritePropertyName("power");
     writer.WriteValue(this.Power);
     writer.WriteEndObject();
 }
Beispiel #12
0
 public void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("south");
     writer.WriteValue(this.SouthPositive ? this.SouthAxis.ToString() : '-' + this.SouthAxis.ToString());
     writer.WritePropertyName("east");
     writer.WriteValue(this.EastPositive ? this.EastAxis.ToString() : '-' + this.EastAxis.ToString());
     writer.WriteEndObject();
 }
Beispiel #13
0
 private void WriteExtendedJson(Newtonsoft.Json.JsonWriter writer, BsonDateTime value)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("$date");
     writer.WriteStartObject();
     writer.WritePropertyName("$numberLong");
     writer.WriteValue(value.MillisecondsSinceEpoch.ToString(NumberFormatInfo.InvariantInfo));
     writer.WriteEndObject();
     writer.WriteEndObject();
 }
 protected override void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WritePropertyName("gravity");
     writer.WriteValue(Gravity);
     writer.WritePropertyName("friction");
     writer.WriteValue(Friction);
     writer.WritePropertyName("targetedTags");
     writer.WriteStartArray();             // Array of components
     TargetedTags.ForEach(t => writer.WriteValue(t));
     writer.WriteEndArray();
 }
Beispiel #15
0
 protected override void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WritePropertyName("sprite");
     writer.WriteValue(_spriterAsset);
     writer.WritePropertyName("depth");
     writer.WriteValue(Depth);
     writer.WritePropertyName("scale");
     writer.WriteValue(Scale);
     writer.WritePropertyName("speed");
     writer.WriteValue(DefaultPlaybackSpeed);
 }
 public void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("r");
     writer.WriteValue(this.R);
     writer.WritePropertyName("g");
     writer.WriteValue(this.G);
     writer.WritePropertyName("b");
     writer.WriteValue(this.B);
     writer.WriteEndObject();
 }
 public void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("x");
     writer.WriteValue(this.X);
     writer.WritePropertyName("y");
     writer.WriteValue(this.Y);
     writer.WritePropertyName("z");
     writer.WriteValue(this.Z);
     writer.WriteEndObject();
 }
 private void WriteExtendedJson(Newtonsoft.Json.JsonWriter writer, BsonTimestamp value)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("$timestamp");
     writer.WriteStartObject();
     writer.WritePropertyName("t");
     writer.WriteValue(value.Timestamp);
     writer.WritePropertyName("i");
     writer.WriteValue(value.Increment);
     writer.WriteEndObject();
     writer.WriteEndObject();
 }
 public void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("type");
     writer.WriteValue(this.Type.ToString());
     writer.WritePropertyName("gears");
     writer.WriteStartArray();
     foreach (EngineGear g in this.Gears)
     {
         g.WriteToJson(writer);
     }
     writer.WriteEndArray();
     writer.WriteEndObject();
 }
Beispiel #20
0
        public void WriteToJson(Newtonsoft.Json.JsonWriter writer)
        {
            writer.WriteStartObject();
            writer.WritePropertyName("x");
            writer.WriteValue(this.X);
            writer.WritePropertyName("y");
            writer.WriteValue(this.Y);
            writer.WritePropertyName("z");
            writer.WriteValue(this.Z);
            if (this.Margin != 0)
            {
                writer.WritePropertyName("margin");
                writer.WriteValue(this.Margin);
            }
            writer.WritePropertyName("pointlist");
            writer.WriteStartArray();

            foreach (float[] points in this.PointList)
            {
                writer.WriteStartObject();
                writer.WritePropertyName("x");
                writer.WriteValue(points[0]);
                writer.WritePropertyName("y");
                writer.WriteValue(points[1]);
                writer.WritePropertyName("z");
                writer.WriteValue(points[2]);
                writer.WriteEndObject();
            }

            writer.WriteEndArray();
            writer.WriteEndObject();
        }
Beispiel #21
0
        protected override void WriteKeys(Newtonsoft.Json.JsonWriter writer)
        {
            if (!string.IsNullOrEmpty(CurrencyCode))
            {
                writer.WritePropertyName("currencyCode");
                writer.WriteValue(CurrencyCode);
            }

            if (NumberStyle != FieldNumberStyle.Unspecified)
            {
                writer.WritePropertyName("numberStyle");
                writer.WriteValue(NumberStyle.ToString());
            }
        }
Beispiel #22
0
 protected override void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     base.WriteToJson(writer);
     writer.WritePropertyName("speed");
     writer.WriteValue(_baseSpeed);
     writer.WritePropertyName("stamina");
     writer.WriteValue(_baseMaxStamina);
     writer.WritePropertyName("expReward");
     writer.WriteValue(_expReward);
     writer.WritePropertyName("targetedTags");
     writer.WriteStartArray();             // Array of components
     TargetedTags.ForEach(t => writer.WriteValue(t));
     writer.WriteEndArray();
 }
Beispiel #23
0
        public override void WriteJson(Newtonsoft.Json.JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer)
        {
            DbGeography geo = value as DbGeography;

            if (geo == null)
            {
                throw new ArgumentException("Parameter is not a DbGeography", "value");
            }
            writer.WriteStartObject();
            writer.WritePropertyName("Lon");
            writer.WriteValue(geo.Longitude);
            writer.WritePropertyName("Lat");
            writer.WriteValue(geo.Latitude);
            writer.WriteEndObject();
        }
Beispiel #24
0
 private void WriteExtendedJson(Newtonsoft.Json.JsonWriter writer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("$maxKey");
     writer.WriteValue(1);
     writer.WriteEndObject();
 }
Beispiel #25
0
        public static void ToJson(Newtonsoft.Json.JsonWriter jsonWriter, string name, FunctionalGroupDefinitions functionalGroupDefinitions)
        {
            jsonWriter.WritePropertyName(name);
            jsonWriter.WriteStartObject();

            Madingley.Serialization.Common.Writer.PropertyKeyValuePairs(jsonWriter, "IndexLookupFromTrait", functionalGroupDefinitions.IndexLookupFromTrait,
                                                                        (jw, key, value) =>
            {
                Madingley.Serialization.Common.Writer.PropertyInlineKeyValuePairs(jw, key, value,
                                                                                  (jw2, key2, value2) =>
                {
                    Madingley.Serialization.Common.Writer.PropertyArray(jw2, key2, value2, Madingley.Serialization.Common.Writer.WriteInt);
                });
            });

            Madingley.Serialization.Common.Writer.PropertyKeyValuePairs(jsonWriter, "FunctionalGroupProperties", functionalGroupDefinitions.FunctionalGroupProperties,
                                                                        (jw, key, value) =>
            {
                Madingley.Serialization.Common.Writer.PropertyInlineArray(jw, key, value, Madingley.Serialization.Common.Writer.WriteDouble);
            });

            Madingley.Serialization.Common.Writer.PropertyKeyValuePairs(jsonWriter, "TraitLookupFromIndex", functionalGroupDefinitions.IndexLookupFromTrait,
                                                                        (jw, key, value) =>
            {
                Madingley.Serialization.Common.Writer.PropertyInlineKeyValuePairs(jw, key, value,
                                                                                  (jw2, key2, value2) =>
                {
                    Madingley.Serialization.Common.Writer.PropertyArray(jw2, key2, value2, Madingley.Serialization.Common.Writer.WriteInt);
                });
            });

            Madingley.Serialization.Common.Writer.PropertyInlineArray(jsonWriter, "AllFunctionalGroupsIndex", functionalGroupDefinitions.AllFunctionalGroupsIndex, Madingley.Serialization.Common.Writer.WriteInt);

            jsonWriter.WriteEndObject();
        }
 private void WriteExtendedJson(Newtonsoft.Json.JsonWriter writer, BsonJavaScript value, Newtonsoft.Json.JsonSerializer serializer)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("$code");
     writer.WriteValue(value.Code);
     writer.WriteEndObject();
 }
 private void WriteExtendedJson(Newtonsoft.Json.JsonWriter writer, ObjectId value)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("$oid");
     writer.WriteValue(BsonUtils.ToHexString(value.ToByteArray()));
     writer.WriteEndObject();
 }
Beispiel #28
0
        public override void WriteValue(object Value, Newtonsoft.Json.JsonWriter Writer, MudObject Owner)
        {
            var contents = Value as Dictionary <RelativeLocations, List <MudObject> >;

            if (contents == null)
            {
                throw new InvalidOperationException();
            }

            Writer.WriteStartObject();

            foreach (var relloc in contents)
            {
                Writer.WritePropertyName(RelativeLocationToString(relloc.Key));
                Writer.WriteStartArray();

                foreach (var mudObject in relloc.Value.Where(o => o.IsNamedObject && o.IsInstance))
                {
                    Writer.WriteValue(mudObject.GetFullName());
                }

                Writer.WriteEndArray();
            }

            Writer.WriteEndObject();
        }
Beispiel #29
0
 private void WriteExtendedJson(Newtonsoft.Json.JsonWriter writer, BsonSymbol value)
 {
     writer.WriteStartObject();
     writer.WritePropertyName("$symbol");
     writer.WriteValue(value.Name);
     writer.WriteEndObject();
 }
Beispiel #30
0
 protected override void WriteToJson(Newtonsoft.Json.JsonWriter writer)
 {
     base.WriteToJson(writer);
     writer.WritePropertyName("size");
     writer.WriteValue(Size);
     writer.WriteEnd();
 }