﻿// Decompiled with JetBrains decompiler
// Type: MongoDB.Bson.Serialization.Attributes.BsonDefaultValueAttribute
// Assembly: MongoDB.Bson, Version=1.6.1.21837, Culture=neutral, PublicKeyToken=f686731cfb9cc103
// MVID: 93880221-3735-46FB-8891-84D897158E28
// Assembly location: C:\Users\CGA Computer\Desktop\LEGO Universe Stuff\LOCO Server\Unity Web Player Extractor\Saved Files\LOCO Server.unity3d_unpacked\MongoDB.Bson.dll

using MongoDB.Bson.Serialization;
using System;

namespace MongoDB.Bson.Serialization.Attributes
{
  [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field)]
  public class BsonDefaultValueAttribute : Attribute, IBsonMemberMapModifier
  {
    private object _defaultValue;
    private bool _serializeDefaultValue;
    private bool _serializeDefaultValueWasSet;

    public object DefaultValue
    {
      get
      {
        return this._defaultValue;
      }
    }

    [Obsolete("SerializeDefaultValue is obsolete and will be removed in a future version of the C# driver. Please use BsonIgnoreIfDefaultAttribute instead.")]
    public bool SerializeDefaultValue
    {
      get
      {
        return this._serializeDefaultValue;
      }
      set
      {
        this._serializeDefaultValue = value;
        this._serializeDefaultValueWasSet = true;
      }
    }

    public BsonDefaultValueAttribute(object defaultValue)
    {
      this._defaultValue = defaultValue;
    }

    public void Apply(BsonMemberMap memberMap)
    {
      memberMap.SetDefaultValue(this._defaultValue);
      if (!this._serializeDefaultValueWasSet)
        return;
      memberMap.SetIgnoreIfNull(false);
      memberMap.SetIgnoreIfDefault(!this._serializeDefaultValue);
    }
  }
}
